Switching Pulseaudio TCP Client to Pipewire

Mathieu Réquillart
4 min readJun 12, 2023

--

Pipewire has gained significant popularity in the Linux media world for its remarkable audio and display management capabilities, particularly on Wayland. Fedora embraced Pipewire as the default sound management system starting since Fedora 34. However, during its early stages, when I needed TCP and zeroconf support for my Raspberry Pi, Pipewire lacked these features, making it unsuitable for my needs at the time.

Initially, I stuck with Pulseaudio, but as time went on, I encountered more issues with the TCP client, particularly when using streaming services like YouTube. When Fedora 36 introduced Pipewire 0.3.4x with TCP and zeroconf support, I gave it another try.

$ sudo dnf install --allowerasing  pipewire-pulse

Add a few lines in /etc/pipewire/pipewire-pulse.conf to allow your pipewire client to discover the PulseAudio and Airplay Server on the Pi

context.modules = [
# …
{ name = libpipewire-module-protocol-native }
{ name = libpipewire-module-zeroconf-discover
args = { }
}
{ name = libpipewire-module-protocol-pulse
args = { }
}]
context.exec = [
# …
{ path = “pactl” args = “load-module module-raop-discover” }
]

Then reboot your system to allow Pipewire to replace Pulseaudio as the sound manager.

You can also use systemd to achieve the same result.

$ systemctl --user disable --now pulseaudio.service pulseaudio.socket
$ systemctl --user enable --now pipewire-pulse.service pipewire-pulse.socket

And waow the difference is really amazing. Switching output is really flawless, the audio starts immediately without any glitches. Pipewire proved to be a significant improvement over Pulseaudio, even though I was relatively content with Pulseaudio’s performance. I had some bad surprises with some Pipewire updates but I’m really happy about it now.

As Pipewire keeps Pulseaudio compatibity, the gnome setting to change the audio output stays the same as before.

Gnome sound settings

This extension can also be noted as it helps changing directly ffrom the activity bar and functions exceptionally well compared to its previous state.

Gnome extension Audio-Selector

I’ve also successfully transitioned my HTPC server to Debian 11 and wanted to implement the same Pipewire setup. Obviously the procedure is a bit different, and well documented on Debian Wiki. As the wiki states this method isn’t offically supported, but works well enough nonetheless.
We need to add backports repositories if it isn’t done already

/etc/apt/sources.list.d/backports.list

deb http://deb.debian.org/debian bullseye-backports main

First we’ll install pipewire from the backports

$ sudo apt update
$ sudo apt install pipewire-pulse/bullseye-backports pipewire/bullseye-backports pipewire-bin/bullseye-backports libpipewire-0.3-modules/bullseye-backports wireplumber/bullseye-backports

Now we can configure and run Pipewire instead of Pulseaudio.

First copy systemd unit files from doc

$ sudo cp /usr/share/doc/pipewire/examples/systemd/user/pipewire-pulse.* /etc/systemd/user/

Then copy Pipewire configuration file from doc to /etc/pipewire/pipewire-pulse.conf file and make the same configuration changes as described earlier for Fedora.

$ sudo apt install libpipewire-module-raop-discover #Install Airplay Discover Module
$ sudo cp /usr/share/pipewire/pipewire-pulse.conf /etc/pipewire/pipewire-pulse.conf # copy the pipewire-pulse configuration file from doc

Reload the systemd daemon and disable Pulseaudio while enabling Pipewire:

$ systemctl --user daemon-reload
$ systemctl --user disable --now pulseaudio.service pulseaudio.socket
$ systemctl --user enable --now pipewire pipewire-pulse

You can reboot to make sure everything runs fine at boot

I have quite a lot of error when Pipewire starts, but everything seems to be running fine. I tried to follow pipewire wiki for the rt errors without success

$ systemctl --user status pipewire-pulse

sept. 23 21:30:08 htpc pipewire-pulse[885]: mod.rt: Can’t find xdg-portal: (null)
sept. 23 21:30:08 htpc pipewire-pulse[885]: mod.rt: found session bus but no portal
sept. 23 21:30:08 htpc pipewire-pulse[885]: mod.rt: RTKit error: org.freedesktop.DBus.Error.AccessDenied
sept. 23 21:30:08 htpc pipewire-pulse[885]: mod.rt: could not make thread 903 realtime using RTKit: Permission non accordée
sept. 23 21:30:08 htpc pipewire-pulse[902]: 536870912
sept. 23 21:30:11 htpc pipewire-pulse[885]: mod.pulse-tunnel: failed to connect: Accès refusé
sept. 23 21:30:11 htpc pipewire-pulse[885]: mod.zeroconf-discover: Can’t load module: Opération non permise
sept. 23 21:30:13 htpc pipewire-pulse[885]: mod.pulse-tunnel: underflow

Especially, the mod.zeroconf-discover: Can’t load module: Opération non permise is surprising because the module is working perfectly. Although the zeroconf-discover module is not listed with pactl list modules, my raspberry sink does appear in pipewire. If I remove the module in configuration, the error disappear but so does the sink 🙃

Those errors disappeared later when I upgraded to Debian 12 Bookworm. In this version the backports are not needed.

--

--

No responses yet