Installing timidity++

The first step is to install timidity++ itself. It can be installed via pacman from the extra repository:

# pacman -S timidity++

However, timidity++ will not produce any sound yet. This is because timidity++ does not include any instrument samples. To produce sound, instrument patches and/or soundfonts need to be installed and timidity++ configured so it knows where to find them. This guide shows two ways of getting sound samples: Freepats and soundfonts.

Setting up the sound samples

Freepats

The Freepats project provides a set of instrument samples which are compatible with timidity++. It can be installed from the community repository:

# pacman -S timidity-freepats

To use Freepats with timidity, add the following lines to /etc/timidity++/timidity.cfg:

Soundfonts

There are many soundfonts available. This example will show how to install the fluidr3AUR soundfont, which is accessible via the AUR.

Note: It will be assumed that you know how to build packages from the AUR. If you have never used the AUR before, please take a look at the AUR User Guidelines.

As sfarkxtcAUR, a decompressor for soundfonts, is a make dependency of fluidr3, we install it first. Notice that it is accessible via the AUR.

After sfarkxtc has been installed, we will be able to build fluidr3 which may take some time.

If fluidr3 has been installed properly, we have to add its path to the timidity++ configuration file. Just add this line to /etc/timidity++/timidity.cfg:

soundfont soundfont /usr/share/soundfonts/FluidR3_GM.sf2

Then timidity++ is ready for use.

How to use timidity++

Convert files

timidity++ can also convert MIDI files into other formats. The following command converts a MIDI file into a WAV file:

$ timidity input.mid -Ow -o out.wav

Play files

There are two ways to use timidity++. Either as MIDI player or as daemon adding MIDI support to ALSA.

Standalone mode

You can simply use timidity++ to play MIDI files:

$ timidity example.midi

Add option -in or -ig for a text mode/gtk+ interface. E.g. as a Xfce/GNOME user you may want to set MIDI files to open with the custom command `timidity -ig'. There are many other options to timidity; see manpage or use -h to get help.

Daemon mode

Timidity can run as a daemon (ALSA sequencer client) providing MIDI output support for other programs such as rosegarden, aplaymidi, vkeybd, etc.

To do this (if you are not using PulseAudio):

# rc.d start timidity++

Add timidity++ to your daemon list in /etc/rc.conf to have permanent MIDI support:

DAEMONS=(... timidity++ ...)

If you are using PulseAudio, above methods may not work, you may want to add following command as an auto start program in your desktop environment. Or if you just want to start timidity in daemon mode once, you can use the following command which will make console output viewable:

$ timidity -iA

This will give you four output software MIDI ports (in addition of hardware MIDI ports on your system, if any):

Option --addr 128:0 connects the input (readable) software MIDI port provided by vkeybd to the first output (writable) ALSA port provided by Timidity. Alternatively you can use aconnect(1), community/aconnectgui or AUR packages patchage, kaconnectAUR. As a result when you play around with the keys on the vkeybd timidity plays the appropriate notes. See also USB Midi Keyboards.

Connect to virtual MIDI device

Once you have the timidity++ daemon running and it is working with aplaymidi, you can connect it to a virtual MIDI device that will work in programs such as rosegarden or scala.