Review: Free and Open Source Software - Part 3

by Jo Shields on 19 August 2004, 00:00

Quick Link: HEXUS.net/qazy

Add to My Vault: x

Upgrading the sound

Right, we're getting somewhere towards a proper desktop system. Next, we're going to tackle sound drivers. The native Linux sound driver, OSS, supports a number of cards, but has one overriding "feature" - only one sound can ever be played at once. When a program wishes to play a sound, it locks out all others from touching the sound device /dev/dsp. Over the years, a number of "Sound Daemons" have appeared in an attempt to redress the balance - ESD, aRts and Jack are three of these. The daemon takes control of /dev/dsp, and applications ask the daemon to play sound, where the daemon will mix multiple sounds together. The problem is that the applications need to be written to specifically support the daemons - and few programs will support the one you decide to use. The Enlightened Sound Daemon is the oldest - it's also utterly awful, unless you don't care about audio and video matching up when watching media. In fact, they're all pretty awful. The optimal solution is to use ALSA.


ALSA is the replacement for the ageing OSS. It is compatible with OSS applications, it can play multiple sounds on any sound card without use of a dodgy sound server, it even smells faintly of cinnamon. It's definitely a good thing. If you followed the above instructions, then you'll have the 2.6 kernel, which has ALSA in it by default. However... it also has OSS in it, and OSS takes precedence. We need to eliminate the OSS driver, to allow the ALSA driver to do its job.


First, we need to determine which sound drivers are in use. Type "lsmod | grep soundcore" into a terminal. The results should be "snd", which is the ALSA driver, and one other name, which is the OSS driver. For example, i810_audio for most onboard sound. We want to prevent this driver from automatically being loaded, so as the rootuser, edit /etc/discover.conf, and add a line to "skip theossmodule", for example "skip i810_audio".


Finally, apt-get install alsa-base for some required ALSA tools, and run the "alsaconf" command. You can chain together multiple commands by using the "&&" operator as a spacer.


The alsaconf command will scan your system for sound cards, and offer to set them up. Note that at this point you still have the OSS driver loaded, so it will fail at the last hurdle. However, it will have correctly set things up for the next reboot, which is due... now.

Click for a larger image


When you're done rebooting, you should now have a shiny ALSA_based system. note that the default volume level is 0%, so right-click on the volume icon at the top-right of the Gnome screen and ask for the volume panel, then increase PCM to above 0 - or you'll hear nothing. Trying to listen to sound using mpg321 (or RhythmBox, which you really should have found by now in the Gnome menu) will work. However, there's still a whole lot of OSS settings lying around, which we need to take care of. First, we need to install a package called gstreamer-plugins. This will provide a number of extra abilities to the GStreamer media back-end used by (amongst others) Rhythmbox. When the package is installed, run gstreamer-properties and pick ALSA as the default sound sink. There are a couple of other back-ends that need to be convinced of the errors of their ways - install the libsdl1.2debian-alsa package for the SDL back-end, write the line "default_driver=alsa09" into the file .libao in your home folder, using nano, then one final piece of setup: setting up a /etc/asound.conf file to allow simultaneous sounds.


The following file has always worked for me:

Click for a larger image


Remember only root can edit files in /etc. If you now try to play two sounds at once, (for example, playing two MP3s using mpg321), then it will hopefully work!

Click for a larger image