86

I might not be understanding the core concept, in which case correct me if I'm wrong.

Ubuntu comes with two different audio rendering servers, pulse and alsa. Is Alsa an intermediary layer to pulse? Essentially I need to know which one I'm using.

The reason I need to know is that I am attempting to switch from unity to i3-wm. While setting up i3 I found I had no audio and came upon this thread. It specifies various options for binding my laptop volume up and down keys to their functionality and after I tinkered with a few of the options I got very scratchy audio, which is why (I assume) I need to know which I'm actually using.

1 Answer 1

114

Ubuntu uses both ALSA, and PulseAudio for controlling sound input and output.

ALSA

ALSA serves as a kernel based system to connect your sound hardware to the operating system. All sound cards in your system will be controlled using drivers and card specific settings. Most of this is done under the hood with no need for users to interfere.

In addition ALSA offers libraries and tools to control our sound system. The tool most of us may have come across is alsamixer, a semi-graphical terminal application to control sound volume, and mute state of all cards and profiles in our system.

We can give out sound to our sound card simply by using ALSA without the need of PulseAudio or any other sound server.

PulseAudio

On top of the ALSA base, the PulseAudio sound server provides further tools to better control our sound system. This is done with modules to define volume levels, audio card profiles, output sinks, or input sources, and more for easy access from most Ubuntu applications.

Like ALSA, PulseAudio is also designed to run with as few user interactions as possible. Whenever we need to change volume, balance, or input/output devices, it is a PulseAudio module or application we or our application call.

A professional alternative to PulseAudio is the JACK audio server, with more options to interact with our sound hardware and a better low latency support. Only few music production applications expect to have JACK running, which can be done in parallel to PulseAudio.

Application/Desktop integration

The Ubuntu sound system can further be controlled from applications that run from the Unity/GNOME desktop, such as a volume control applet.

Whether any given application makes use of sound control will be up to the application's developers. Some applications will only use ALSA, some need PulseAudio, some need JACK.

Therefore, whenever we install another desktop manager on top of Ubuntu, we may lose the desktop-specific applications to control sound, but still, ALSA and PulseAudio will run in the background for sound control.

We may have to install additional packages, like e.g. pavucontrol, the pulseaudio GTK-based volume control application.

Is any of ALSA or PulseAudio running?

Both ALSA and PulseAudio come with command line applications to print out the state of our sound system.

  • PulseAudio:

    pactl list
    
  • ALSA:

    aplay -l
    

Both will give an error if the sound system is not running. ALSA will be loaded with the kernel, PulseAudio will be started later. If this was not the case, we can start PulseAudio manually from the terminal with:

pulseaudio [options]  ## option -D starts the daemon

In case we have audio issues, I recommend reading the post written by David Henningsson on things we should not do before we go further to debug our audio issue.

9
  • 2
    @Takkat amazing explanation, thanks a lot. I have been for quite a long time trying to get the basic understanding of the audio system in Linux and Ubuntu.
    – AlexN
    Apr 17, 2016 at 21:02
  • In my raspberry pi system, "pactl list" returns "Connection refused", but "pactl --server 127.0.0.1 list" works. exporting the environment variable "PULSE_SERVER=127.0.0.1" allows pulseaudio clients to correctly connect. Any ideas what i'm missing ? This is on a raspberry pi.
    – Joao Costa
    Jun 19, 2016 at 3:02
  • 1
    Awesome explanation! Unfortunately, the link to the "post written by David Henningsson on things we should not do" is broken. Jun 4, 2020 at 4:28
  • 1
    @matanster: PortAudio is a wonderful API for developing cross-platform audio applications. It is not installed on Ubuntu by default but it can be set up.
    – Takkat
    Jun 25, 2020 at 17:50
  • 2
    Now we could add PipeWire to the equation (pactl info | grep 'Server Name') Nov 9, 2022 at 22:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .