LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By Anonymous at 2006-02-17 09:15

I've always wanted to document any tricky steps to getting things done in Linux and MIDI is a very tricky one indeed. In fact, for most of us, the only way to play MIDI music is to install TiMidity++ and use it as an ALSA sequencer. I've struggled though, in the past, due to lack of documentation for this and so decided to share my knowledge in a place where others can easily get the bigger picture without getting confused with the details. Note that this is not an extensive article and will not go in-depth into each step, but only to serve as a general guide to MIDI on Linux.

I assume that you've properly installed and configured ALSA drivers and sound generally works in your system. Also I assume that you have a fair idea of how to install and uninstall packages for your particular distribution or know how to compile from source.

The three steps are then:

  1. Install TiMidity++. If you are a Debian user, this package is available in the official repositories. Other binary versions may be available. You can also compile from source. Instructions and download location available at the TiMidity website. Binary packages for select distros:
  2. Get some good sound patches. Debian users can use Freepats. But I recommend the eaw patches which are of higher quality. No Debian packages are available, but luckily you can just download it and extract it in any location. You can download the tar.gz here. Just extract it into your home directory. Let's say /home/hari/eawpats.
  3. Replace the default TiMidity++ timidity.cfg file (rename the old file to something like timidity.conf.old) with the one in the /home/hari/eawpats/linuxconfig folder. Just edit it to make sure the location points to the directory where you extracted the EAW patches. The config file is located usually in the /etc/timidity/ folder in Debian. I don't know about other distros. Here is how the file looks like. Just change the dir setting to whichever location you extracted the EAW patches to:

    dir /home/hari/eawpats/
    source gravis.cfg
    source gsdrums.cfg
    source gssfx.cfg
    source xgmap2.cfg
    #mid -> wav: timidity input.mid -Ow1S -s 44100 -o output.wav

All right, you've now installed it. To test it, you need to play a MIDI file. If you have one, just run

timidity filename.mid

from the command line and enjoy the music! If timidity fails with an error message, just check the timidity.cfg file to make sure the path to your patches directory is correct. The EAW patches are excellent and much better than the freepats package in Debian, so the extra trouble to download and install it is worth it.

Now you have got MIDI playback. What if you want to use TiMidity++ as your ALSA sequencer device? Well, for this you have to issue this command from the command line:

timidity -iA -B8,2 -Os

This basically means that you are running timidity as an ALSA sequencer device (-iA) and you've set the buffer fragmensts to 8,2 (-B8,2) and the output device as ALSA (-Os). There you go. Now you can play MIDI files from KDE also. Don't forget to check out the TiMidity++ man and documentation pages as well.

You must run the above command every time you boot Linux if you want to use TiMidity++ as an ALSA back end so that you can play MIDI files from KDE (KMid) without using the timidity command line every time. The added advantage is that you can use MIDI composing tools like NoteEdit or Rosegarden without any additional setup because ALSA automatically recognizes the MIDI devices. So I recommend that you add this command to your startup scripts.

Hope this is clear. If you have any feedback or questions about this article, please drop a comment on the forums.



  



All times are GMT -5. The time now is 01:14 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration