Setting up RPi MIDI and Fluid Synth (SoftSynth)

The first part of this post are some instructions I wrote back in 2014 (more here)

NOTE: Setting the 31250 baud-rate this way only works for Raspbian kernel 3.18.11, the newer kernel Raspbian 4.xx has some issues.

Getting a MIDI 31250 Baud Rate on a Pi is not easy as it should be as 31250 is not a standard Pi baud-rate. But you can trick your Pi into it if you overclock (or rather underclock) the UART clock.

Start a terminal session and type:

sudo nano /boot/config.txt

Add these lines to the end of the file

# Change UART clock to 2441406 for MIDI 31250 baud rate

save and exit.

Once saved reboot your Pi.

Next we need to stop the serial UART being used by Raspbian for the shell console. Check my previous post “MiniPIiio RS232 set-up” on how to do this.

Finally we need to add the following to “cmdline.txt”



Once we’ve done this we can get on with installing the MIDI UART driver and the SoftSynth.

  1. Check audio ports & levels
  2. Install MIDI UART driver
  3. Install SoftSynth
  4. Get MIDI IN talking to SoftSynth

Open up a terminal window and first..


1. Check audio ports and levels

Use HDMI audio for sound

amixer cset numid=3 2

Check the volume if needed



2. Install MIDI UART Driver

sudo apt-get install libasound2-dev
tar -zxvf ttymidi.tar.gz
cd ttymidi/

We need to modify the make file for the Raspberry Pi, so lets

sudo nano Makefile

add -lpthread to line

gcc src/ttymidi.c -o ttymidi -lasound

so it looks like

gcc src/ttymidi.c -o ttymidi -lasound -lpthread

save file with “ctrl-x” and “Y”

Lets run the Make file and install binary


sudo make install


3. Install Fluidsynth

sudo apt-get install fluidsynth

err, that’s it just wait into it downloads and installs its self.


4. Get MIDI IN talking to SoftSynth

Start MIDI UART driver

ttymidi -s /dev/ttyAME0 -b 38400 &

Start the SoftSynth

fluidsynth --audio-driver=alsa /usr/share/sounds/sf2/FluidR3_GM.sf2

Check what devices they are listed as

aconnect -io

With device numbers connect MIDI IN to SoftSynth using “aconnect xx:x yy:y” for example:

aconnect 128:0 129:0

3 Responses to Setting up RPi MIDI and Fluid Synth (SoftSynth)

  1. […] a previous post on setting MIDI baud-rates on the RPi I used a slight of hand (i.e. init_uart_clock etc.) to trick the RPi in setting the UART […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: