Latest Links

Jul 20th

Reviving a dead synth with a Raspberry Pi

I’ve never been much of a musician, but I had some fun with a Kawai K1-II for a number of years. And it seems that will go on even after it died.

It was kept around the house while we saved up for a a “real” piano, at which point it became somewhat redundant. It was starting to show its age, too, with odd pops and crackles in the synth audio, and it just wasn’t worth fixing at the time.

Fast forward ten years or so, and this weekend I brought it home again from my parents’ in hopes that it would be useful for the kids to practice their scales on. As it turns out, the synth has deteriorated further and can only make garbled noises.

I dug around the internet for clues and assumed the on-board battery was depleted, but after opening it up1 and having a look at the schematics I’m more partial to its (EP?)ROM being corrupted, given that an attempt at downloading the original factory patches had zero practical effect except for it generating moderately different garbled noises.

Fortunately the MIDI circuitry seems to be largely independent of the synth portion itself — after digging out an ancient MIDI to USB adapter that I had lying around for (literally) a decade and hooking it up to GarageBand, a few minutes of playing sufficed to confirm that the K1-II is still completely usable as a velocity-capable MIDI keyboard.

But I can’t realistically leave my kids alone with a Mac and expect them to behave, so I decided to set up a Raspberry Pi as an audio synth.

Since navigating the intricacies of Linux audio is a tremendous pain in the posterior, I resorted to another piece of ancient history to prototype the solution, and after fiddling about with some soundfonts and cursing whoever came up with the idiotic sfArk format, I eventually managed to get the Eee 901 running Qsynth well enough to sound like a moderately decent 80’s era piano.

But even that is a bit much for a kid to handle2, so it was time to downsize.

Your Own Digital Harpsichord

Assuming you’re running Moebius (my preference) or Raspbian, it’s about as easy as the following:

sudo apt-get update
sudo apt-get install fluidsynth
# get things rolling with stock soundfont, boosting gain
fluidsynth -i -s -a alsa -m alsa_seq /usr/share/sounds/sf2/FluidR3_GM.sf2 -g 1 &
# connect MIDI input to softsynth
aconnect 20:0 128:0
# fiddle with volume, interactively
alsamixer
# store alsamixer settings
sudo alsactl store 0

A few more minutes of fiddling, and I got it to work upon boot (which is fairly quick if you disable a bunch of services, including networking).

fluidsynth takes a configuration file as parameter to -f, so adding a line with prog 0 6 made it come up as a harpsichord (after all, we do have a piano already). Alas, non-stock soundfonts tend to be a little too much for the CPU to handle, so I had to stick with the stock one.

Of course, given the Raspberry Pi‘s hardware limitations, you are well advised to use something other than the original model B’s rather noisy analog output (I used a Sennheiser USB sound card) and consider over-clocking your board (I set mine to 900MHz, and it helped a fair bit with audio quality).

Next week I’ll wire up a LED and a couple of switches to the GPIO so that we can fiddle with the volume (there was a reason I picked a harpsichord for now…) and we’ll see how it goes.


  1. Cue rant about non-removable batteries and long-term maintenance of devices. Oh, wait

  2. I’m pretty sure they’d be able to get it going, but I’m completely sure they’d never stop fiddling with all the available sounds and effects. 


Recent Posts

After the Storm

The weather is back to its (un)usual antics, and so am I, to a degree — a sizable portion of the week was spent attending the Data Storm Big Data Summer School at my alma mater. Read More

A Matter of Identity

Over the years, a few people asked me what it’s like to be Portuguese — to which my invariable reply consisted of stating I was (still am, in fact) almost anything but, except statistically. Read More

Go-like concurrency (and profiling!) in Hy and PyPy

Waking up at 6:30 AM has bestowed upon me a blissful, irritant-free period that is perfect for contemplation, so of course I used it for a few experiments instead. Read More

Environmental Picks

I find it hilarious to watch programming language partisans astroturfing. Sometimes I even play along. Read More

Freak Weather

June showers seem to be a weather fad for the past few years here in Lisbon. Read More

The Quiet

Nothing much happened this week, except that a couple of interesting decisions were made. Read More

WWDC 2014

My take on this year’s WWDC in a nutshell: Incremental improvements galore, with a touch of disillusionment. Read More

Meditation In C#

In which I revisit C# for fun and end up going in deeper for… more fun? Read More