last modified 2006/01/06
Updated for SimplyMEPIS 3.4-2(RC2) and Ubuntu Linux(Breezy).
[Author's Home]

How to install TiMidity++


tux TiMidity++ generates sound from MIDI files with specified sound sources(.pat files or soundfont files). Visit the official website for details.
http://timidity.sourceforge.net/

TiMidity++-GTK TiMidity++-XAW
GTK+ interface Xaw interface with tracer(scaled to 1/2)

How can I get it work?

tux TiMidity++ is available as package in many distros. If your disto does not provide the package, you can compile it from source. Please read the Appendix below.

mepisubuntu Users of SimplyMEPIS-3.4-2(RC2) or Ubuntu Linux 5.10(Breezy) have only to install the following packages with Synaptic Package Manager.

tux Alter /etc/timidity/timidity.cfg as follows:

MEPIS
...
## If you have a moderate CPU, try these:
opt EFresamp=l # This makes the load on the CPU lighter.
opt EFreverb=g,15 # Set default reverb level.
#opt EFchorus=s
#opt s32kHz
#opt p64a
Ubuntu
...
## If you have a slow CPU, uncomment these:
opt EFresamp=l # This makes the load on the CPU lighter.
#opt EFvlpf=d           #disable VLPF
opt EFreverb=g,15 # Set default reverb level.

When you have done, type in a shell window to start:

$ timidity -ig &

Now you can play MIDI files on local drives and ones on webs put with <embed> tags.
Please read iformation below for your needs.

How can I use soundfonts instead of freepats?

tux Put your favorite soundfont(xxxxx.sf2) in /usr/share/midi and alter /etc/timidity/timidity.cfg as follows:

...
# By default, try to use the instrument patches from freepats:

# source /etc/timidity/freepats.cfg

dir /usr/share/midi
soundfont XXXXX.sf2 order=0

How can I play MIDI files on webs put with <a> tags?

tux TiMidity++ can play MIDI files on webs by giving their URLs. For example:

$ timidity http://some_website/foo.mid &

I took notice of this feature and thought: “With a simple launcher, I will be able to play MIDI files just like I used to do with Win_ Media Player!!”. And here it is :) .
I developed it with Glade2 and named it “timsel2”(TiMidity++ Selecter II). It is compiled with GCC-3.3.2 and runs on GTK2.

timsel2-0.3.2

tux Click here to download timsel2-0.3.3.gz, and unzip it(Source archive is available here).

$ gunzip -v timsel2-0.3.3.gz
$ mv timsel2-0.3.3 timsel2
$ chmod +x timsel2

To start it, type:

$ ./timsel2 &

Usage is simple;
Copying an address of a MIDI file on your browser, click Paste URL, then click Play.

What “extra.cfg” button exists for?

tux If you want to play a MIDI file with a soundfont (or a set of .pat files) that is not specified in your default configuration(/etc/timidity/timidity.cfg), you can do it by adding “-c” option when you start TiMidity++.

$ timidity -c extra.cfg foo.mid &

For example, to use “alternative.sf2” you have to create an extra configuration file(.cfg) in /usr/share/midi with description “soundfont alternative.sf2 order=0”. Then add a line “dir /usr/share/midi” at the end of /etc/timidity/timidity.cfg, if it is not described.
cf. The line that begins with “dir” points the directory in which TiMidity++ looks for configuration files and sound sources.

tux When you click extra.cfg, timsel2 lists files that have the extention “.cfg” in /usr/local/share/timidity. Why??? Because I developed Timsel2 when I was using TiMidity++ that I compiled from source code :).

Thus, users of MEPIS/Ubunto have to make a symbolic link /usr/local/share/timidity in the following way.

$ cd /usr/local/share
#MEPIS
$ su
# ln -s /usr/share/midi timidity
# exit
#Ubuntu
$ sudo ln -s /usr/share/midi timidity

tux timsel2 sends the following command strings to the system.

button command string
Play timidity [ -c conf_file ] [ -ig | -ia | -iat ] URL &
Stop killall -KILL timidity
Start GUI timidity [ -c conf_file ] [ -ig | -ia | -iat ] &

Note: The length of URL string is limited to 192 bytes for security. Name your extra configuration files within 16 bytes including “.cfg”.


Appendix

How to compile TiMidity++ from source code

fedora The package of TiMidity++ from the Fedora project does not come with GUIs. If you need them, you have to compile TiMidity++ from source.

