["Sound"]


["ALSA"], the Advanced Linux Sound Architecture, was originally started because the OSS architecture (see ["OSSFree"]) was outdated and the free variant of OSS lacked some drivers available only in the commercial variant. For several years ["ALSA"] was a project separate from Linux. The drivers were added to Linux during the 2.5 development series and became the standard sound driver system in Linux 2.6.

Alsa drivers always start with snd-

["ALSA"] is not just a set of ["sound"] drivers, it is also a library with an extensible API that gives applications access to the latest features of sound cards (e.g., multiple sound channels, Dolby ?"AC3", etc.)

ALSA is backward compatible with ["OSS"] (OSS Emulation ).

Alsaconf

The easiest way to configure ALSA is use ["alsaconf"].

Find out which sound chipset your soundcard is using

If the card is a PCI soundcard do an '["lspci"] -v' to list all available pci devices. The list will most probably include a reference to a multimedia audio device: that is your SoundCard. You could now have a look at the [http://www.alsa-project.org/alsa-doc/ ALSA soundcard matrix] to find out which driver name can be used for the chipset you found.

SoundCard configuration

If your card was automatically configured to work under Debian with the OSS Free sound drivers, then look at your current /etc/modules.conf file. There will be an entry for the OSS Free module that will also give you a clue of the chipset involved.

The latest ALSA packages should work out of the package. Today, hotplug or ["discover"] will take care of loading the required ALSA sound modules. Alternatively you can list the modules you need in the /etc/modules file. Alternatively, you can run the alsaconf utility. This attempts to detect your sound hardware and on the basis of its findings it writes an extra configuration file, /etc/modutils/sound or /etc/modprobe.d/sound, containing lines like these:

    alias snd-card-0 snd-cs46xx
    options snd-cs46xx index=0

With these module loader configuration entries in place, when the "snd" module loads it will load snd-cs46xx above itself.

Starting and stoping ALSA

/etc/rc.d/init.d/alsasound start

If everything is fine you should see the familiar OK startup aknowledgements from the script and the sound driver kernel modules should load.

 /etc/rc.d/init.d/alsasound stop 

stops the ALSA drivers.

Mixer Configuration

If the modules loaded successfully it is time to configure the AlsaMixer (provided your soundcard has one).

Test

Test the driver. Are you feeling lucky today? (TM). You can try to play a stereo wav soundfile. For now use aplay, which is a program that is part of the alsa-utils packages and should be able to play correctly in all supported soundcards. Use the following incantation:

 aplay -device="plughw" soundfile.wav 

["aplay"] is an example program and only understands .wav files so it will not be able to play any other format.

Troubleshooting

ALSA loads sound 'cards' in the order it finds them. The first card is always used as the 'default'. If you're unlucky, and a microphone gets selected first, then you're not going to be able to play sounds. You can check the order that ALSA has loaded card with:

  cat /proc/asound/cards

There are two ways to fix this problem.

1. Force the cards to load in a different order. I chose this route, and added the following to my /etc/modprobe.d/sound:

  options snd-trident index=0
  options snd-usb-audio index=1

This forces my Trident card to be the default (card 0) and my USB microphone to be card 1.

2. Change the default card by editing /etc/asound.conf or ~/.asound.conf

OSS

Other problem is the OSS simultaneous incompatibility . Don't forget to disable any lines in /etc/modules.conf that correspond to the oss sound driver kernel modules.

If you don't unload the Oss modules, them the alsa driver will not be able to start because the oss driver will be using the hardware resources associated with your soundcard.

Boot

Make sure that the sound driver is started and stopped when the machine boots and shuts down. For that use the ["chkconfig"] utility to add the alsasound script to the proper RunLevel:

/sbin/chkconfig --add alsasound

If you want, you can check that the script was added by doing:

/sbin/chkconfig --list alsasound

At this point you should be able to reboot your computer and have the alsa sound driver start automatically.

More information

For more information, read the README.Debian files in the alsa-base and alsa-source packages or check out http://www.alsa-project.org and http://alsa.opensrc.org.

New, just in:

Older