WaveStorm 2.0

As I sat on the beach during my vacation at Cedar Point with my family, I looked over Latke Erie and was yet again amazed. The waves of the lake pour onto the shores not unlike an ocean. The water was soothing and I started thinking. The waves rolling over the lake reminded me of a sound wave: there are big waves, small waves, smaller waves, all going different directions just like the chaos in any given sound, but much slower.

So I wondered... what if I could hear that water. What would that waveform sound like? Would it be interesting?

This thought followed me through summer and into spring where I was actually able to do something with it. As we started to create ideas for final projects for my Digital Electronics class, I was set on figuring out a way to hear the water in some way.

Overview

Basically, the WaveStorm is a MIDI device that has a few extra cool features. First of all, this device has two separate parts that communicate over Bluetooth.

The first of these two devices is the transmitter; the transmitter floats in the water whether that be down a river, on the ocean, in a lake, or in a swimming pool. As the device (secured in a Pelican Micro case and powered by a small battery) floats, it tracks the left and right(X Axis), up and down (Y Axis), and forwards and backwards (Z Axis) motion of the device. These values are the taken in and transformed into usable data, then sent out to the receiver using Bluetooth.

The receiver then taken in these values and sends them out as MIDI information that can control parameters in a DAW (Digital Audio Workstation such as FL Studio). The receiver device has 3 buttons that control whether or not the X, Y, or Z MIDI values are sent to the DAW. It also has 5 buttons to trigger notes in the DAW but technically this could trigger up to 15 notes to play simultaneously because of the toggle switch above that allows you to change the octave up and down. The last button on the device is the “calibrate” button which allows you to calibrate the transmitter to make sure it hits all values on a scale instead of just a  small range.

Code

Click >>HERE<< to download the code files!

20171207_104220.jpg

Pt. 1: Transmitter

First, of course, we have the transmitter. The transmitter simply consists of a Teensy 3.2, a 3.7V LiPo battery, a triple axis accelerometer, and a Bluetooth module. This is all connected to a perfboard and enclosed in a waterproof Pelican 1010 Micro case.

The program is fairly simple… First off the device checks to see if any messages have been sent over the Bluetooth which is sent and received over Serial1 [ checkForCal() ] and if a message has been received, it saves that message as a value that engages an if statement inside of calibrateXYZ() that sends the device into calibration mode if a 1 has been received and changes it back to regular operation if a 0 has been received.

After calibration mode the X, Y, and Z values get tracked through the method checkVal() which has 4 parameters passed into it: pin number, lowest value, highest value, and ‘x’, ‘y’, or ‘z’. These all get passed into the checkVal() method and this method first does an analog read off the appropriate pin then maps that value to fit a value between 0 and 127, constrains the value so that it cannot be higher or lower than 0 to 127, then returns the formatted value.

20171207_101946.jpg

Pt. 2: Receiver

For the receiver, the values get received in packages of 4 over Serial1, the first being a starter value to make sure that the correct values get read in for the correct axes. Next those values get sent to the correct if statement that will either stop or let the value through and convert it into a MIDI CC value that gets transferred to the DAW connected. The buttons on the front of the device labeled X Y and Y dictate whether the value is being sent. If the LED is on next to the button, values are being sent.

The other main function in the program is the calibration method. This method sends either a 1 or a 0 over Serial1 to the device in the water. It stops the values from being sent to the DAW and calibrates the high and low of each axis so that however much the axis is wavering, it covers the whole spectrum of numbers from 0-127. The calibration method is a press and hold button and when the LED next to it is on, it’s calibrating.

The last buttons on the device are the keyboard buttons. These are momentary push buttons but when you push it down it turns on the note but doesn’t release until the button is pushed again. This way the notes can be droned as the axes manipulate parameters. This creates a beautiful ambient synth sound that changes as the water does. This keyboard is also set to a pentatonic scale so that no matter what buttons the user picks, it always sounds good.

Lastly, we simply have a 2-way octave switch that can switch between 3 octaves (up +1, middle 1, down -1). This makes sure that the user isn’t constrained to a single octave but can theoretically play up to 15 notes at a time.