Timidity as ALSA sequencer client
Timidity ALSA sequencer patch
In the original sequencer proposal by Frank van de Pol, he included the following paragraph:
Imagine one would like to have a soft synth. Instead of going though the trouble of developing one in kernel, the developer can start off with running user-land timidity, and let the existing MIDI playing applications send their data to the 'timidity client' instead of the 'GUS MIDI output port' client. For the player it doesn't make any difference (only send events to another destination), and voila, we have a soft-synth. Over time, the developer can improve upon this soft-synth, make it more real-time, and possibly running it as kernel client.
So, just because it sounded such a neat thing to do...
This patch is very experimental and is only intended as a proof of concept. There are undoubtably many improvements that could be made. I will probably not enhance it further myself, but of course anyone is welcome to take this code and use it.
First you need version 2.1.0 of timidity.
Get the patch and apply it.\ NB: The patch completely replaces the existing server functionality of timidity which allows the receipt of OSS events over the network.
I used the following configure command, the important thing is the enable server switch. You can add others.
./configure --prefix=/usr --enable-gtk --enable-server
Make as usual.
Start it as a server:
timidity -ir -Os [client [port]]
If you specify client and port then a subscription will be made to it. For example you can subscribe to a port with a keyboard connected to play the keyboard directly.
It may be useful to experiment with other timidity flags.
If you get drop outs try to increase the value of the
You can play a midi file with pmidi.
-l flag to get a list of possible target ports and find the timidity
Port Client name Port name 64:0 0: MIDI Synth 0: MPU-401 (UART) 65:0 AWE Wave Table Synth : 0 Emu8000 port 0 65:1 AWE Wave Table Synth : 0 Emu8000 port 1 65:2 AWE Wave Table Synth : 0 Emu8000 port 2 65:3 AWE Wave Table Synth : 0 Emu8000 port 3 128:0 Client-128 Timidity receive port
Then call pmidi with the correct client and port:
pmidi -p 128:0 song.mid
0: MPU-401 (UART)has a keyboard connected so starting timidity like this:
timidity -ir -Os 64 0
allows the use of the keyboard to play timidity directly in this example.
Q: Wouldn't it just be better to use timidity directly?
How well does it work?
It works quite well with midi files that have a small number of tracks. It also works well direct from a keyboard. The main problem is that delays can cause midi events to pile up for a while and then be played all at once. So although the long term timing stays fine, there is short term `breathing' effect during complex passages.
It should have its own interface option rather than taking over the exisiting remote server option.
It doesn't respond as quickly as a hardware synth of course.