TiMidity++-2.13.0, with alsaseq support!

Audio editors, music players, video players, burning software, etc.
Message
Author
User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

TiMidity++-2.13.0, with alsaseq support!

#1 Post by Pizzasgood »

TiMidity++-2.13.0.pet
eawpatches.pet <-- optional higher quality sound patches (37 MB decompressed)

TiMidity++ is a softsynth. It takes in a MIDI file, then uses a sound font or sound patch to transform it into normal audio. You can use it to convert MIDI files directly into the WAV format, or you can use it to play the file through the speakers. Another things it can do (the most useful IMHO) is run as a daemon to give you an Alsa port for MIDI playback. This lets all those other audio programs that normally play MIDI files through a port to use Timidity instead. In my case, I use it to let me play MIDI files from Audacious (using the Amidi-plug plugin). I believe it should also work with Rosegarden (a sequencer). The aplaymidi program can also use it. Basically it mimics what would happen if you had and properly configured a soundcard which is MIDI capible. This uses more CPU power than letting the card do it though. Not a huge amount - modern PCs should handle it fine - but if you're also doing some heavy lifting in other programs it could probably get pretty choppy (renicing it to a higher priority should help).

Note: When I compiled this, I didn't enable any interactive interfaces except for ncurses. If playing files with Timidity directly, you can either use it with no interface:

Code: Select all

timidity /path/to/my/midi_file.mid
or you can use ncurses like this:

Code: Select all

timidity -in /path/to/my/midi_file.mid
The best deal though, is to set it up as a daemon to create that Alsa port, then get your normal audio player to send MIDI through that. I don't know if you can do it with Gxine, but I think you can with Mplayer. I know you can with XMMS and Audacious. I just uploaded a version of Audacious with a working 'Amidi-plug' plugin over here. For XMMS you're on your own, but I think there are both 'Amidi-plug' and 'Timidity' plugins, either of which should be fine. The Audacious package I linked to is already configured to use this.

So, how to set Timidity up this way? Easy. I added a script at /etc/init.d/timidity_server to do it automatically at every boot. If you want to disable it, just remove the executable bit on that script (chmod 644 /etc/init.d/timidity_server to remove, and chmod 755 /etc/init.d/timidity_server to make it executable again). There's one catch: when you first install this the daemon won't be started automatically until you reboot. To start it by hand just run this:

Code: Select all

/etc/init.d/timidity_server start

I mentioned that it uses a sound font or sound patch to make the audio from the MIDI file. Sound patches are a bunch of samples of audio from different instruments and what not that Timidity will transform appropriately to match the note which is supposed to be played. Sound fonts are essentially a group of patches combined into a single file, but not as simple as that. They also support more features than patches.

