A while ago I wrote about the plans of using the Raspberry Pi as a synthesizer for the Midi keyboard. You can read about the steps to get this working on Windows over here. But this post is about getting it to work with the Raspberry Pi step-by-step.
First connect your keyboard (with USB) to the RPi (Raspberry Pi).
$ sudo apt-get update $ sudo apt-get install fluidsynth
And run Fluidsynth with ALSA as audio driver
$ fluidsynth --audio-driver=alsa --gain=5 /usr/share/sounds/sf2/FluidR3_GM.sf2
Now load the sf2 sound font file in the Fluidsynth shell (>) and set the gain at maximum (needed with my headphones).
> load /usr/share/sounds/sf2/FluidR3_GM.sf2 > gain 5
Also make sure the system volume is not to low with the following command (use screen or another console to keep Fluidsynth running)
With the following command you can check if it is recognized as an Midi Keyboard and at which channel Fluidsynth is listening
$ aconnect -o
This should give an output like this:
client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 20: 'USB Keystation 61es' [type=kernel] 0 'USB Keystation 61es MIDI 1' client 128: 'FLUID Synth (2975)' [type=user] 0 'Synth input port (2975:0)'
In order to test if the key strokes are received from the keyboard use this command.
$ aseqdump -p xx
Where xx is the client number of the keyboard from the previous command which is 20 for me.
To connect the keyboard to Fluidsynth use
$ aconnect xx:0 yy:0
Where xx is again the Midi client id of the keyboard and yy is the client id of Fluidsynth.
Now enjoy your beautiful piano tunes without the need of a full blown computer!