tux Make sure the packages Xaw3d and Xaw3d-devel have been installed. Then download the source archive TiMidity++-2.13.2.tar.bz2 and do the following.

Website of TiMidity++: http://timidity.sourceforge.net/index.html.en

$ tar xjvf TiMidity++-2.13.2.tar.bz2
$ cd TiMidity++-2.13.2
$ ./configure --enable-gtk=yes --enable-xaw=yes --enable-network=yes
$ make
$ su
# make install
# mkdir /usr/local/share/timidty
# touch /usr/local/share/timidity/timidity.cfg
# exit

tux TiMidity++ needs sound samples(.pat/.sf2 files) to play MIDI files. So you have to do the following:

tux First, download sound samples.
You can choose either a set of .pat files or a soundfont(.sf2) file.

archive URL
freepats-20040611.zip http://freepats.opensrc.org/
(soundfont files) http://www.hammersound.net/
sfarkxtc_lx86.tar.gz
(needed to unzip some soundfonts)
http://melodymachine.com/sfark.htm

How to compile and use sfarkxtc:

$ tar xzvf sfarkxtc_lx86.tar.gz
$ chmod +x sfarkxtc
$ sfarkxtc xxxxx.sfark

tux Unzip the archive and put them(it) in /usr/local/share/timidity.
Then edit timidity.cfg.

If you choose freepats, describe the following:

opt -EFresamp=l
opt -EFreverb=G,15
dir /usr/local/share/timidity/freepats
source freepats.cfg
source crude.cfg

If you choose a soundfont file, describe the following:

opt -EFresamp=l
opt -EFreverb=G,XX # Set reverb level with a number(0-127) 
dir /usr/local/share/timidity
soundfont xxxxx.sf2 order=0

tux Now TiMidity++ is ready. To start it, type:

$ timidity -ig &

Get JEUX Soundfont(Jeux14.SF2)

tux Download the following:

mepis unrar has already been installed, so you do not need to compile it from source.

ubuntu Install unrar with Synaptic Package Manager.