Sound fonts and patch collections can be quite large (up in the 70 megabytes or more). Because we are puppians, I tracked down and included a "very small" (~4 mb) collection put together by Shom. (Shom's TiMidity++ page)

For those who'd like better quality, I also made a package of the ~30 mb 'eawpatches' collection from Gentoo. When installed it will automatically set itself as the default To revert to 'minishom', go to /usr/share/timidity/ and symlink 'minishom/' to 'current/'.

Note: if you are using it as a daemon for Alsa, you'll have to restart it before a change in patches will take effect. The hard way is to reboot. The easy way is /etc/init.d/timidity_server restart


Configuring Timidity to use any old patch or font you download is an exercise left to the reader. I did simplify things a little by setting up Timidity to look in /usr/share/timidity/current/timidity.cfg for the data, where the 'current' directory is actually a symlink. This way you can have multiple sound fonts / patch collections each in their own director of /usr/share/timidity (or elswhere and symlinked in, to save space in the savefile in case you use large ones). Within each directory you'll want to set up a 'timidity.cfg' file to use whatever fonts or patches you put in it. Then to switch, just change where the 'current' directory points. And as above, if you're using it as a daemon you'll need to restart it before the change takes effect.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#2 Post by zigbert »

This is really great!!! Only half the size of the official version. Thank you Pizzagood!

If you want to use a sf2 soundfont, is all very simple. Add the soundfont to /usr/share/timidity/timidity.cfg. In my attached example of timidity.cfg, The fluidR3_GM is first loaded, then the additions for GS - fluidR3_GS. Then, to get the best piano, the steinberg soundfont will override piano sounds from fluidR3.

Code: Select all

dir /usr/share/timidity
dir ~/.timidity
soundfont /mnt/sda6/puppy/lyd/soundfonts/FluidR3_GM.sf2
soundfont /mnt/sda6/puppy/lyd/soundfonts/FluidR3_GS.sf2
soundfont /mnt/sda6/puppy/lyd/soundfonts/WST25FSteinberg_Piano-00Sep22.sf2
Remember that timidity also supports *.kar files. These are midi files with text info for karaoke.

Sigmund

bill
Posts: 490
Joined: Wed 28 May 2008, 15:32

The stark dissapointment in dealing with midi.

#3 Post by bill »

Thanks Pizzasgood and Zigbert for addressing these midi problems I have been saddled with for several weeks.Obviously I am not the only newbie who didn't know whether to scratch his watch or wind his arse :lol: when it came to getting sound from Rosegarden ,timidity ,Qtractor and several others.Seems I read where another newbie quoted said "I have completely given up trying to get a decent home studio operational in Linux" I suppose he went back to brandx.I can't say I have done as you suggested yet but at least now I have some directions to try.Thanks,bill

bill
Posts: 490
Joined: Wed 28 May 2008, 15:32

What is and what creates /timidity_server ?

#4 Post by bill »

Hi men,In a preliminary foray in trying to understand how to use your gracious information ,I typed this in on the console.

#chmod 755 /etc/init.d/timidity_server and I get this in return:

# chmod 755 /etc/init.d/timidity_server
chmod: cannot access `/etc/init.d/timidity_server': No such file or directory

My question is ,What creates "timidity_server" is this just a open named file or directory ? and how do I create it ?

thanks,bill

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#5 Post by Pizzasgood »

It should come with the package I uploaded, which is also the only way to get that particular script since I wrote it myself. Also, it should already be executable, so you won't need to chmod it unless you change it to non-executable. The only step you should have to do manually after installing is:

Code: Select all

/etc/init.d/timidity_server start
And that's optional - it will happen automatically after you reboot (assuming you haven't made the timidity_server script non-executable).


Pretty much all the script does is execute this command which I copied out of Gentoo:

Code: Select all

timidity -iA -B2,8 -Os -EFreverb=0 &
It has some extra logic in there to let you stop or restart it without having to manually kill it, but nothing else. The above command should work with any timidity package, so long as alsa sequencer support was compiled in.

This is the './configure' line I used when compiling:

Code: Select all

./configure --prefix=/usr --enable-server --enable-alsaseq --enable-ncurses --enable-audio=alsa,vorbis --enable-network
The '--enable-network' part lets us play midis hosted over a network. Like this:

Code: Select all

timidity http://www.lynnemusic.com/midi/bjorn__lynne-_the_spooky_pumpkin_head.mid
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

bill
Posts: 490
Joined: Wed 28 May 2008, 15:32

#6 Post by bill »

Thanks alot Pizzasgood.Your above post has clarified some questions I had and also opened some other questions I have "Like exactly ,how do you want a application to work (me) :lol: I can't recall brandX ever allowing me to do setups as I wish they would work,and this "new choices" is something very foreign to my thinking. :roll: I realize of course there are many things I am required to learn and understand but with the help of more experienced users ,the answers are out there.thanks again for your time and effort.cheers,bill

User avatar
ravensrest
Posts: 365
Joined: Fri 22 Feb 2008, 16:43
Location: Grants Pass, Oregon

re: TiMidity++-2.13.0, with alsaseq support

#7 Post by ravensrest »

Thanks a lot, pizzasgood. Your Timidity++ works fine, just wish I could find a plug-in for gxine. No luck there after massive searching.

One of the other things Timidity is great at is converting *.mid files to *.wav files. Simply use the command:


timidity input.mid -Ow -o output.wav


Of course substitute the correct full path and filenames for input.mid and output.wav.

If you want to do a whole directory full of midis, save this handy batch processor (I called it midi_batch) to that directory and run it from the command line:


#!/bin/sh
# For batch file conversion
# Find all files in a directory (-f for files, -d for directories to list)
# echo the file name
# use Timidity to convert from midi to flac (or wav)

for i in *
do
if [ -f $i ]
then
z=$i.wav
echo $i
echo $z
timidity $i -Ow -o $z
fi
done
exit 0


I did not write this: copied it from an anonymous posting on yoten.blogspot.com, but it works just fine!

BS

NickelZ
Posts: 5
Joined: Wed 18 Mar 2009, 20:00
Location: Christchurch, New Zealand

#8 Post by NickelZ »

Thank you for the "Timidity pet" Pizzasgood. It works well. I have used the file manager to browse to /usr/bin and dragged the timidity icon to the jwm desktop. Now I can drag and drop a midi file from my midi file directory and it instantly plays the file. I also changed the icon to one of my choice with a right click on the new desktop icon and changed the icon with a further drag and drop (as per the instruction balloon that popped up)

Regards,
Asus Eee PC user with puppy 4.20 "And loving it"

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#9 Post by Pizzasgood »

If you want to just click a .mid file to play it, you could right-click a .mid file, go to "file -> set run action", and set it to this:

Code: Select all

timidity "$@"
Make sure the radio button above is set to "Only for the type `MIDI audio' (audio/midi)" so you don't change the setting for all audio files!

BTW, the desktop itself is created by ROX-Filer, not JWM. JWM just does the taskbar and the window decorations (titlebar and borders, but not scrollbars and such, which are usually GTK but could be other things (QT, TK, etc.)). I think in 4.2 JWM also handles those popout trays on the sides and top. Not sure.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

NickelZ
Posts: 5
Joined: Wed 18 Mar 2009, 20:00
Location: Christchurch, New Zealand

right-click a .mid file, go to "file -> set run action...

#10 Post by NickelZ »

Thanks again pizzasgood. I have done that as well now to. :-)

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#11 Post by charlie6 »

