Tuesday, January 14, 2014

Raspberry Pi Midi Project

Last semester I worked with a couple classmates for a project course to create a raspberry pi theremin. It ended up turning out slightly different but here's a short demo.


(My computer is only in the video to ssh into my pi and run the code)

Our initial idea started as a raspberry pi theremin using sensors rather than antennas to create music. However it was much more interesting to be able to have different instruments available to the player. Our plan was to create a web interface in rails with configurable sound options (such as note length, instrument, metronome, attributing different controls to certain sensors, and a lot more). Unfortunately we ran into a lot of issues with synthesis and hardware shipping delays, so we were unable to finish the web interface and connect it with the raspberry pi in time for our final project demonstration, or at all for that matter because we had to return the lent hardware. Fortunately our project was very unique compared to the rest of the class and the instructors understood how many obstacles we had to overcome, like not receiving the special cable we needed to connect our sensors until the evening before the demonstration.

For a little more about how we did it, we used ruby on a raspberry pi to get data from analog proximity sensors from an arduino over the standard usb serial connection. The data is normalized, and then converted into midi notes which are then played through timidity. The audio quality is much better than we expected from the raspberry pi, but took a lot of time to perfect. Originally we started using different libraries and methods such as fmod (terrible pitch quality on pi), or using a java midi sequencer within jruby (90 second program run delay) but those options became unreasonable. We eventually decided the best choice was timidity using a fluidsynth soundfont. Using midi allowed easy synthesis of different instruments and options to configure the sound.

If you're working on a similar project, feel free to ask for my input on here or Google+ and I'll see if I can help. I also have a document for setting up timidity as I did in this project: https://gist.github.com/nickstanish/8423074#file-timidity-setup


No comments:

Post a Comment