Differences between revisions 28 and 29
Revision 28 as of 2021-09-13 08:03:16
Size: 12304
Editor: ?DylanAissi
Comment: Add link to wireplumber
Revision 29 as of 2021-10-02 13:55:06
Size: 12587
Editor: ?Scorpion2185
Comment:
Deletions are marked like this. Additions are marked like this.
Line 116: Line 116:


==== For root ====

If you are running as root remove or comment this line:
{{{
ConditionUser=!root
}}}

From "pipewire.socket" and "pipewire.service" in "/usr/lib/systemd/user".

And from "pipewire-pulse.service" and "pipewire-pulse.socket" in "etc/xdg/systemd/user".

Translation(s): none


PipeWire is a server and API for handling multimedia on Linux. Its most common use is for Wayland and Flatpak applications to implement screensharing, remote desktop, and other forms of audio and video routing between different pieces of software. Per the official FAQ, "you can think of it as a multimedia routing layer on top of the drivers that applications and libraries can use."

As opposed to PulseAudio's focus on consumer audio and JACK's focus on professional audio, PipeWire aims to work for all users at all levels. Among other techniques, PipeWire achieves this with its ability to dynamically switch between different buffer sizes, for adapting to the different latency requirements of different audio applications.

In Debian 10, PipeWire 0.2.5 is available, and should not need to manually be installed, as it's usually brought in as a dependency by applications that make use of it.

In Debian 11, PipeWire 0.3.19 is available, and can be experimentally used as a substitute for the ALSA userspace library, PulseAudio, and JACK. This is a documented but unsupported use-case.

Much newer versions are available in Debian Testing and Unstable. For users of these branches, PipeWire should be considerably more reliable, and may be a comfortable drop-in replacement for many use-cases.


Installation

In its most basic form, PipeWire can be installed simply by installing the pipewire package.

In Debian 10, some plugins are split into separate packages. These can be found in the libspa-bluetooth and libspa-ffmpeg packages.

In Debian 11, there is no longer a separate FFmpeg plugin package, and the Bluetooth package has been moved to libspa-0.2-bluetooth. There is also a JACK plugin in the libspa-0.2-jack package, required for using PipeWire as a JACK server (as explained below).

For Debian 11 and newer, PipeWire can be used to replace PulseAudio. Additionally, the pipewire-audio-client-libraries package is available. The libraries in this package allow applications directly accessing JACK and ALSA to output via the PipeWire server, allowing harmonious interoperability between the different sound servers and APIs.


Configuration

Using as a substitute for PulseAudio/JACK/ALSA

Debian 11

As per Simon McVittie, "This is not a supported scenario for Debian 11, and is considered experimental."

It may break certain applications, lack certain functionality, or not work at all.

Users may also be interested in PipeWire's capacity to be a drop-in substitute for existing Linux audio solutions, including PulseAudio and JACK. Potential benefits include lower CPU usage, better support for Bluetooth devices, and better integration between applications using JACK and PulseAudio. This is the default behavior in some other distros, notably Fedora 34 and newer.

This behavior can be experimentally enabled in Debian 11.

The three instructional sections below are independent of eachother, but you are still highly recommended to use PipeWire to replace all of them if you intend to replace any of it, for the best integration between different applications.


For PulseAudio

In this scenario, PipeWire runs as a per-user audio service, replacing PulseAudio completely.

Create this empty file:

# touch /etc/pipewire/media-session.d/with-pulseaudio

Create a pipewire-pulse service by copying the example files:

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

Run these three commands as your regular user (not as root):

// Check for new service files with:
systemctl --user daemon-reload
// Disable and stop the PulseAudio service with:
systemctl --user --now disable pulseaudio.service pulseaudio.socket
// Enable and start the new pipewire-pulse service with:
systemctl --user --now enable pipewire pipewire-pulse

You can check which server is in use by, as your regular user, running:

pactl info | grep '^Server Name'

If it's using PipeWire, the server name will be "PulseAudio (On PipeWire 0.3.19)"

Ensure this continues working after a reboot. If not, you may need to "mask" the PulseAudio service by running:

systemctl --user mask pulseaudio

This may require another reboot, after which PipeWire should be used exclusively, even following any more reboots. This will block the PulseAudio service from being activated outright. If you wish to restore previous functionality, you'll need to run the same command again with the "unmask" action.

For root

If you are running as root remove or comment this line:

ConditionUser=!root

From "pipewire.socket" and "pipewire.service" in "/usr/lib/systemd/user".

And from "pipewire-pulse.service" and "pipewire-pulse.socket" in "etc/xdg/systemd/user".


For ALSA

ALSA clients can be configured to output via PipeWire.

Some may describe this as "replacing ALSA", but as the PipeWire FAQ clarifies: "No, ALSA is an essential part of the Linux audio stack, it provides the interface to the kernel audio drivers. That said, the ALSA user space library has a lot of stuff in it that is probably not desirable anymore these days, like effects plugins, mixing, routing, slaving, etc. PipeWire uses a small subset of the core ALSA functionality to access the hardware. All of the other features should be handled by PipeWire."

