Friday, 31 August 2012

TTYMIDI on the Raspberry Pi

With Linux being Linux, there are several ways to do most things and MIDI over a serial port is no exception. On Intel X86 platform for example, ALSA comes with a snd-serial-u16550 driver, unfortunately at the time this is not supported on the Raspberry PI. There is however a simple alternative thanks to Thiago Teixeira who created ttymidi which creates a serial to ALSA interface.

I will not go into too much detail in this post as the basics are well covered at his site. The keyboard you can see is Virtual MIDI Piano Keyboard VMPK running on Windows 7 with a PuTTY remote shell.
sudo apt-get install libasound2-dev

tar -zxvf ttymidi.tar.gz
cd ttymidi/
sudo make install

ttymidi -s /dev/ttyAMA0 -b 38400  &

Will run ttymidi in the back ground.

ttymidi -s /dev/ttyAMA0 -b 38400  -v

Will run ttymidi in verbose mode (midi traffic displayed on screen).

aconnect -iol

Will display available ALSA connecters, see fluidsynth


Is used to connect inputs and outputs within ALSA.

aplaymidi -p 128:1 your_midid_file.mid will send a MIDI file to the MIDI out.


  1. Missing pthread library in Makefile

  2. agreed. You need to add -lpthread to make file.