Configuring the Sound Card


Configuring the Sound Card

Linux needs a driver to control the sound card. The initial Linux kernel (after you install Linux from the companion CD-ROMs) does not load the sound driver. The sound drivers are provided as loadable modules you can load after booting Linux. You will find the sound drivers in the /lib/modules/2.4.*/kernel/drivers/sound directory, where VERSION is the kernel version number. If you look at the names of the module files, you see that each filename ends with the extension .o.gz (the .o extension identifies an object file—a file containing binary instructions that implements the driver and .gz means that the files are compressed).

If you know your sound card type, one way to configure it is to manually load the driver and to set up information in the /etc/modules.conf file so that the correct driver is loaded.

The next few sections describe how to maually configure sound on Red Hat Linux.

Checking Information about a Sound Card

Typically, you can find out information about your PC’s sound card from what kudzu finds as it probes the hardware. Kudzu stores the information about all detected hardware in the following file:

/etc/sysconfig/hwconf

You can open that file in a text editor and look for a line that looks like this:

class: AUDIO

The information about the sound card is in the lines that follow, up to the next line that has a lone hyphen. For example, here is the information for an ISA bus Yamaha OPL3SA2 sound card:

class: AUDIO
bus: ISAPNP
detached: 0
driver: ad1848
desc: "OPL3-SA3 Snd System:Unknown"
deviceId: YMH0021
pdeviceId: YMH0030
native: 1
active: 0
cardnum: 0
logdev: 0
dma: 0,0

The desc line tells you the name of the sound card. As you can see from the driver line, kudzu specifies ad1848 as the driver for this sound card. Unfortunately, the correct driver is opl3sa2. To correct the problem, you have to do some work yourself.

Manually Configuring the Sound Card

When you know the sound card type and the driver that you must load, it’s a simple procedure to load the driver manually. All you have to do is log in as root and use the modprobe command with the following syntax:

modprobe drivername

where drivername is the name of the driver module to load. Thus, you can load the opl3sa2 driver by typing:

modprobe opl3sa2

That’s all you need to do. After loading the driver, you can verify that it’s loaded by typing the lsmod command. For example, here are a few lines of output from the lsmod command on a PC after loading the opl3sa2 driver:

Module                  Size  Used by    Not tainted
opl3sa2                10256   0  (unused)
mpu401                 24068   0  [opl3sa2]
ad1848                 28556   0  [opl3sa2]
sound                  74164   0  [opl3sa2 mpu401 ad1848]
soundcore               6404   6  [sound]
... rest of the lines deleted...

I want to point to the fact that loading the opl3sa2 driver with the modprobe command causes the loading of the other modules—mpu401, ad1848, sound, and soundcore—that opl3sa2 needs. As you can see, opl3sa2 needs ad1848, but ad1848 is not enough for the Yamaha OL3SA2 sound card.

After you load the driver manually with the modprobe command, the sound card should work. You can test it by playing an audio CD-ROM, as explained in the “Testing the Sound Card” section.