Hi Pizzasgood,
Many thanks for timidity++-2.13.pet!
I installed it with PetGet, "all dependecies installed", restart the PC and got a menu entry under Multimedia.
Clicking on it got...nothing happening..?
Re-reading your post a saw:
Note: When I compiled this, I didn't enable any interactive interfaces except for ncurses. If playing files with Timidity directly, you can either use it with no interface:
is that to say that there is no GUI?

How could I do to get one ... I remember (may be I am wrong.... that on timidity-2.13.pet there was one..? I uninstalled it before installing timidity++-2.13.pet)

Furthermore, how could timidity start automatically - as defaultmidiplayer - when clicking on a midifilekey found on a musicscore website (i.e. 8notes) to play it without loading it?

Many thanks for answering
Cheers
Charlie

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#12 Post by vovchik »

Dear charlie,

This is my version of Timidity that has a gui. Unpack and copy it into /usr/bin (first rename Pizzasgood's version timidity-org). Open a terminal and type timidity -ig. It should come up (GTK gui). Mine looks for config info in /etc and in /usr/share/timidity (timidity.cfg). To get timidity into your menu system, unpack the timidity desktop file and copy it into /usr/share/applications. Then, in a terminal, run fixmenus. After restarting your x server, timidity should appear in your multimedia menu as Timidity++. Good luck.

Hope this works for you....

With kind regards,
vovchik
Attachments
TiMidity++.desktop.tar.gz
(362 Bytes) Downloaded 1623 times

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#13 Post by zigbert »

Is the gui depending on tk?

Code: Select all

# timidity -ig
timidity: error while loading shared libraries: libtk.so: cannot open shared object file: No such file or directory

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#14 Post by vovchik »

Dear Sigmund,

This version supports a number of interfaces:

Code: Select all

Available interfaces (-i, --interface option):
  -in          ncurses interface
  -iT          vt100 interface
  -is          slang interface
  -im          motif interface
  -ik          Tcl/Tk interface
  -ie          Emacs interface (invoked from `M-x timidity')
  -ii          skin interface
  -ig          gtk+ interface
  -id          dumb interface
  -ir          remote interface
  -iA          ALSA sequencer interface
Here is my ldd dump:

Code: Select all

        linux-gate.so.1 =>  (0xffffe000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0xb7e8d000)
        libm.so.6 => /lib/libm.so.6 (0xb7e66000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7e62000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7e4b000)
        libtk.so => /usr/lib/libtk.so (0xb7d40000)
        libtcl.so => /usr/lib/libtcl.so (0xb7c52000)
        libXm.so.2 => /usr/lib/libXm.so.2 (0xb7ab7000)
        libXt.so.6 => /usr/X11R7/lib/libXt.so.6 (0xb7a68000)
        libSM.so.6 => /usr/lib/libSM.so.6 (0xb7a60000)
        libICE.so.6 => /usr/lib/libICE.so.6 (0xb7a48000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0xb7a39000)
        libX11.so.6 => /usr/X11R7/lib/libX11.so.6 (0xb7951000)
        libartsc.so.0 => /usr/lib/libartsc.so.0 (0xb794b000)
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb7948000)
        libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb7944000)
        librt.so.1 => /lib/librt.so.1 (0xb793c000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb78a8000)
        libesd.so.0 => /usr/lib/libesd.so.0 (0xb789f000)
        libaudiofile.so.0 => /usr/lib/libaudiofile.so.0 (0xb787a000)
        libao.so.2 => /usr/lib/libao.so.2 (0xb7876000)
        libFLAC.so.7 => /usr/lib/libFLAC.so.7 (0xb7835000)
        libOggFLAC.so.3 => /usr/lib/libOggFLAC.so.3 (0xb7823000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xb77e1000)
        libslang.so.2 => /lib/libslang.so.2 (0xb7723000)
        libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb73e2000)
        libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb7360000)
        libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb7346000)
        libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb7330000)
        libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb7327000)
        libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb72ea000)
        libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb7274000)
        libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb723b000)
        libjack.so.0 => /usr/lib/libjack.so.0 (0xb7223000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb71fa000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x44e0e000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0xb71f4000)
        libspeex.so.1 => /usr/lib/libspeex.so.1 (0xb71e0000)
        libc.so.6 => /lib/libc.so.6 (0xb709e000)
        /lib/ld-linux.so.2 (0xb7f42000)
        libXss.so.1 => /usr/lib/libXss.so.1 (0xb709b000)
        libXft.so.2 => /usr/lib/libXft.so.2 (0xb7088000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb701b000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb6ff0000)
        libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb6fe8000)
        libXp.so.6 => /usr/X11R7/lib/libXp.so.6 (0xb6fe1000)
        libXau.so.6 => /usr/X11R7/lib/libXau.so.6 (0xb6fdd000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb6fdb000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb6fc4000)
        libXfixes.so.3 => /usr/X11R7/lib/libXfixes.so.3 (0xb6fbf000)
        libXinerama.so.1 => /usr/X11R7/lib/libXinerama.so.1 (0xb6fbc000)
        libXi.so.6 => /usr/X11R7/lib/libXi.so.6 (0xb6fb3000)
        libXrandr.so.2 => /usr/X11R7/lib/libXrandr.so.2 (0xb6fad000)
        libXcursor.so.1 => /usr/X11R7/lib/libXcursor.so.1 (0xb6fa4000)
        libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb6f79000)
        libz.so.1 => /lib/libz.so.1 (0xb6f68000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb6f2c000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb6f0c000)
        libXdmcp.so.6 => /usr/X11R7/lib/libXdmcp.so.6 (0xb6f07000)
With kind regards,
vovchik

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#15 Post by zigbert »

Thanks
Funny, - it won't start without libtk even though I'm not using the tk-gui

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#16 Post by vovchik »

Dear Sigmund,

I know this is a kludge, but you could try to symlink libtk.so and libtcl.so to any old lib that timidity does not use and see what happens, so long as you do not call the tk interface. If you call timidity with -ig, it might actually only load the gtk business and not really check whether the tcl and tk libs are the real ones. As you don't have the tk and tcl libs installed, you might want to give this little "cheat' experiment a try. I would be interested in the result.

With kind regards,
vovchik

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#17 Post by zigbert »

Bad news.
I made a symlink and got a new error.
Good try :)

Code: Select all

# timidity -ig
timidity: /usr/lib/libtk.so: no version information available (required by timidity)
timidity: relocation error: timidity: symbol SLtt_Use_Ansi_Colors, version SLANG2 not defined in file libslang.so.2 with link time reference

Sigmund

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#18 Post by vovchik »

Dear Sigmund,

Thanks for trying. Since slang is another one of those interface options, as is motif, I think creating more of those symlinks for slang and the other missing libs would do the trick, since the tk business only produced a missing version warning. I know the solution is very "dicey", but I think it will work.

With kind regards,
vovchik

PS. "ldd `which timidity` | grep found" will show which libs timidity is looking for. I think you know that, but others might not.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#19 Post by zigbert »

vovchik
I made fake symlinks for all my missing dependencies before posting my previous post. :?


Sigmund

User avatar
charlie6
Posts: 1230
Joined: Mon 30 Jun 2008, 04:03
Location: Saint-Gérard / Walloon part of Belgium

#20 Post by charlie6 »

Hi Sigmund,
zigbert wrote:vovchik
I made fake symlinks for all my missing dependencies before posting my previous post. :?
Sigmund


I got the same missing libtk.so libtcl.so error; have fixed them (acc. to vovchik explaination) picking
libtk.8.5.so.o and libtcl.8.5.so.o
in a previous install of timidity.2.10.pet (in /usr/lib/), copying them to the 2.13 version installation, symlinking them to libtk.so and libtcl.so.
I got another lib missing sounds like libarts... got it onstalled looking in deian packages contents and undeb it under / .

On another test I tried to install timidity2.13-sc.tar.gz downloaded from slackware, in puppy4.13, just install the missing lib (see above) - seems to got it installed but when launching
# timidity -iA -B2,8 -Os1l -s 44100 &
for interfacing wiyj NtEd.1.5.10
it seems looking for a timidity.cfg file and not being compatible with Alsa1.0.16, maybe am I wrong ? (I"m just a newbie..)
see here
http://murga-linux.com/puppy/viewtopic. ... 61&t=36124

Hope this helps

To vovchik
Hi vovchik,
many thanks for your kind reply - sorry! I did have time as yet to try the GUI you proposed, but I hope to get it...! I'll let you know.

Cheers
Charlie

Post Reply