archive URL
unrarsrc-3.4.3.tar.gz http://www.pcsupport.dk/software/WinRAR.html
jeux14.rar http://members.aol.com/realmac/jeux1.htm
(http://www.hammersound.net/)

tux Next, compile unrar and unzip JEUX Soundfont with it.
Then put Jeux14.SF2 in /usr/local/share/timidity.

$ tar xzvf unrarsrc-3.4.3.tar.gz
$ cd unrar
$ mv makefile.unix Makefile
$ make
$ su
# cp unrar /usr/local/bin
# exit
$ cd ~
(MEPIS/Ubuntu users, start from here.)
$ unrar e jeux14.rar
# su
# cp Jeux14.SF2 /usr/local/share/timidity
# exit

Extra configuration files for organ music

tux Below are examples including ones to listen to fine MIDI sequences on other websites. I am sure that you will like them (more than mine :) .

For my sequences linked to MIDI-Jeux:

# jeux.cfg

opt -R 500
opt -EFresamp=l
opt -EFreverb=G,127
dir /usr/local/share/timidity
bank 42
soundfont Jeux14.SF2 order=0

tux For MIDI files(Melodieën Geneefs Psalter, Psalmbewerkingen, Gezang-bewerkingen) by Has Prince:http://www.hervormddinteloord.com/muziek.htm

# psalm.cfg

opt -R 500
opt -EFresamp=l
opt -EFreverb=G,127

dir /usr/local/share/timidity

bank 0

1  %font Jeux14.SF2 0 51
    # E Piano -> Gedackt 8'
8  %font Jeux14.SF2 0 51
    # Clavi -> Gedackt 8'
19 %font Jeux14.SF2 0 16
    # Church Organ -> Spitzflöte 8'
43 %font Jeux14.SF2 0 75 amp=50
    # Viola -> Schalmei 8'
56 %font Jeux14.SF2 0 25 amp=30
    # Trumpet -> Trompette 8'
57 %font Jeux14.SF2 0 25 amp=30
    # Trombone -> Trompette 8'
58 %font Jeux14.SF2 0 116 amp=30
    # Tuba -> Fagotto 8'
68 %font Jeux14.SF2 0 75 amp=50
    # Oboe -> Schalmei 8'
69 %font Jeux14.SF2 0 75 amp=50
    # English Horn -> Schalmei 8'
70 %font Jeux14.SF2 0 116 amp=50
    # Basoon -> Fagotto 8'
71 %font Jeux14.SF2 0 53
    # Clarinet -> Rohrflöte 8'
72 %font Jeux14.SF2 0 51
    # Piccolo -> Gedackt 8'
73 %font Jeux14.SF2 0 51
    # Flute -> Gedackt 8'
74 %font Jeux14.SF2 0 53
    # Recorder -> Rohrflöte 8'
75 %font Jeux14.SF2 0 51
    # Pan Flute -> Gedackt 8'
76 %font Jeux14.SF2 0 119
    # Blow Bottle -> Quintade III
79 %font Jeux14.SF2 0 58
    # Ocarina -> Gedackt 8' + 4'

tux For MIDI files(Choral preludes) by Elisabeth Weisenberger and also for ones("8 Little Preludes and Fugues") by Andrea Arena:
http://www.el-w.de/ORGEL.HTM | http://www.arenasv.it/aa_bach/bach_8.html

# wberger.cfg Rev 2.0_20050901

opt -R 500 
opt -EFresamp=l
opt -EFreverb=G,95
dir /usr/local/share/timidity

bank 0

0  %font Jeux14.SF2 0 61
    # Piano -> Gedackt 8' + Larigott 1 1/3'
1  %font Jeux14.SF2 0 119
    # E Piano -> Quintade III 16'
4  %font Jeux14.SF2 0 63 
    # Honky-Tonk -> Flauti 4' + 2'
8  %font Jeux14.SF2 0 53
    # Clavi -> Rohrflöte 8'
11 %font Jeux14.SF2 0 77
    # Vibraphone -> Regal 8'
16 %font Jeux14.SF2 0 6 amp=30
    # Drawbar Organ -> Mon 8' + Dbl 2'
19 %font Jeux14.SF2 0 36
    # Church Organ 1. -> Prin Chor 16'+8'+4'+2'
17 %font Jeux14.SF2 0 1
    # Percussive Organ -> Prestant 4' 
21 %font Jeux14.SF2 0 96
    # Accordion -> Vox Humana 8'
22 %font Jeux14.SF2 0 71
    # harmonica -> Krummhorn 8'
42 %font Jeux14.SF2 0 112
    # Cello -> Princial(ped.) 16' + 8'
32 %font Jeux14.SF2 0 25 amp=50
    # Acoustic Bass -> Trompette 8'
35 %font Jeux14.SF2 0 25 amp=40
    # Fretless Bass -> Trompette 8'
66 %font Jeux14.SF2 0 76
    # Tenor Sax -> Orlos 8'
68 %font Jeux14.SF2 0 74 amp=50
    # Oboe -> Cor Anglais 8'
69 %font Jeux14.SF2 0 75
    # English Horn -> Schalmei 8'
71 %font Jeux14.SF2 0 65
    # Clarinet -> Quintadena 8'
72 %font Jeux14.SF2 0 65
    #Piccolo -> Quintadena 8'
73 %font Jeux14.SF2 0 51
    # Flute -> Gedackt 8'
75 %font Jeux14.SF2 0 56
    # Pan Flute -> Blockflöte 4'
77 %font Jeux14.SF2 0 58
    # Shakuhachi -> Gedackt 8' + 4'
78 %font Jeux14.SF2 0 16 amp=150
    # Whistle -> Spitzflöte 8'
79 %font Jeux14.SF2 0 53
    # Ocarina -> Rohrflöte 8'

tux For MIDI files(Organ Works of Buxtehude) by Maclean:
In my feeling, this setting is successful particularly for BuxWV141, 145, 159, etc.
http://homepage2.nifty.com/fuga/e_index.html

# maclean.cfg

opt -R 500
opt -EFresamp=l
opt -EFreverb=G,31
dir /usr/local/share/timidity

bank 0

16 %font Jeux14.SF2 0 87
    # Organ 1. -> Ripieno I (pos.)
19 %font Jeux14.SF2 0 36 amp=100
    # Church Organ 1. -> Prin Chor 16'+8'+4'+2'
20 %font Jeux14.SF2 0 73 amp=100
    # Reed Organ -> Cornemuse 8'
22 %font Jeux14.SF2 0 74 amp=250
    # Harmonica -> Cor Anglais 8'
56 %font Jeux14.SF2 0 97 amp=250
    # Trumpet -> Voix Humaine IV
57 %font Jeux14.SF2 0 71 amp=100
    # Tronbone -> Krummhorn 8'
58 %font Jeux14.SF2 0 75
    # Tuba -> Schalmei 8'
67 %font Jeux14.SF2 0 80 amp=400
    # Baritone Sax -> Cromorne+Viola
68 %font Jeux14.SF2 0 76 amp=150
    # Oboe -> Orlos 8'
69 %font Jeux14.SF2 0 76 amp=100
    # English Horn -> Orlos 8'
70 %font Jeux14.SF2 0 32 amp=100
    # Basoon -> Septième VI
71 %font Jeux14.SF2 0 77 amp=250
    # Clarinet -> Regal 8'
72 %font Jeux14.SF2 0 51
    # Piccolo -> Gedackt 8'
73 %font Jeux14.SF2 0 51 amp=100
    # Flute -> Gedackt 8'
74 %font Jeux14.SF2 0 51 amp=100
    # Recorder -> Gedackt 8'
79 %font Jeux14.SF2 0 56 amp=100
    # Ocarina -> Blockflöte 4'

bank 8

19 %font Jeux14.SF2 0 5
    # Church Organ 2. -> Prin(g.o.) 8'+2'+1'

bank 16

19 %font Jeux14.SF2 0 4
    # Church Organ 3. -> Mon 8'+Pre 4'+Dbl 2'

bank 24

19 %font Jeux14.SF2 0 53 amp=100
    # Organ Flute -> Rohrflöte 8'

Play lists

tux If you have favorite MIDI files on the web and want to play them like listening to music CDs, it will be good to create play lists -- paste the URLs of them on a text editor and save it with the extention ".tpl". Below is an example.

# Choral Variations BWV768
http://www.geocities.jp/midi_organ_net/jeux/BWV768_0.mid
http://www.geocities.jp/midi_organ_net/jeux/BWV768_2.mid
http://www.geocities.jp/midi_organ_net/jeux/BWV768_3.mid

http://www.geocities.jp/midi_organ_net/jeux/BWV768_8.mid

Start TiMidity++ with GTK+ interface and press [Ctrl]+[L] to open the dialog for file selection. Point a play list and click "OK" and the list(URLs) is loaded in the lower field. Click the top line to start playing.

Shell scripts

tux It is rather tiresome to play short MIDI files one after another. So I have written shell scripts that enables to play them without browsers.

Melodieën Geneefs Psalter

#!/bin/sh
UR=http://www.hervormddinteloord.com/Psalmen/
CF=psalm.cfg
if [ $# -eq 0 -o $# -gt 2 ]; then
    exit 1
fi
if [ $# -eq 1 ]; then
    LAST=$1
else
    LAST=$2
fi
if [ $1 -gt $LAST -o $1 -lt 1 -o $LAST -gt 150 ]; then
    exit 1
fi
VC=$1
while [ $VC -le $LAST ]
do
  if [ $VC -lt 10 ]; then
    PN=00${VC}
  else
    if [ $VC -lt 100 ]; then
      PN=0${VC}
    else
      PN=${VC}
    fi
  fi
  if [ $VC -eq 1 ]; then
    MF=${UR}Psalm%20${PN}%20h.mid
  else
    MF=${UR}Psalm%20${PN}%20H.mid
  fi
  timidity -c $CF $MF
  VC=`expr $VC + 1`
done

Usage:

$ chmod +x psalm.sh  # Make the script executable.
$ ./psalm.sh 1 10    # play from Psalm 1. to 10.
$ ./psalm.sh 11      # play Psalm 11. only.

Orgel-Büchlein

#!/bin/sh
UR=http://www.geocities.jp/midi_organ_net/jeux/
CF=jeux.cfg
if [ $# -eq 0 -o $# -gt 2 ]; then
    exit 1
fi
if [ $# -eq 1 ]; then
    LAST=$1
else
    LAST=$2
fi
if [ $1 -gt $LAST -o $1 -lt 599 -o $LAST -gt 644 ]; then
    exit 1
fi
VC=$1
while [ $VC -le $LAST ]
do
    if [ $VC -eq 631 -o $VC -eq 633 ]; then
        echo "BWV${VC} does not exist."
    else
        MF=${UR}BWV${VC}J.mid
        timidity -c $CF $MF
    fi
    VC=`expr $VC + 1`
done

Usage:

$ chmod +x orgbl.sh  # Make the script executable.
$ ./orgbl.sh 599 603 # play from BWV599 to BWV603.
$ ./orgbl.sh 644     # play BWV644 only.

[Author's Home]