Linux Galaxy

Replacing Pulseaudio with Pipewire

Posted on Feb 03, 2021 by bkoenig



On Linux, all of the layered subsystems required to play sound from your speakers are exposed to the user. For those interested in trying out Pipewire, the latest user-space daemon in audio device management, here's a short guide.

What is pipewire?

From the official pipewire website (https://pipewire.org): PipeWire is a project that aims to greatly improve handling of audio and video under Linux.

"It provides a low-latency, graph based processing engine on top of audio and video devices that can be used to support the use cases currently handled by both pulseaudio and JACK. PipeWire was designed with a powerful security model that makes interacting with audio and video devices from containerized applications easy, with supporting Flatpak applications being the primary goal. Alongside Wayland and Flatpak we expect PipeWire to provide a core building block for the future of Linux application development."

Pipewire is installed by default in Slackware for all versions after 14.2. To use it we need to disable pulseaudio and add pipewire-pulse to our autostart script.

Disabling Pulseaudio

first we need to disable pulseaudio. This is a bit more complicated than you would expect because we cannot simply remove the libraries. Applications still link to the shared libraries and will use it to communicate with pipewire. What we need to do is disable the daemon auto-start feature that causes the pulseaudio service to start everytime an application launches. We make this change in /etc/pulse/client.conf

 1## Configuration file for PulseAudio clients. See pulse-client.conf(5) for
 2## more information. Default values are commented out.  Use either ; or # for
 3## commenting.
 4
 5; default-sink =
 6; default-source =
 7; default-server =
 8; default-dbus-server =
 9
10autospawn = no
11allow-autospawn-for-root = yes

Make sure autospawn = no is in this file. Now the daemon will not be started by applications that play audio.

Setting up PipeWire

Pipewire config files are stored in /etc/pipewire/

Open /etc/pipewire/pipewire.conf and look for the exec = option. This controls how the pipewire daemon process is started and may look like this:

 1## <program-name> = { [args = "<arguments>"] }
 2    #
 3    # Execute the given program with arguments.
 4    #
 5    # Start the session manager. Run the session manager with -h for
 6    # options.
 7    #
 8    # The bluetooth module is disabled by default because it causes
 9    # conflicts with PulseAudio. If you disable PulseAudio or don't
10    # load its bluetooth module, you can enable it here with -e bluez5
11    #
12    "/usr/bin/pipewire-media-session" = { args = ""}
13    #
14    # You can optionally start the pulseaudio-server here as well
15    # but it better to start it as a systemd service.
16    # It can be interesting to start another daemon here that listens
17    # on another address with the -a option (eg. -a tcp:4713)
18    #
19    "/usr/bin/pipewire-pulse" = { "#args" = "-a tcp:4713" }
20}

Make sure the line for /usr/bin/pipewire-pulse is uncommented. This provides a pulse-compatible daemon that allows applications expecting pulseaudio to communicate with the pipewire daemon. Think of PipeWire as a drop in replacement for Pulseaudio!

Start the daemon

Pipewire doesn't need to run as root. Simply add the process to your autostart script as defined by your desktop of choice. In KDE you can add this in the system settings or for simpler window managers just add the command "pipewire" to your startup script so that it gets started every time you log in.

Make some noise!

All pulseaudio aware applications should see the pipewire-pulse daemon as a suitable replacement. Pavucontrol and apps like Firefox should be able to play sound without any further changes!

Keep in mind that Pipewire is still unfinished, so you may encounter minor problems such as popping audio. As things are improved over time Pipewire will likely become a more standard part of the Linux desktop.


Return to blog

Web 1.5

A dynamic blog without javascript.

slack-penguin-bw.gif