Install the pipewire-audio-client-libraries package, if not already installed.

Create this empty file:

# touch /etc/pipewire/media-session.d/with-alsa

Copy a configuration file from the PipeWire examples into your ALSA configuration directory:

# cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/


For JACK

JACK clients can be configured to output via PipeWire instead of JACK.

Install the pipewire-audio-client-libraries and libspa-0.2-jack packages, if not already installed.

Create this empty file:

# touch /etc/pipewire/media-session.d/with-jack

Either run JACK clients using the pw-jack wrapper, or copy:

# cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/

And run:

# ldconfig

This will replace the JACK server libraries with PipeWire's replacements at application runtime, by pointing the dynamic linker at the /usr/lib/x86_64-linux-gnu/pipewire-0.3/jack/ folder.


Bluetooth

PipeWire will generally work fine in conjunction with Bluez to supply high-quality audio to Bluetooth-enabled audio devices when used as a replacement for PulseAudio, with some caveats.

At minimum, you will need to install the libspa-0.2-bluetooth package, remove the pulseaudio-module-bluetooth package, and then either reboot your computer or restart the PipeWire services, otherwise device connections will fail with "Protocol not available".

PipeWire will attempt to choose the best possible codec by default. You can override this, and tweak many other related settings, in the /etc/pipewire/media-session.d/bluez-monitor.conf file. You can edit this directly, or store local per-user changes by copying the file to ~/.config/pipewire/media-session.d/bluez-monitor.conf and editing that instead.

Additionally, since the release of PipeWire 0.3.19, there have been numerous Bluetooth-related feature additions and bug fixes. The version in Debian Bullseye is not representative of the current state of PipeWire.


Debian Testing/Unstable

The newer version of PipeWire that will be present in Debian 12, and that is currently present in Debian Testing/Unstable, has vastly improved compatibility and reliability, and is also much easier to configure as a replacement.

A notable change compared to Debian 11 is that the configuration directory has been moved from /etc/pipewire/media-session.d/ to /usr/share/pipewire/.


PulseAudio

Install the pipewire-pulse package, and reboot. This will configure PipeWire to activate its PulseAudio replacement daemon. Verify that it's enabled by running:

pactl info | grep '^Server Name'

If PipeWire is configured properly, this will print "Server Name: PulseAudio (on PipeWire 0.3.XX)" If it's not working properly, see the Debian 11 instructions for masking PulseAudio.


ALSA and JACK

The Debian 11 instructions still apply, at time of writing. Keep in mind that the PipeWire configuration directory has moved (as noted at the start of this section) and adjust the paths as necessary when making use of the instructions for Bullseye.


Bluetooth

See the Debian 11 information. Alternatively the wireplumber package can serve as a media session manager and does not require manual configuration of service files as does the pipewire default media session manager.


Routing sinks, sources, and audio devices

If you're interested in configuring the plumbing of your sinks and sources with PipeWire, as you usually would with PulseAudio, the easiest way to do this is with QjackCtl.

First, ensure that you've configured PipeWire to replace ALSA, JACK, and PulseAudio. Then, install the qjackctl package, and open the installed software.

It should already be active, detecting PipeWire as a running JACK server. Click the "Graph" button from its window. This will show a graphical representation of every audio device on your system that is acting as an input or output for audio. Additionally, it will display every active program that is producing or receiving audio, and the connections between all of these.

You can trivially drag to create new connections between applications, audio hardware, or combinations thereof. Some popular uses would be looping your microphone input into your audio output so you can monitor yourself, playing audio through multiple audio output devices at the same time, or using your music player as a fake microphone for other applications receiving voice input. The sky's the limit!

This is only possible with PipeWire, as QjackCtl would otherwise only show JACK clients, and ignore applications using PulseAudio or ALSA. However, PipeWire brings all of these together, allowing arbitrary configuration of programs that may all be using different APIs.


Known issues

pacmd fails with "No PulseAudio daemon running"

The pacmd command fails with:

$ pacmd 
No PulseAudio daemon running, or not running as session daemon.

The pactl command should be roughly equivalent in terms of functionality and does work with a pipewire backend.

skipping and "client missed 1 wakeups"

At least one user (TheAnarcat) experienced weird "audio drop" and "skipping" issues while running (borg) backups on a workstation under pipewire. The "client missed 1 wakeups" message showed up in logs and the situation degenerated up to the point where it was not possible to play audio at all. Restarting pipewire fixed the problem.

systemctl --user restart pipewire.service


See also

Read the official Debian package documentation for using PipeWire as a replacement for other audio servers by viewing the /usr/share/doc/pipewire-audio-client-libraries/README.Debian file.


CategoryHardware | CategorySound | CategorySoftware