back to

2021-09-02 - play midi on linux

i've been doing more midi related things lately. here is how i play midi on linux.

audio group. ensure your user is a part of the audio group first. to add yourself to that group, run usermod:

install a soundfont. the only soundfont file format i'm aware of is the `.sf2` format. you can try random .sf2 files from online, but i like freepats the most.

freepats homepage

freepats arch package

install timidity++. timidity++ is used to emulate midi hardware.

arch timidity++ package

update timidity++ config. once timidity is installed, add your .sf2 file path to the timidity config file:

install alsa-utils. midi hardware support is actually built into the linux kernel, but we need a binary the alsa project maintains that interacts with the built in midi support:

arch alsa-utils package

emulate midi hardware. this command tells timidity to act as midi hardware for alsa:

play midi. use the alsa utility to connect to the emulated hardware and play the midi file.

if you have a midi output device, you can actually skip most of these steps and just run aplaymidi!

some links that helped me understand this process:

arch midi guide

arch timidity guide

ted's midi guide