I'm a midi fan, but since I have a soundcard without the ability to load soundfonts in the memory, I looked constantly for a solution, which will make possible to listen midi. And I found
timidity.
| So, the ability to listen midi files means at the same time the ability to edit midi files, and that's exactly what I'm pressing for. I've tried to play midi with timidity, and the result exceeded all my expectations. But the first difficulty for me was - not all sounds was on the right place or was missing at all. So first what I needed was a good midi map and soundfonts. First I've searched SuSE root tree and found some things under /usr/share/sounds/sf2, but their quality was not sufficiently even for purposes of listening and they was incomplete. Than I've found some really good soundfonts there (ftp://ftp.lysator.liu.se/pub/awe32), they have much fewer "gaps" and can be already used, but I don't know if they are completely GPL friendly. Finally, when I found two solutions - the timidity rpm from Arklinux and freepats (SuSE recommended), that containing all complete midi maps and all the soundfonts needed, I've understood how great fits the timidity for midi playing. And now I'll tell you, how to make a software midi synthesizer with timidity.
First, install the timidity with yast, apt or whatever you use. The SuSE version of timidity comes with enabled daemon support. If you want a simple solution, download for example ftp://ftp.lysator.liu.se/pub/awe32/soundfonts/2MBGMGS.SF2 this, save it anywhere and edit your /etc/share/timidity/timidity.cfg. Comment all uncommented lines and add a single line at and:
INI:
soundfont /path/to/your/sf2/file.sf2
If you think it's enough for you with what concerns soundfonts, you don't need to do the following stuff with freepats and can through to the daemon making.
Two other solutions are similar to each other. I'll explain this on freepats example. First get http://freepats.opensrc.org/freepats-20060219.zip (this version is the latest for the moment this article is written in). Delete all the files in the /usr/share/timidity folder (or backup them, if you want) and extract contents of the freepats archive there. Create the /usr/share/timidity/timidity.cfg with the following content:
BASH:
dir /usr/share/timidity
source freepats.cfg
source crude.cfg
Check if file /etc/timidity.cfg exists and if no, create one with the single line in it
BASH:
source /usr/share/timidity/timidity.cfg
or symlink to the /usr/share/timidity/timidity.cfg
Now you already can play midi, try it and enjoy yourself
BASH:
user@host:~> timidity filename.midi
In case with Arklinux timidity rpm you could extract (do not install the rpm!) soundfonts and timidity.cfg and do with them the same as with freepats.
So, next we will do from timidity a midi soft synthesizer avaliable for other apps. You can see how it works with the command
BASH:
user@host:~> timidity -iA
TiMidity starting in ALSA server mode
Opening sequencer port: 128:0 128:1 128:2 128:3
After this you can see in each midi application this ports and are able to use them. Now we may want to autostart timidity in daemon mode on the system start. For this we will create /etc/sysconfig/timidity with the line that contains timidity start options.
BASH:
You might want to use oss instead of alsa for output:
BASH:
Read timidity help for more usefull startup options.
Now create /etc/init.d/timidity and make it executable. The content of it is:
BASH:
#!/bin/sh
#
# Startup/shutdown script for TiMidity++ software MIDI synthesizer.
#
if [ -f /etc/rc.status ] ; then
. /etc/rc.status
else
exit 0
fi
if [ -f /etc/sysconfig/timidity ] ; then
. /etc/sysconfig/timidity
else
exit 0
fi
TIMIDITY_BIN="/usr/bin/timidity"
case $1 in
start)
# start daemon
echo -n "Starting software MIDI synthesizer: "
/sbin/startproc -f $TIMIDITY_BIN $TIMIDITY_OPTS
rc_status -v
;;
stop)
# stop daemon
echo -n "Stopping software MIDI synthesizer: "
/sbin/killproc $TIMIDITY_BIN
rc_status -v
;;
status)
/sbin/checkproc $TIMIDITY_BIN
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
*)
echo "Usage: $TIMIDITY_BIN {start|stop|restart|status}"
exit 1
;;
esac
rc_exit
Add the script to autostart and start it:
BASH:
user@host:~> chkconfig --add timidity
user@host:~> /etc/init.d/timidity start
If you see no error messages, you can start to hear your favourite midis with Kmid or write you music with Rosegarden. If an error occurs, play around with timidity start options. For example for me was only alsa output worked, oss not at all. You may also try some other soundfonts for better sound. So good luck and much fun