Back to article
Using ALSA to Control Linux Audio
ALSA User Tools
July 28, 2010
Last week I wrote how to configure PulseAudio on Ubuntu so you could easily stop and start it when you wanted to, instead of being stuck with it being on all the time, or having to remove it just to get it out of your way. Today I'm going to show how to use ALSA, which has been the default Linux audio subsystem for many years. ALSA has its limitations, but it's perfectly fine for controlling both playback and recording volume.
ALSA User ToolsMost likely your chosen Linux distribution comes with ALSA, because even with new sound servers and managers like Phonon, PulseAudio, and JACK, they still need ALSA. ALSA has two parts: the base which provides sound card drivers and firmware, and alsa-utils for user tools. alsa-utils may not be installed on your system; you'll need it to follow this howto.
The main application in alsa-utils we are interested in is alsamixer. alsamixer is an ncurses-based mixer for controlling your audio interfaces, both playback and recording. To open it just type alsamixer at any command prompt. It looks like Figure 1.
You might think it's not very pretty, and because it is ncurses-based it does not support a mouse, so all of its functions are keyboard-controlled. The advantage of ncurses is it doesn't need X windows, and it is very lightweight and won't bog down your system like the current crop of fashionable special video effects do. It's the same on all Linuxes, so you don't have to learn distro-specific weird stuff. It's perfect for running a headless audio server.
Figure 1 is for my 5.1 onboard surround chipset, so it has many control sliders. Use the right and left arrow keys to navigate through the sliders. At the bottom of each slider you see either 00 or MM. Toggle these with the
Sound card drivers are funny things, inconsistent in quality and features, so you'll probably need to do a bit of trial and error to learn what all the different sliders do. For example, I need to have all the playback sliders un-muted even to enable two-channel stereo playback.
The two key sliders for controlling playback volume are the Master and PCM sliders. Usually you need both to enable playback, but sometimes just the PCM slider will do the job. When the Master slider has no effect it means one of two things: your soundcard has no hardware volume controller, which is typical of the lowest-end chipsets, or the driver does not support the hardware volume controller. PCM stands for "Pulse Code Modulation"; just think of it as a virtual sound card.
Use the up and down arrow keys or the Page Up/Page Down keys to control the sliders. Page Up/Page Down move the sliders in increments of five, and the End key resets to zero. When there are two channels controlled by one slider, Q increases the left channel and Z decreases. E increases the right channel, and C decreases. Figure 2 shows how this looks in the Master slider, and the caption at the top displays the numeric values.