Admit it: You're a network or systems administrator, but you still listen to MP3s on your servers and desktop machines. But what if you want to listen to those MP3s on your brand-spankin'-new Linux box? Crank up xmms. Can you hear anything? No? Did you configure sound? No? Have you figured out how? No? Well, you're in luck!
In this Daily Feature, I am going to explain two of the more popular sound configuration tools—sndconfig (from Red Hat Linux) and soundDrak (from Mandrake). Each of these tools is actually quite simple to use once you understand how to run it.
The PnP issue
PnP (Plug and Play) is still not what it was intended to be. Each OS has its issues with the PnP, and Linux is not without shame. Although most PnP cards will be recognized within Linux, there are still those that have problems. For a complete listing of compatibility issues, take a look at the Linux Hardware Compatibility site.
Even with the PnP mess, both the Linux sound configuration tools we are about to dive into are robust and manage to pick up and configure a great deal of sound cards. So, without further adieu, let's take a look at configuring sound in Linux.
Red Hat's sndconfig
When I was a green Linux user, it took me weeks to figure out how to get sounds to pump from my puny speakers. Of course, this was way back in the days of Red Hat 4.2 and little plain English documentation. Fortunately, after much hunting and pecking, I discovered this little beauty tucked away in the /usr/sbin/ directory: sndconfig.
The sndconfig utility basically configures your sound card so it can be used with the proper Linux kernel modules. These modules will be located in the /lib/modules/2.x.x-x/kernel/drivers/sound directory (or in my case, /lib/modules/2.4.0-0.99.11/kernel/drivers/sound). If you take a peek around that directory, you'll find such drivers as:
These are the modules that the Linux kernel uses to drive the hardware.
Like most configuration tools, you need root privileges to run sndconfig. So, with a console window open, su to root and then run the command:
and you'll see a window like the one in Figure A.
|The initial sndconfig screen indicates that it will first probe for any PnP devices.|
Once you click OK, sndconfig will use the pnpdump utility to run the initial probe for PnP-enabled sound devices. What is pnpdump? From the man page:
“… pnpdump will scan all the ISA PnP cards, dumping their resource data to stdout. The resource data is supposed to be a description of the resources (IO ports, interrupts, DMA channels) that the card would like, or needs, to use to work. It is stored in a small ROM on the card, which can be read as part of the Plug and Play configuration process.”
Note that some manufacturers are rather lax about the contents of this ROM, particularly if the card is not required for booting, so the resource data may not be accurate. As they also typically provide a OS/Windows driver for the card, they really only need to be able to recognize it, as the driver can then complete the configuration.”
If you are running sndconfig from within the X Windows System, you will get a warning stating that DISPLAYis not set. This is fine. Click OK and let the pnpdump utility do its thing.
On my test machine, pnpdump discovered an ESS ES1869 Plug and Play AudioDrive card. This was the correct card, so from the next window (shown in Figure B), I clicked OK and moved on.
|The PnP probe results of the sndconfig tool will be displayed, and you'll know what type of card your Linux box will be using.|
Dealing with failure
You might have a sound card that pnpdump does not detect. If that's the case, you will have to select and configure your sound card manual. Don't fret; this is not difficult.
When you configure your sound card manually, you will be given a lengthy list of sound cards from which to choose. Figure C highlights a section of this list. Once you've found your card (or compatible type), select OK, and then you'll see the configuration screen (Figure D).
|If your card is not autodetected by pnpdump, you'll have to select it manually.|
|The configuration screen allows you to manually configure the necessary settings for your sound card.|
From this screen, you will have to select the I/O Port, IRQ, DMA, and MPU I/O settings. In my experience (about five years of dealing with the sndconfig tool), when manually configuring your card, the settings that typically need to be adjusted are the IRQ and the DMA. If you're not sure which settings your card actually uses, you can play around with these settings until you get it right. Of course, you can also go to the card manufacturer’s site and check their documentation.
Once you've run through the manual configuration of the card, you'll be presented with the sound tests again. If it works, you're done! Should this not work, keep toying with the IRQ and DMA settings.
Still not working?
I've also had situations where pnpdump declared that my card was not supported by Linux. If this is the case, and you know it's a popular (read: common) card, you might want to run sndconfig with the —noprobe option. By running:
you will be telling sndconfig that you don't want it to autodetect your card (which can bypass the your-card-is-not-supported-by-Linux-so-you'll-just-have-to-compute-in-silence attitude). If you run with the —noprobe option, you will be taken directly to the card selection window (see Figure C).
Run the —noprobe option and select the card that you know works with your installed sound card. If that still doesn't work, you may have to use the Advanced Linux Sound Architecture (ALSA) system. If you need to install ALSA, take a look at Jim McIntyre's Daily Drill Down “Configuring Linux sound services with ALSA.”
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.