Put simply, ALSA can be divided into two components: The kernel API that provides access to your sound card for higher-level sound servers and applications, and a userspace library that provides more general functions (like effects, mixing, routing, etc.)
There is no way to "replace" ALSA, with regards to the kernel API. Previously, there was also OSS (Open Sound System), but that's been deprecated for nearly 20 years. The same is not true of ALSA's userspace library, which can be replaced.
A sound server will sit between ALSA and your applications. These will traditionally be PulseAudio (for easy and automatic audio), JACK (for professional-grade low-latency audio), or PipeWire (for any use-case, but is still experimental). A sound server is not necessary as applications can output sound to ALSA directly, but some applications will make use of a sound server's API and require it to be available in order to produce sound. Most infamously, Firefox does not support ALSA directly and instead uses the PulseAudio API, forcing usage of PulseAudio (or a compatibility layer) as well.
PulseAudio will, by default, take control of all ALSA devices and redirect all audio streams to itself. PipeWire, if configured to do so, will use a small subset of the core ALSA functionality in the kernel API to access your soundcard, and handle all other features itself (replacing the ALSA userspace library entirely).
The rest of this article will assume that you are not using an intermediary sound server and that you're using ALSA exclusively. This is very uncommon these days, though it still may be of interest to some. If you're a typical end-user, you're probably more interested in the page for the sound server you're using (likely PulseAudio)
libasound2 - This package contains the ALSA userspace library and its standard plugins, as well as the required configuration files.
libasound2-plugins - This package contains additional plugins for the ALSA userspace library, including rate converters, and upmixing/downmixing plugins. You almost definitely want to install this in a pure-ALSA environment.
libasound2-doc - This package contains the HTML documentation for the ALSA library, which describes the development API for user-space applications that want to use ALSA.
alsa-utils - A handful of CLI tools for configuring and using ALSA in userspace. See the package description for specifics.
alsa-oss - ALSA wrapper for legacy OSS applications.
alsamixergui - A GUI frontend for the alsamixer application.
alsa-firmware-loaders - Requires the contrib component of Debian to be enabled. May assist in making some specific audio hardware functional.
ALSA should "just work", with udev identifying your hardware and loading the appropriate driver whenever you boot or whenever the audio device is connected, making sound immediately functionable and configurable through utilities such as alsamixer.
Users have sometimes needed to manually initialize ALSA before their sound would work. You would accomplish this by running:
# alsactl init
You can test sound output using any player and any audio file. Something traditional would be aplay which is helpfully available in the alsa-utils package, however it only supports uncompressed WAV files. You probably want to use something like mpv instead, which should handle anything, and can still run headless.
There is also a generic white noise file included with ALSA if you don't care about testing fidelity or accuracy using audio (such as music) that you're familiar with, and just want to ensure output works. You can play it with:
$ aplay /usr/share/sounds/alsa/Noise.wav
ALSA has a MIDI implementation in the case that you have any hardware MIDI ports. You can use aplaymidi to play input from one of those ports.
You can find ALSA configuration files in the /etc/alsa/conf.d/ directory. A lot of files are already included here by default. Advanced features such as mixing should already be configured with sane defaults. If you want to make changes, add a new file in here.
No sound output
If you can't get any output at all, make sure your user is in the "audio" group, then relog. You can add your user to the group by running:
# adduser yourusername audio
Replacing "yourusername" with your actual username.
Wrong card used by default
To see what indexes have been assigned to cards, run:
$ cat /proc/asound/cards
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 is not suitable for playing system sounds.
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.
In case both outputs are handled by the same module (e.g. HDMI output and on-board audio) use this instead:
options snd-hda-intel index=1,0
2. Change the default card by editing /etc/asound.conf or ~/.asoundrc . More info on this Alsa Multiple Cards
No sound after reboot
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.
- Is your user in the "audio" group? (See the first troubleshooting section)
Use alsamixer and unmute channels and raise levels (also try *muting* some channels like s/pdif & toggle jack sense)
- Arts or esound stopped?
- Speakers on? And connected?
- 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.
See also: AlsaMidi.