Recording the piano from the piano

tobymurray/pianissimo on GitHub

Origin story

A while ago, at my first attempt at relearning the piano as an adult I wired my Roland FP-10 up to a Raspberry Pi. I started trying to figure out what the devil MIDI was, then decided I wanted to record practice sessions

Piano -> Raspberry Pi -> something I don’t mind listening too worked reasonably well, but there were usability quirks. I figured out how to trim the leading and trailing silence and that made it massively nicer to use. The next big hurdle was that I’m bad at the piano, so it takes ages to get a satisfactory play through, meaning I’m running back and forth starting and stopping recordings. I’d SSH to the pi, run arecordmidi, play, kill the recording, then repeat.

My first thought was to wire a couple buttons I had lying around into a panel I attached to the piano, then interact with the Raspberry Pi through that. Start and stop without leaving the piano would be a massive win. Then it occurred to me that a piano is like… dozens of buttons. Why go adding more?

The only real quirk was no feedback. With a button I could also turn on an LED or even get one of those cheep arcade buttons with the LED in them. Without the button, how would I interact? Around about then I learned a digital piano’s MIDI is bidirectional. I had set it up so the Pi was recording the notes I played, but it was basically the same amount of work to have the Pi make the piano play notes.

Thus this utility was born

What it does

  • Hold the lowest key (A0) for 3 seconds -> Pi makes the piano play an ascending 3 note acknowledgement chime -> Pi starts recording
  • Hold the lowest key (A0) for 3 seconds -> Pi makes the piano play a descending 3 note acknowledgement chime -> Pi stops recording

The second press of A0 is buffered and not written to the file unless if it matches the expected format. This tiny little bit of functionality got me ~95% of the way to where I wanted to be – easy starting/stopping of recordings from the piano. After a bit of use I found the one thing I wanted just for my own sanity was a “forget it, that last take was trash”. I very often psyche myself out when I know I’m recording, so the first (and maybe second and third) tries are immediate failures, which lead to…

  • Hold the highest key for 3 seconds -> Pi makes a low descending acknowledgement chime -> Pi deletes the most recent recording

Deployment

The whole thing runs as a systemd service that comes up at boot and reconnects on its own when the piano is powered off and on again (which I do constantly). This means that so long as the Raspberry Pi is powered and the SD card hasn’t been corrupted, I basically never need to interact with it.

So far this has been completely rock solid. Power outages, power cycling the piano multiple times a day, leaving it on, nothing seems to cause any issues.

Listening back

The one remaining quirk is turning the MIDI back into audio. My amateur plinking and plonking deserves nothing short of the full Salamander Grand Piano soundfont, but it’s huge and the Pi just can’t handle it. I rsync the MIDI files to my desktop when I care to and renders them to FLAC (for the true audiophile experience) and MP3 (for sharing).

Now all that’s left to do is learn how to play better.

Leave a comment