That Jungle of Sound Systems
All those different Linux sound systems always leave me with a sense of awe for all their complex interactions. I once tried to see the forest for the trees.
1 Overview
Manuel Amador Briz drew this diagram here which describes how PulseAudio fits in with it all and gives a rather helpful global overview of how sound systems work together in general.
And that's all the more helpful because PulseAudio is probably the first name you'll read these days if you Google up for information about sound in Linux. It's a sound server, which is an interface between applications/libraries and the kernel components which deal with sound like ALSA and formerly OSS. There are sound servers other than PulseAudio: JACK (which I've seen some programs such as Ardour like using), the now abandoned aRts (mainly run by KDE in the olden days) and ESD (chiefly run by Enlightenment).
Digging a bit further, it may be worth mentioning PortAudio which is a library for audio playback and recording. Audacity is a well-known audio editor which uses it. PortAudio can talk to ALSA and to many other sound systems in other platforms.
Now, it's probably useful pointing out that not everything needs a sound server: while many programs talk to PulseAudio (e.g. Firefox) many other ones are perfectly happy to directly deal with ALSA. And that certainly does add to the confusion.
2 The PulseAudio Daemon
Controlling the volume with PulseAudio only works if PulseAudio is running. While it does get started automatically with programs like Firefox, it might be convenient to have it run when starting the session so you can adjust the control with it even before starting programs which really require it: this way you can for instance change the volume of music players like cmus without having to start Firefox.
If you check what processes are running when PulseAudio is up, you'll see that it's really just this one:
/usr/bin/pulseaudio --start --log-target=syslog
It's probably a good idea to add this to your ~/.Xsession
or ~/.xinitrc
, then. It might take a few seconds to start so it could be useful to background it with &
. If the sound is of bad quality, try killing the PulseAudio daemon which will cause it to restart at once.
3 Volume Control
It's still possible to control the volume with tools like alsamixer or amixer, of course, but they are a bit cumbersome to use because there doesn't seem to be a way to adjust all the controls (e.g. Master together with PCM) with a single dial. However, pavucontrol, gnome-volume-control, gnome-volume-control-applet all do it. In fact, it's rather interesting to watch in alsamixer what happens when you change the volume with e.g. gnome-volume-control: PCM gets reset and only Master gets changed when staying in a reasonable range; PCM starts changing only to extremes.
The volume can also be adjusted with (rather more baroque) CLI tools. They are not very widely documented but you can in essence get the current volume with pacmd dump
and accordingly increase/decrease it with pactl
(because it's not possible to change the volume relatively directly with pactl
).