ALSA, the Advanced Linux Sound Architecture, is both a project and a body of software. The project was started because the OSS architecture is technically weak in some respects, and the free variant of OSS lacks some drivers available only in the commercial variant. For several years the ALSA software was developed separately from Linux. The drivers were added to the Linux codebase during the 2.5 development series and became the standard sound driver system in Linux 2.6.
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 provides efficient support for many applications, is fully modularized, is SMP and thread-safe.
Applications written for OSS can be made to work with ALSA by means of either userspace emulation (using the aoss program loader) or kernelspace emulation (the snd-*-oss drivers). However, you cannot use both ALSA and OSS drivers at the same time.
N.B. ALSA driver names always start with snd- .
alsa-base packages are designed to "just" work. The alsa-base package does not load modules; instead, udev detects the sound hardware and loads the right ALSA modules and then alsa-base takes care of setting usable mixer levels.
Configure alsa by running the command 'alsactl init' as root. Just ignore the error message like 'Unknown hardware' (this issue said to be fixed in alsa-utils .20), then reboot and try to test your sound. For more details please see this thread.
You can also try to detect and configure your sound card manually.
For a USB card, use lsusb.
You could now have a look at the ALSA's soundcard-matrix to find out which driver name can be used for the chipset you found.
ALSA and OSS
If your system is already configured to load OSS drivers for your sound card then look at your current module loader configuration files. There will be entries for the OSS modules which will give you clues about which chipsets your sound cards have. Don't forget to disable these entries before reconfiguring things to load ALSA modules.
If you don't unload all OSS modules then ALSA modules will not be able to initialise (or work properly) because the OSS driver will be futzing with the sound hardware that the ALSA driver needs to control. If you see a message about "sound card not detected" and you are sure you have the right ALSA driver, the presence of an OSS module could be the reason.
Test the driver, using aplay, mplay or xmms for example.
To test midi, you can use aplaymidi.
Sharing a card among multiple processes
It is often desirable to be able to share a sound card among several processes running at the same time. This requires the ability to mix the sound outputs of those processes into a single stream.
If your cheap sound card doesn't support hardware mixing try the dmix plugin. This has been set up automatically since libasound2 version 1.0.10-2; in prior versions, look at /usr/share/doc/libasound2/examples/asound.conf_dmix to see how to enable DMIX in /etc/asound.conf (for all users) or ~.asoundrc (for your user).
If your sound card has a Realtek chipset, and you cannot get sound to work, try the following method:
1. Download the Realtek HD Audio Codec Driver. Follow the link on http://www.realtek.com.tw homepage under "Quick Links", accept the notice, and then download the appropriate driver for Linux.
2. Open the downloaded file, extract it to a location (for example, your home directory), open a root terminal, and run the install script.
1. Make sure you already have the necessary build environment (gcc, make, build-essential, linux-headers for your kernel, etc.) set up before running the install script above.
2. If you encounter errors, try removing (purging) some alsa packages such as alsa-base and alsa-oss (if you already installed them), reboot, and run the install script again.
To see what indexes have been assigned to cards, run:
The first card that ALSA finds is usually given index 0 and thus is usually the 'default' sound card. If you are unlucky then the first sound card found is one that it not suitable for playing system sounds. (However an error such as "Unknown PCM default" when playing a sound occurs if the user is not a member of the 'audio' group - run "sudo adduser <username> audio", and then "newgrp" as the user)
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 ~/.asoundrc . More info on this Alsa FAQ
Does rebooting bypass BIOS and GRUB menu? This could be caused by kexec-tools. It allows the bypass of BIOS during rebooting and prevent proper initialization of various devices. As root, edit file /etc/default/kexec and update LOAD_KEXEC to:
This will allow your BIOS to properly initialize sound and other devices during every reboot.
- add yourself to the 'audio' group (log out and log in again)
use alsamixer and unmute channels and raise levels (also try *muting* some channels like s/pdif & toggle jack sense)
- arts or esound stopped?
- OSS modules unloaded?
- speakers on? and connected??
- modprobe snd-pcm-oss
- does "aplay /usr/share/sounds/alsa/Noise.wav" work for root? Test your sound with aplay and a wav so codec issues don't confuse the situation.
- Disable kexec-tools if working sound is disabled after rebooting/restarting the OS.
Look at /proc/asound/version.
Alsactl : AlsaControl
- Alsamixer : To adjust levels of sound, it uses a Ncurses interface.
- Aplay : To play a .wav file.
- Arecord : To record a .wav file.
- Aconnect : For connections on ALSA sequencer.
Please note with Debian Sarge my sound card is working right now but I still have NOTHING at /proc/asound though lsmod shows snd_intel8x0 and a whole bunch of other sound stuff.
See also: AlsaMidi.
New, just in:
http://www.student.nada.kth.se/~d98-jas/debian/debian-install-alsa.txt - This is an older (2003) article on how to create an ALSA package under Debian.