Making music with Ultrasonic Sensors, MIDI, and a Raspberry Pi

March 29, 2017

I have been working on a fun project to make an exhibit for my local makerspace to take to events. I had a ton of spare ultrasonic sensors lying around so I decided to experiment with turning them into a musical instrument using a Raspberry Pi running a software synth.

This project has now been featured on Hackaday! There is also a very detailed Instructable if you want to replicate this project.

The code is very simple. The Raspberry Pi is polling each sensor (with the help of an octasonic breakout board that I designed about a year ago) and translating the distance into a MIDI instruction ("note on" or "note off"). These MIDI instructions are then piped into the stdin of a fluidsynth process, which converts the MIDI instructions into music.

This is my first exposure to MIDI and I love how simple it is to hack music. I'll post an update once we have this project finished and mounted on a frame.