16 May 2021

Pipewire is ready for me

PulseAudio is a good audio solution for a common Linux user. It’s the default for many distros and there is a good reason why - it works. Alsa works too, but PulseAudio is quite more flexible. JACK is probably too complicated. One other benefit of PulseAudio - it’s well supported, I mean some programs use PulseAudio interface directly & often exclusively.

With this said, why bother with PipeWire? Just for fun is my typical answer but not this time. This time we have a headset problem.

It starts with a fact that bidirectional audio over Bluetooth sucks. To participate in a conversation you have to have a minimal lag. It’s achieved through compromising audio quality. There is a different problem. Who in a right mind would buy an expensive wireless headset that sounds way worse than the cheapest wired ones. To fix this more than one codec is used. One for great quality and noticeable delay and another with awful quality and close to absent delay. Problem is, PulseAudio can work well only with the first type. There is no internal support for the second one and Bluetooth microphone at all. So we have to improvise something with ophono or some other big project which covers much more than just audio.

Let’s take a look at two popular PulseAudio configuration programs with plain PulseAudio.

Pavucontrol GUI:

pulse pavucontrol screenshot

PulseMixer TUI:

pulse pulsemixer screenshot

Here comes PipeWire! Not only it’s awesome on its own (it’s almost a must-have if you want to share your Wayland screen), it has a build-in support for Bluetooth headsets. A cherry on top is PipeWire being able to be a drop-in replacement for PulseAudio.

As I’m using ArchLinux here’s a link to ArchLinux Wiki PipeWire article. I’m going to provide some steps from my installation process to show the ease of the procedure but be aware, it’s not a guide.

First, we want to get PipeWire and a part responsible for PulseAudio computability.

sudo pacman -S pipewire pipewire-pulse

There are conflicts with the current PulseAudio installation. That’s fine, we are ready to remove them:

:: pipewire-pulse and pulseaudio are in conflict. Remove pulseaudio? [y/N] y
:: pipewire-pulse and pulseaudio-bluetooth are in conflict. Remove pulseaudio-bluetooth? [y/N] y

After the installation is done, we do still have pulse server running because it’s already loaded in the memory. Easy, we just have to kill it.

killall pulseaudio

*Sad headset noises (disconnected) *

Now we just have to bring PipeWire up. I’m running it a user, so a bit of systemd unit enabling in necessary:

systemctl --user enable --now pipewire.service pipewire-pulse.socket pipewire-pulse.service pipewire-media-session.service

* Happy headset noises (connected back again)*

It may be necessary to restart some applications to get familiar with new PulseAudio server imposter. I’d recommend to relogin or just restart your system to be sure.

Now let’s take a look at familiar PulseAudio configuration software.

Pavucontrol GUI with PipeWire:

piprwire pavucontrol screenshot

PulseMixer TUI with PipeWire:

pipewire pulsemixer screenshot

We have A2DP and HSP/HFP available now. The latter one in new. We can choose it and suddenly a new microphone is available and the audio with poor quality is blazing fast.

Awesome conversations to you! Good luck & have fun!