By Jochen Voss, last updated 2011-09-17
This page summarises things I learned while trying to understand and use the Advanced Linux Sound Architecture (ALSA) on my Debian GNU/Linux system. I would be happy to receive suggestions to improve or extend this web page.
This section gives some help with ALSA configuration issues. In order to avoid complications, we avoid use of external programs in figuring things out.
Programs using OSS can be used with ALSA by enabling the OSS compatibility layer of ALSA. You might need to load additional kernel modules to enable this. Check the file /dev/sndstat. If the file exists and can be read, you have the OSS compatibility layer enabled. It should list audio devices which correspond to the ALSA devices on your system.
Programs using esd can be used with ALSA by compiling esd with ALSA support.
0 [VirMIDI ]: VirMIDI - VirMIDI Virtual MIDI Card 1 1 [V8237 ]: VIA8237 - VIA 8237 VIA 8237 with ALC850 at 0x1000, irq 21 2 [Revolution51 ]: ICE1724 - M Audio Revolution-5.1 M Audio Revolution-5.1 at 0xb800, irq 16 3 [system ]: USB-Audio - iMic USB audio system Griffin Technology, Inc iMic USB audio ...
Card 0 is a virtual MIDI card. It does not correspond to any hardware and I do not yet know what it is good for. Entry 1 is for the built-in sound hardware on my ASUS A8V main-board (since it has an interrupt, irq 19, assigned this one must be hardware). Card 2 is a M-Audio Revolution 5.1 card. Card 3 is a simple USB sound card (an iMic USB adapter), good for connecting a microphone and an external speaker.
0: [ 0] : control 1: : sequencer 8: [ 0- 0]: raw midi 9: [ 0- 1]: raw midi 10: [ 0- 2]: raw midi 11: [ 0- 3]: raw midi 32: [ 1] : control 33: : timer 48: [ 1- 0]: digital audio playback 49: [ 1- 1]: digital audio playback 56: [ 1- 0]: digital audio capture 57: [ 1- 1]: digital audio capture 64: [ 2] : control 80: [ 2- 0]: digital audio playback 81: [ 2- 1]: digital audio playback 82: [ 2- 2]: digital audio playback 88: [ 2- 0]: digital audio capture 96: [ 3] : control 112: [ 3- 0]: digital audio playback 120: [ 3- 0]: digital audio capture
There are different groups of devices: control
(used by the
system to set the volume, mute channels, etc.), playback
,
capture
(reading audio data into the computer), raw midi
,
sequencer
and timer
(I don't know yet what the latter two
do).
defaults.ctl.card 1 defaults.pcm.card 1 defaults.timer.card 1
This file would make card 1 the default. The card number (1 in this example) is taken from the /proc/asound/cards file. For a description of the ALSA configuration file format see the ALSA library API documentation.
You can solve this problem by either stopping all other programs which access the sound device or by using one of the sound daemons and having all programs access the sound hardware through the daemon (the sound daemon can handle simultaneous connections from several programs).
In this section I give some hints on how a microphone can be connected to the computer to record sound using the ALSA interface.
microphoneconnector. If you want to connect a microphone via the
line inconnector, you will need an external amplifier.
Captureview) and that the volume is up for both the microphone line and the capture device.
program | version | remarks | |
---|---|---|---|
alsamixer | 1.0.10 | Text modus mixer. Works well. You can choose which sound card to use
with the -c option.
| |
aumix | 2.8 | Needs OSS emulation. Defaults to soundcard 0 (by using
/dev/mixer by default. You can select a different
mixer with the -d option.
| |
GNOME mixer applet | gnome-applets 2.12.2 | Supports ALSA but ignores default soundcard setting (it uses card 1 in the system described above when the default is card 2). There is no way to manually make it use the correct card. | |
GNOME settings daemon | gnome-control-center 2.12.2 | This daemon is running while I am logged into GNOME and for some reason it keeps the device /dev/snd/controlC0 (the mixer of the virtual midi device) open all the time, presumably to preserve volume settings between logins. Whatever it is trying to do, it will not work by using this device. | |
GNOME volume control | 2.12.0 | This allows selecting a sound device and remembers your settings. Ignores the ALSA default device setting. |
Table 1. This table summarises the ALSA support of different mixers on a Debian GNU/Linux system.
program | version | remarks | |
---|---|---|---|
esd | Esound 0.2.36 | The sound daemon currently used by the GNOME desktop environment. Can be compiled to work with ALSA. | |
gstreamer | 2.12.0 | Can be configured to use ALSA using gstreamer-properties. Works well. | |
jack | 0.100.0 | Uses ALSA by default. The daemon ignores the default device setting, but you can select a device manually. |
Table 2. This table summarises the ALSA support of different sound daemons and frameworks on a Debian GNU/Linux system.
program | version | remarks | |
---|---|---|---|
alsaplayer | 0.99.76 | Works well with ALSA (no surprise). | |
audacity | 1.2.4 | Uses OSS. When using the ALSA's OSS emulation, the program insists on using card 0. | |
ardour | 0.99 | Uses JACK to connect to the sound hardware. | |
xmms | 1.2.10 | Can be configured to use ALSA (at the Audio I/O Pluginspane of the preferences window), works well. |
Table 3. This table summarises the ALSA support of different applications on a Debian GNU/Linux system.
Copyright © 2011 Jochen Voss. All content on this website (including text, pictures, and any other original works), unless otherwise noted, is licensed under the CC BY-SA 4.0 license.