1. Overview

PipeWire is a multimedia framework (Sound Server) that offers capturing and playback capabilities for audio and video streams. It’s relatively more performant and light on resources as compared to PulseAudio. In addition, it also implements pipelining for other audio systems like PulseAudio, JACK, ALSA, and more.

It also provides niceties like switching from HFP (Hands-Free Profile) to AD2P (Advanced Audio Distribution Profile) for most headsets. Not only that, it also supports video streaming, which we can for tasks like screen sharing under Wayland.

The recent versions of Ubuntu and other major distributions ship with PipeWire. However, there are still some distributions that are stuck with PulseAudio. Therefore, in this article, we’ll focus on replacing PulseAudio with PipeWire for those distributions.

2. Setting up PipeWire

We can check for the presence of PipeWire by checking the status of the pipewire service:

$ systemctl status --user pipewire
● pipewire.service - PipeWire Multimedia Service
Active: active (running) since Wed 2024-01-17 17:00:52 PKT; 1min 25s ago
...

In this case, PipeWire is already up and running. Therefore, we don’t need to install it. However, if there is no such service, then the system is probably running PulseAudio or another sound server:

$ systemctl status --user pipewire
Unit pipewire.service could not be found.

Notably, the system doesn’t have PipeWire installed. In the next sections, we’ll remove PulseAudio if it exists on the system and configure PipeWire instead.

2.1. Removing PulseAudio

It’s recommended to remove PulseAudio from the system to avoid any conflicts that may arise. However, we should terminate the pulseaudio daemon beforehand:

$ pulseaudio --kill

Then, we remove the pulseaudio package entirely:

# Debian and derivatives
$ sudo apt remove --purge pulseaudio

# Fedora and Red Hat
$ sudo dnf remove pulseaudio

# Arch Linux and derivatives
$ sudo pacman -Rns pulseaudio

2.2. PipeWire

PipeWire is available on most official package repositories:

# Debian and derivatives
$ sudo apt install -y pipewire pipewire-audio-client-libraries pulseaudio-utils

# Fedora and Red Hat
$ sudo dnf install -y pipewire pipewire-pulseaudio pipewire-utils pulseaudio-utils

# Arch Linux and derivatives
$ sudo pacman -S --noconfirm pipewire pipewire-pulse

We also installed pipewire-pulse, which is a compatibility layer between PipeWire and PulseAudio. Therefore, if we have applications that were originally developed to work with PulseAudio, then pipewire-pulse takes care of that. In contrast, we can also choose compatibility layers for other audio systems.

Furthermore, pulseaudio-utils include useful tools like pactl for managing PulseAudio.

2.3. WirePlumber

WirePlumber manages and routes videos and audio streams to appropriate channels. It’s also a policy manager which makes decisions about how the video and audio are handled.

For instance, when we record audio on a browser, WirePlumber detects the available audio recording devices attached to the system. Then, it decides where to route the audio stream. In the case of mic disconnection, WirePlumber channels the audio stream from another input device.

Like PipeWire, WirePlumber is available on most package repositories:

# Debian and derivatives
$ sudo apt install -y wireplumber

# Fedora and Red Hat
$ sudo dnf install -y wireplumber

# Arch Linux and derivatives
$ sudo pacman -S --noconfirm wireplumber

Once all the required packages are installed, we can now configure them.

2.4. Configuration

First, we’ll need to enable the required services:

$ systemctl enable --user pipewire
$ systemctl enable --user wireplumber

Once enabled, let’s start these services:

$ systemctl start --user pipewire
$ systemctl start --user wireplumber

Now, let’s ensure that PipeWire is running using pactl:

$ pactl info | grep Server
Server String: /run/user/1000/pulse/native
Server Protocol Version: 35
Server Name: PulseAudio (on PipeWire 0.3.65)
Server Version: 15.0.0

That’s it! We can now play sounds through PipeWire.

3. Conclusion

PipeWire is the new multimedia framework, which is the intended replacement for PulseAudio and other multimedia frameworks. Some distributions already ship with PipeWire installed by default.

In this tutorial, we learned how to replace PulseAudio with PipeWire. We removed the existing installation of PulseAudio and installed the appropriate packages to run PipeWire seamlessly.

Comments are closed on this article!