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

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. This video shows the current progress.

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.

I have written up an instructable with detailed instructions on how to make this project.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

2 thoughts on “Making music with Ultrasonic Sensors, MIDI, and a Raspberry Pi

  1. Elaine Uang

    This is sooo cool! What are you using for sound output (ie type of speakers) ? I have a proposal in for public art project that is almost exactly like this – but I am an electronics neophyte. Would love to learn more – and I definitely need to purchase your breakout board!

    Reply
    1. andygrove Post author

      I’ve been meaning to write up a detailed description of this project so I can publish it on instructables. I’ll try and get to that soon but I’d be happy to give you free advice on your project. The Raspberry Pi has a standard 3.5mm audio jack so you can plug in pretty much any standard amplified speakers, such as PC speakers. I was using a “portable MP3 speaker” in this video. I’ll shoot you an email so that you have my email address.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *