Advanced Linux Sound Architecture (ALSA)

Vicente González Ruiz - Depto Informática - UAL

October 12, 2023

Figure 1: The Linux Audio (problably partial) Stack.

ALSA is a software framework and part of the Linux kernel (see Fig. 1), as a set of modules, that provides an application programming interface (API), in C, for sound device drivers [1]. For example, to show the modules related with ALSA currently loaded, run:

lsmod | grep '^snd' | column -t

Let’s see some of the most basic tools shipped with ALSA.

1 amixer and alsamixer

amixer (through the command line) and alsamixer (using also the command line but being ncurses-based) can be used to control the gain of the audio inputs and outputs. For example, to run alsamixer, in your terminal write:

alsamixer

2 arecord

arecord runs on ALSA to capture PCM (Pulse Code Modulation) (by default, using the WAV audio format) audio data, and provides information about the hardware, and also, about the audio servers. Some examples of use are:

3 aplay

aplay is the companion PCM player of arecord. The playing capabilities used to be exactly the same than the provides by arecord.

4 speaker-test

speaker-test allows to generate (by default) pink noise or a pure tone through the audio outputs. Examples:

speaker-test                      # Analog (copper or Bluetooth, if available) mono 
speaker-test -c 2                 # Analog (copper of Bluethooh, if available) stereo 
speaker-test -Dplug:spdif -c2     # Digital (SPDIF) stereo, if available 
speaker-test -c 8                 # Surround (usually through HDMI) 7.1, if available

5 Resources

[1]   Dave Phillips. A User’s Guide to ALSA. Linux Journal, 2005(136):3, 2005.