Recantha’s Raspberry Pi music box

Mike Horne, aka Recantha, co-organises the Cambridge Raspberry Jam and Pi Wars, not to mention some amazing parties. He also makes things, most recently this excellent Pi-powered music box. It probably isn’t what you thought of when you read the words “music box”.

As you’ll know if you’re a regular reader of this blog, we’ve a particular soft spot for musical instruments that use a Raspberry Pi, and The Music Box is a lovely example. Inside that eBay-tacular wooden box is a Pi 2, an Adafruit Perma-Proto HAT, and a lot of wiring that Mike can no longer get a decent still picture of because, as with many of the best hacks, it’ll all spill out if he opens the lid too far (but you can see a bit of it in the video). Seven of the coloured buttons on the lid form a keyboard designed to fit Mike’s hand; the square one in the middle turns power to the instrument on and off, and the three potentiometers control volume, choice of instrumental sound effect, and the pitch of the music box’s range. A pair of buttons on the side of the box allow you to shut down or reboot the Pi.

You’ll find all Mike’s code for The Music Box on GitHub, so you can adapt it for your own creations. He writes,

The software is a mixture of GPIO Zero, standard Python and the pyFluidSynth library which communicates with FluidSynth, a synthesiser that plays sound fonts. I loaded thirty-two different sound fonts and it will be easy enough to add more as I can just drop them into the folder and the software will automatically load them… GPIO Zero is the hero here, with its built-in multi-threaded event handlers and MCP3008 support.

Read more on Mike’s blog, and tell us about your own favourite musical hacks – your own, or someone else’s – in the comments!


Steve Foster avatar

Ooh Mike, that’s a nice project. Very well done. Will it come out with you to play at future CamJams, PPP or Coding evenings?

Michael Horne avatar

Miiiiight do :-)

Alex Ellis avatar

Looks great, really well executed. I’d like to try that synth app with the Pimoroni drum or piano HATs I have lying around.

Hans Lepoeter avatar

Thats fun. Sounds a bit like the 5 tone alien tune in “Close Encounters of the third Kind” ( 1977 ). Remember that ? Good Job !

Dan avatar

Does anyone know of a project that makes the Pi Zero into an MT32? I’m not talking about just emulating an MT32 for installed software, but actually accepting MIDI data over USB or GPIO, displaying output on an LED matrix, and of course playing sounds out of the hardware audio or HDMI outputs? It has to be possible, maybe by installing Munt on Raspbian or something… Let me know if anyone is aware of such a project.

Comments are closed