Archives For November 30, 1999

Ubuntu 22.04 has better support for the low latency PipeWire multimedia framework. Here’s how to setup it for PulseAudio, ALSA, JACK and Bluetooth output.

Firstly, Pipewire is pre-installed out-of-the-box, and runs as background service automatically. You may check it out by running command below in terminal:

systemctl --user status pipewire pipewire-session-manager

PipeWire installed out-of-the-box

IMPORTANT: This is NOT officially supported by Ubuntu so far. It still may not work on some devices. Don’t do it on production machine!

Step 1: install client libraries

Though available out-of-the-box, it’s not in use by default for audio output. To get start, first press Ctrl+Alt+T on keyboard to open terminal, and run command to install client libraries:

sudo apt install pipewire-audio-client-libraries libspa-0.2-bluetooth libspa-0.2-jack

Step 2: install wireplumber to replace pipewire-media-session

The project maintainer now recommends more advanced “wireplumber” session manager when to use Pipewire as system sound server.

To install the package and remove “pipewire-media-session”, run the command below in terminal:

sudo apt install wireplumber pipewire-media-session-

NOTE: there’s a ‘-‘ in the end of the command indicates to remove the package. The command will also install the required pipewire-pulse automatically.

Step 3: Copy configuration files:

wireplumber makes things quite easy! If you just want to replace PulseAudio with Pipewire, enable the media session service and restart and that’s all!!

For ALSA clients to be configured to output via PipeWire, run command to copy the configure file:

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

For JACK client, run command:

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

And then sudo ldconfig.

For Bluetooth, just remove the pulseaudio-module-bluetooth package via command:

sudo apt remove pulseaudio-module-bluetooth

And, finally enable the media session by running command:

systemctl --user --now enable wireplumber.service

Step 4: Verify

After restarted Ubuntu 22.04, run the command below in terminal.

pactl info

It should output Sound server: PulseAudio (on PipeWire x.x.x) indicates Pipewire is in use as sound output.

How to Restore:

To undo the changes, firstly remove the client libraries via command:

sudo apt remove pipewire-audio-client-libraries libspa-0.2-bluetooth libspa-0.2-jack

Remove wireplumber and install back the previous media session package (there’s also ‘-‘ in the end):

sudo apt install pipewire-media-session wireplumber-

Finally, re-enable pipewire-media-session service by running commands:

rm -f ~/.config/systemd/user/pipewire-session-manager.service
systemctl --user --now enable pipewire-media-session

Thanks to @lestcape, if sound’s still not working, try to disable pipewire-pulse services via command:

systemctl --user --now disable pipewire-pulse.service pipewire-pulse.socket

If you tried to enabled it globally, also disable it via command:

sudo systemctl --global --now disable pipewire-pulse.service pipewire-pulse.socket

And re-enable the original pulseaudio service via command:

systemctl --user --now reenable pulseaudio.service pulseaudio.socket
sudo systemctl --global --now reenable pulseaudio.service pulseaudio.socket

UPDATE: for Ubuntu 22.04, see this new tutorial instead!

Want to try out the Pipewire sound server? It’s easy to do this in Ubuntu 21.10 / Ubuntu 21.04, and here’s how!

PipeWire is a server for handling multimedia on Linux. Its most common use is for Wayland and Flatpak apps to implement audio and video playback and capture with minimal latency. And it offers seamless support for PulseAudio, JACK, ALSA, and GStreamer based applications.

Use Pipewire to replace PulseAudio in Ubuntu 21.10 & Ubuntu 21.04:

Ubuntu now has better Pipewire support in recent releases. The service is even running out-of-the-box in Ubuntu 21.10.

1.) Update system

Firstly, press Ctrl+Alt+T on keyboard to open terminal and run command to install all available package updates (recommend for those still running Ubuntu 21.04).

sudo apt update && sudo apt upgrade

A system restart may be required if you haven’t done system package update for long period of time.

2.) Install the latest Pipewire libraries:

Thanks to the “PipeWire Upstream PPA“, it contains the latest Pipewire libraries to make all the things easy!

Open terminal and run the command below to add the PPA:

sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream

Type user password when it asks, while no visual feedback, and hit Enter to continue.

After adding PPA, run command to install pipewire:

sudo apt install pipewire

For GStreamer, JACK, Bluetooth support, install more libraries via command:

sudo apt install gstreamer1.0-pipewire libpipewire-0.3-{0,dev,modules} libspa-0.2-{bluetooth,dev,jack,modules} pipewire{,-{audio-client-libraries,pulse,media-session,bin,locales,tests}}

After installation, restart your system.

3.) Verify Pipewire:

In next boot, open terminal and run “pactl info” command will tell that Pipewire is in use even without any configuration.

[OBSOLETE] Replace PulseAudio with Pipewire in Ubuntu 21.04:

Ubuntu 21.04 has enabled support for pipewire officially. And here’s how I enabled it in my laptop:

1.) Firstly, open terminal either from system application launcher or by pressing Ctrl+Alt+T on keyboard.

When it opens, run command to install the pipewire-audio-client-libraries package:

sudo apt install pipewire-audio-client-libraries 

2.) Then create an empty file by running command:

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

3.) Create pipewire-pulse service files by copying the example files:

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

4.) You don’t have to remove the PulseAudio, just disable it and enable Pipewire:

  • Run command to reload the new service files:
    systemctl --user daemon-reload
  • Disable PulseAudio service via command:
    systemctl --user --now disable pulseaudio.service pulseaudio.socket
  • And finally enable the Pipewire services:
    systemctl --user --now enable pipewire pipewire-pulse

5.) I followed the previous steps via Debian Wiki, but it didn’t work. The system tray sound icon’s gone, and pactl info outputs “Connection failure: Connection refused”.

To workaround the issue, enable pipewire-media-session service may work by running command:

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

Finally reboot your machine.

And check if Pipewire is working, run pactl info command. And it’s working if you see “PulseAudio (on PipeWire 0.3.24)” in output.