From the Desktop: Good Vibrations

By: Brian Proffitt
Friday, July 7, 2000 08:47:39 AM EST
URL: http://www.linuxplanet.com/linuxplanet/tutorials/2038/1/

Nudging Your Linux System to Support Sound

Sound. A five-letter English word that describes the vibration of gas molecules caused by an energy release. That's all there is to it, really. And yet sound is one of the most compelling sensations we humans seek out. We crave sound, desire it at every moment of our waking lives.

The sounds of nature fulfill a primitive part of our being. The sound of music answers a deep longing in our very souls. Sound is like one big security blanket--take it away and we get pretty insecure, pretty quickly.

On a day-to-day level, sound constantly washes over us, from the deluge of the city noises that you can feel on your skin to the rippling of the brook in a forest that just tickles your ears.

And the sound we most desire to hear is ourselves. The sound of a human voice tells us that we are not alone, which a vast majority of us do not want to be. We want to hear someone speaking so much, we get our machines to talk to us as much as we can. Cars tell us the lights are on, home alarms inform us when they're armed, and our PCs talk to us a lot.

My personal theory about PCs is that when we work with a machine so much, we tend to anthropomorphize it to pretty high degree. A classic example is sailors and their ships; sailing vessels are mostly called "she," sometimes "he," but never "it."

Computers are starting to get treated that way, too. In our quest to get computers to act more like human beings, we want them to make a lot of noise so we can respond to them on a more visceral level. They may not be talking on a large scale yet, but it is only a matter of time, I think.

In the meantime, if you are a new Linux user, you may need some help getting sound to work on your computer. I know I did. I have "plain" old SoundBlaster cards in my Linux PCs and, to date, no distribution has picked them up right from the get go. They have always needed a little nudging--and sometimes a big shove.

Sndconfig: Sound Without a Kernel Recompile

The sndconfig application is used by some Linux distributions to configure sound cards. sndconfig is a command-line, text-based program, and needs to run independently of X. You cannot reliably run it from a terminal-emulation window, so don't try.

That said, it's a straightforward process to get your sound card configured. You also need to get the IRQ and port settings for the card. These can be found by checking /proc/interrupts and /proc/ioports or using the Device Manager if you are running a Windows partition on the same machine.

Information in hand, here's how to get your sound card up and running. Before using sndconfig you must make sure that the sound server component of X is on. In the GNOME and KDE desktop environments, there is the ubiquitous Control Center. Each version of the Control Center has a Sound section and within that section is an option to enable the sound server. As root, make sure this is checked and click OK to apply the change.

This may seem rudimentary, but lots of people forget to do this, since the documentation out there tends to focus on sndconfig.

Since you have to run sndconfig from the command line, press Ctrl+Alt+F1 to get a new tty screen. (To return to X from the command line, press Alt+F7.) Log in as root again and type sndconfig.

Depending on what distribution you are using, you are either going to get a quick-running app that spits out three or four lines of output before stopping (such as what happens in Corel Linux) or (in the case of Red Hat and its related applications) a big multi-screen application. I'll focus on the Red Hat version of sndconfig in this article, since it's the more complicated of the two.

After the introduction screen, the second screen should display the results of a probe of all of your computer's PCI devices. If any sound cards are displayed, the probe was successful. If none are displayed, you can press Enter and be taken to the manual configuration section of the program.

Pressing Enter when a card is detected will get you a message will appear advising that the conf.modules file will be overwritten. After you hit Enter again, sndconfig will inform you that it is will now test the sound card by playing a sound sample.

Once you press Enter again, a sample sound will be played. (If you successfully heard the sample, you will know the right way to pronounce "Linux," from the man himself, Linus Torvalds.) If you heard the sound sample, press Enter to accept the highlighted Yes button and end the application.

If you did not hear the sample, select the No and press Enter. A message appears stating that autoconfiguration has failed. Press Enter to clear the message and get to the manual configuration process.

The first screen of the manual configuration section is the Card Type window. Scroll though the list to select your card. When selected, press Tab to select OK and then press Enter to continue.

The next screen enables you to select the port and IRQ settings for the card, which you should have acquired beforehand. Select the proper IRQ and port settings, highlight OK, and press Enter to continue.

This will bring you back to the sound sample section of sndconfig. Try running the sample again. If this does not work, try the manual configuration section again. If this still does not work, here are some things to try.

The safest way around any compatibility issues is to pull out the checkbook and get a compatible card that was on the hardware compatibility list (HCL) for your distribution. But this is a rather painful option.

Be very sure of your card's name as it compares to your HCL. Just because the names are similar does not mean the card will work. If there are similarly named cards on the HCL list, you might try hunting through the newsgroups for your distribution to see if anyone has compiled a driver for your specific card.

Finally, the longest shot solution would be to check the manufacturer's Web site. Slowly but surely, more manufacturers are getting wise to this Linux thing and are posting Linux drivers. Not a lot, but they're there.

There's Always a Catch....

sndconfig is not, unfortunately, universal across all distributions. In some distributions, like GNU/Debian, you are going to have to provide the correct sound drivers and recompile the kernel yourself. This is a daunting task, but the Linux Sound-HOWTO gives an excellent review of how to accomplish this feat.

Once your sound card is configured, you can have sounds play at system events to annoy your neighbors or start playing those music files you acquired with gnome-napster. Or, in the near future, have a nice little chat about the virtues of carbon-based vs. silicon-based intelligence.

Copyright Jupitermedia Corp. All Rights Reserved.