Ready for Jams

A project log for SquishBox

A Raspberry Pi stompbox sound module running Fluidsynth

Bill PetersonBill Peterson 04/02/2016 at 18:140 Comments

Time since the last update has been spent coding a smooth interface for the jamPi, coming up with a logical format to store patches, debugging to make sure there aren't too many crashes when I'm playing live, making sure there is always a way to get an ssh so I can make changes/debug if things go bad without taking the thing apart, and painting the box. I'm fairly confident this is at a state that people can actually use and make their own modifications from, so I'm posting the code in its current working form and will add some actual instructions soon. I have more mods planned to maximize this thing's potential (and fun), but they will all be software updates that can be pushed in via ssh.

Painting stompboxes in a way that is durable and pretty is apparently an arcane artform that I may never have the patience for - if you don't believe me check out the forums on (which were incredibly heplful despite my failures). I failed with my initial paint job - the clear-coat ate my cheap cranberry 2x spraypaint and crinkled it up like a wadded paper towel - so I had to sand the whole thing and try again. Second try I used some automotive primer and a hammered-finish spray. That might have been enough, but I sprayed some clear lacquer over the top for some additional protection. Not sure if it helped or hurt - you can see some dents in the finish already from where it rode in my gig bag and some squishing where I tightened down the stompswitches because I'm impatient - there's no way I'm going to wait three months for the paint to cure or bake this thing in a toaster oven as some suggest. I decided to go with the punk cred and lettered on it with a white correction pen why not.

The interface takes about 15 seconds to come up. I had it coming up in about 4 seconds by having systemd run it as a service, but fluidsynth wasn't able to start the audio driver. Hopefully I can figure this out later - in the meantime I may have a small script turn on the LCD at boot. The patches consist of global chorus/reverb settings and soundfont/bank/preset settings for any of the 16 MIDI channels. I plan to add a feature for reading midi routing rules out of the config_jampi.yaml file, but I'll have to add those bindings to pyfluidsynth first. A menu can be reached by holding either stomp switch for ~2 seconds - this allows you to update the patch (if you've changed a program or chorus settings, for example), save a copy of the current patch as a new one, reconnect a midi controller if you want to swap or didn't have one connected at boot, and control the wifi adapter. Holding down a stompswitch for ~5 seconds gets you a shutdown prompt. Stomping for 2 seconds confirms. I've yanked the plug on my Pi's many times without ever corrupting an SD card, but better safe than sorry.

The wifi control is a bit unreliable. I have the Pi always boot up and connect to my home network for now so I don't get locked out - if I couldn't get a wifi signal I'd have to open the box, disconnect the Pi and plug in a keyboard/monitor or console cable to fix things. I installed hostapd and dnsmasq so I can connect to the Pi as an access point if I'm out somewhere with it, and this seems to start fine, but I can't dynamically switch between using hostapd and connecting to my home network like I want. I think I need to turn off network autoconfig (ifplugd something something) and learn more about manually configuring wlan0, but that's for another day. There is also a 'wifi off' option - sometimes the adapter makes some minor noise that gets into the audio signal.

I want to add a midi learn feature, but that requires modifying fluidsynth itself to echo received midi messages, and adding bindings to pyfluidsynth. There already is a debug function in fluidsynth for this that goes in the right direction, but I also don't want to slow my script down by making it listen for midi messages all the time, so that will take some cleverness. There is also the project goal of being able to change the filter (resonance/cutoff) settings used by each soundfont on the fly, like a real synth - but this requires adding an entirely new feature to fluidsynth, and I'm not 100% sure it's something you can actually do.

So, in summary - I've got a working stompbox synth, but there's still plenty of fun hacking to be done with it!