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”.

Raspberry Pi Music Box

A Raspberry Pi 2 with a whole load of buttons and plenty of Adafruit boards from makersify.com playing synthesized sounds via a FluidSynth Python library. Code at: https://github.com/recantha/musicbox

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!