ALSA Drivers

The ALSA project ( has long provided an alternative to the kernel's standard OSS drivers. ALSA provides a low-level program audio interface that's different from that provided by the standard kernel and commercial OSS drivers, but ALSA also provides a compatibility layer so that it can work with software written with the OSS drivers in mind. ALSA also provides a different mix of supported devices than either the kernel or commercial OSS drivers, so it's possible ALSA is the only choice for your hardware.

Although ALSA is not part of the standard Linux kernel, as of the 2.4.x series, some distributions ship with ALSA support. Specifically, Debian, Mandrake, and SuSE deliver ALSA support. Therefore, if you use these distributions, using ALSA should be fairly straightforward—the ALSA drivers may be the default drivers, although in some cases the ALSA drivers are used only if kernel OSS drivers aren't available or are deficient in some way.

The 2.5.x development kernels have absorbed ALSA. With these kernels, you can select either the old open source OSS drivers or the ALSA drivers as part of the kernel configuration. Therefore, future versions of Linux should all include ALSA support out of the box.

If you're using a distribution that doesn't ship with ALSA and if you're using a 2.4.x or earlier kernel, you must install and configure the ALSA drivers to use them. This process can be a bit tedious, but in many cases it's worth doing. The procedure is as follows:

1. Recompile your kernel or install the kernel source package for your distribution. ALSA relies upon the presence of kernel source code, including all dependency information generated by compiling the kernel. If you recompile your kernel, be sure to select the sound core support, but do not build any drivers for your sound card into the kernel proper. If you recompile the kernel, reboot into your new kernel before proceeding.

2. Obtain the ALSA source code. You'll need three source code packages—alsa-driver, alsa-libs, and alsa-utils. Version 0.9.0 and later packages provide alsa-tools and alsa-oss, but these packages deliver supplemental tools that aren't needed for basic operation.

3. Extract all three source code packages into an appropriate location, such as /usr/src. For instance, from /usr/src, you might type tar xvjf ~/alsa-driver-vers/on.tar.bz2, where version is the ALSA version number, to extract the alsa-driver source code.

4. Run the configure script in the alsa-driver source directory to configure the package. The configure script supports various options. Table 1.3 summarizes some of these options. For instance, to compile the drivers with support for ISA plug-and-play (PnP) devices, you would type ./configure -with-isapnp=yes.

Tip Compiling all of the ALSA drivers takes a long time. If you're positive you know which driver you need, use the -with-cards option, as in -with-cards=via82xx. You can find a list of modules in thsonfigure script itself; search for the string -with-cards to find the list. This practice speeds up compilation and reduces clutter in your compiled kernel modules directory.

Table 1.3: Popular ALSA Driver Configuration Options

configure Parameter

Takes Options

Default Option



none, basic, memory, full, or detect


Sets debugging level


yes, no, or auto


Enables auto-detection of ISA PnP boards


yes or no


Enables support for Musical Instrument Digital Interface (MIDI) sequencer


yes or no


Enables OSS compatibility code


Driver names

All drivers

Compiles the specified set of drivers

5. Type make in the alsa-driver directory to build the driver source code.

6. Type make install as root in the alsa-driver directory to install the ALSA drivers.

7. Type depmod -a as root to create entries for the new ALSA drivers in the module dependency file. (This step isn't necessary for 0.9.0 and later versions.)

8. Type ./snddevices as root in the alsa-driver directory to create device file entries for the ALSA drivers.

9. Repeat Steps 4 through 6 in the alsa-lib and alsa-utils directories, in that order. The configure scripts in these directories support fewer options than the one in the alsa-driver directory; in particular, there's no need to specify a sound card in any of these cases.

10. Type modprobe sound-driver, where sound-driver is the name of your ALSA sound driver module, as root. This command should load the relevant ALSA sound driver and any dependent modules.

11. Type modprobe snd-pcm-oss and modprobe snd-mixer-oss as root to load the OSS compatibility modules, if desired.

12. Launch a sound mixer application and adjust the volume levels so that you can hear sounds. ALSA ships with all channels muted by default, so this step is critically important. It's also a step that many new ALSA users overlook.

13. Test the driver by playing a sound. The aplay command plays a simple sound, such as a .wav file, via the ALSA interface. You can use tools such as Ogg Vorbis players or CD players to test other features, including OSS compatibility. Once you're satisfied that everything is working, check the ALSA documentation ( for information on the appropriate /etc/modules.conf entries for your driver. Alternatively, write a custom startup script that calls modprobe to load the drivers.

Tip If your desktop environment doesn't automatically restore your mixer settings, try adding a post-install line to/etc/modules.conf to do the job with a command-line utility such as alsactl. Typealsactl store as root at a command prompt to store your current mixer settings, and then place a call to alsactl restore just after loading the ALSA drivers inmodules.conf, as described earlier, in "Loading Drivers Automatically."

Installing and configuring the ALSA drivers can be a tedious process, at least in pre-2.5.x kernels, but the results are often worthwhile. The standard kernel drivers provide limited or no support for some cards, and ALSA helps fill this gap.

0 0

Post a comment