Switching to PipeWire

I just realized that, once again, I’ve spent half of a year without publishing. Oh no! To me, the frequency of blogging is an indicator of the work/life balance – if I have time to blog, that’s good and healthy. The past months have indeed been intense, and in addition to that, I’ve been burning my writing energy with the Mutter & Shell blog ¹.

Anyway.

A couple of months ago, I wanted to have another look at PipeWire, and how it was progressing. My primary contact with PipeWire comes from screensharing code, such as Mutter and obs-xdg-portal. At this point, nothing except a couple of isolated tests with PipeWire’s JACK replacement libraries were made. Nothing serious. Nonetheless, I’ve been cheering from the sideways that the day I could routinely use JACK through PipeWire would come.

JACK

Over the past 10 years or so, I have tried to eventually setup JACK, without success. In the past, JACK was just too hard to get right; I also tried the glue code between JACK and PulseAudio, but it was finicky, and I also failed to set it up properly.

In addition to that, JACK is also a challenge to sandbox technologies, such as Flatpak. Because the JACK server and client libraries need to have matching ABIs, it would require very big holes in the sandbox to work.

Thanks to PipeWire, replacing JACK was a breeze. PipeWire provides drop-in replacement libraries for JACK, and a small pw-jack utility to run JACK applications using PipeWire. It’s as simple as:

$ pw-jack <application>

If, like me, you don’t plan on installing real JACK, it is possible to easily tell ldconf to look for PipeWire’s JACK libraries first. Create a new file /etc/ld.so.conf.d/pipewire-jack.conf:

/usr/lib/pipewire-0.3/jack

Make sure to check which library path your distro uses! It seems Fedora uses /usr/lib64, so the path above would need to be adjusted accordingly.

Then update with:

$ sudo ldconfig

That’s it! Now you can run JACK applications on your system without any additional step; simply launch them, and it should work.

Carla (JACK) running using PipeWire

PulseAudio

Like JACK, PipeWire has replacement libraries for PulseAudio. However, since the 0.3.14 release, PipeWire comes with a PulseAudio server instead. This server exposes a PulseAudio socket, and pretends to be a complete PulseAudio server, only that internally it translates commands to PipeWire commands.

As of today, December 7th 2020, I’m happily running my entire desktop using PipeWire. After installing pipewire-pulse, and removing the pulseaudio daemon, I enabled it with:

$ systemctl --user enable pipewire.service pipewire-pulse.service

Hopefully package managers will automatically do this in the future. Keep in mind that even if PulseAudio’s and PipeWire’s daemons don’t break spectacularly when running together, it is recommended to only run one at a time.

Mixing All Together

Perhaps one of the most fantastic collateral effects of all applications using PipeWire is that JACK, PulseAudio, and PipeWire applications can interact with each other on some circumstances. For example:

Using Carla (JACK) to route Spotify (Flatpak; PulseAudio) audio to OBS Studio’s JACK plugin (Flatpak; JACK)

Despite being in such an early state – this isn’t even 3 months old code! – PipeWire is capable of being my everyday sound server, and my personal setup is not a trivial one. I routinely use an USB DAC with a condenser and a dynamic microphone, with a mix of Flatpak applications using PulseAudio (Chromium, Firefox, and rarely Zoom), Flatpak applications using JACK (Ardour, OBS Studio), and host applications using both, and it’s dealing with this almost perfectly. I find it really inspiring to see good projects like this growing and getting better!

Thanks to Wim Taymans and all PipeWire contributors for making this possible. I’m looking forward the future where PipeWire is the standard media server for the Linux desktop!


¹ – Fortunately, I’m not alone in writing them!


One response to “Switching to PipeWire”

  1. Dundarious Avatar
    Dundarious

    You can add /usr/$LIB/pipewire-0.3/jack to your linker config and it will pick lib or lib64 as appropriate. See man ld-linux.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.