I was very excited to get this going! I had a number of errors regarding the code, resulting in an infinite loop that bricked three Arduinos, or so I thought. Thanks to Tom Igoe, I was able to reset them by pressing the reset button twice in quick succession. This will disable the code from running on the Arduino, but it will show up again in the IDE.
I worked with an Arduino MKRZERO to output MIDI to Ableton via the MIDIUSB library. The nice thing about the MKRZERO is that it will appear as a MIDI controller in Ableton. I began sorting the code from an example code from the MIDIUSB github for note on / note off. The MKRZERO was getting accelerometer data from an Adafruit BNO055 unit. I connected the two using 10-12 feet of wire wrap, which will not be my first choice in the future as it coils up on itself in a miserable way, thus the masking tape along the length of it as see in the video above.
The next trick was to map the data from the X plane of the accelerometer to output MIDI notes in segments as I waved it from left to right and back. With help from my professor Luisa Pereira, I was able to set up the code to only trigger notes when the wand data passed into each new segment of the X axis. Originally, the wand would trigger notes constantly when in each new zone, but with the help of a “switch” in the code, the wand could track whether it was moving into a “new” area. If it entered a new area, the wand would output a “noteOn” message, and as it left that area, it would send a “noteOff”.
I would like to add a button for further functionality as I tie it in to the p5 interface which is linked here. The interface will allow the user to switch between different accompaniment styles. There are three Rhythm, Bass, and Chord choices as well as different scales on the Melody. The user will hover over one of the three buttons and select with the wand button by clicking. In the blank space, I am thinking of having some simple FFT visuals for now.
So I would like to explore using the mouse properties of the MKRZERO simultaneously with MIDIUSB. I could draw a cursor on the sketch and use the wand to control it by mapping the X and Z data of the accelerometer (not Y because that is rotation in this case). I would rather have access to the Mouse/Keyboard features of the MKRZERO to avoid this extra programming.
Future improvements include adding a battery and bluetooth compatibility so that the wand can be wireless.