Installing the Necessary Packages
SoundFont
Hardware SoundFont
Some soundcards come with onboard MIDI synthesizers( hardware synthesizer). To use them, you must first install the awesfx package:
apt-get install awesfx
If you have a collection of sound fonts somewhere, place them in /usr/share/sfbank. For instance, the ?SBLive has a sound font file called 8mbgmsfx.sf2, ct4gmsfx.sf2, ct4mgm.sf2 or ct8mgm.sf2.
After copying over the sound font, load it using asfxload:
asfxload /usr/share/sfbank/ct8mgm.sf2
You must have this command run every time you boot, so it is advisable to add it to /etc/rc.local (before the last line!) as well.
If you can't find soundfonts on your driver CD you can download some online from http://www.parabola.demon.co.uk/alsa/awe64.html.
Virtual Synthesizer (Software SoundFonts).
If your sound card does not come with a hardware synthesizer (or you don't want to use it), you can use timidity to provide you with a virtual synthesizer. Start by installing this package:
apt-get install timidity
For timidity to play sounds, it needs a soundfont. One such, freepats, is installed when you install timidity. You can have multiple soundfont configurations installed, and you can place your own in some suitable location, e.g. /usr/local/share/timidity/ (which you'll need to create); edit /etc/timidity/timidity.cfg as needed.
timidity can also use sound font files such as those provided on SBLive CDs.
You can test (and tune) timidity without starting it as a system service and by using aplaymidi (see the next section). This command starts it, with output via ALSA pcm:
timidity -Os -iA
(You can interrupt it and restart it with extra parameters such as -EFreverb=d if you find that the CPU load is too high.)
Don't forget to edit /etc/default/timidity to enable the server on the next boot or to set default parameters. (ALSA input is selected anyway, so there's no need to include -iA.)
Testing MIDI Support
You can use ?aplaymidi from the ?AlsaUtils to test your MIDI configuration.
To see what MIDI output ports are available on your system, use the -l option:
Viewing the MIDI output ports
aplaymidi -l
If all looks fine, try playing a MIDI file to make sure everything works. With the -p option you define what MIDI port you want to use.
Playing a MIDI file
aplaymidi -p 65:0 "Final Fantasy 7 - Aerith' Theme.mid"
You can use too ?XMMS with MIDI plug-in to play midi files.
Tools and Firmware
Some specific sound cards can benefit from certain tools provided by the alsa-tools and alsa-firmware-loader packages.
Comments and Questions
This article was heavily based on Gentoo Linux ALSA Guide, which is licensed under Creative Commons - Attribution / Share Alike. The author was even careless enough to leave terms and commands like 'emerging' and 'rc-update ...', which characterises a Gentoo-like documentation. I suggest a rewrite of this article or the inclusion of the original source/license. I would do it myself, but I do not have access to a Debian-based distro at the moment, therefore preventing me to verify how this task would have to be performed on it. -- ?MarceloMartins
---
CategorySound CategoryRedundant: merge with MIDI