Skip to content

Instantly share code, notes, and snippets.

@the-spyke
Last active July 29, 2024 04:46
Show Gist options
  • Save the-spyke/2de98b22ff4f978ebf0650c90e82027e to your computer and use it in GitHub Desktop.
Save the-spyke/2de98b22ff4f978ebf0650c90e82027e to your computer and use it in GitHub Desktop.
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

Install

Install WirePlumber as the session manager:

$ sudo apt install pipewire-media-session- wireplumber

Notice '-' at the end of 'pipewire-media-session'. This is to remove it in the same command, because 'wireplumber' will be used instead.

Start WirePlumber for your user:

$ systemctl --user --now enable wireplumber.service

Configure

ALSA

Install the ALSA plug-in:

$ sudo apt install pipewire-audio-client-libraries

And copy the config file from PipeWire docs (provided by the plug-in) into the ALSA configuration directory:

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

Check if you have other (like Pulse) configs in the /etc/alsa/conf.d/ installed by something else. You might want to remove them.

PulseAudio

Everything was done automatically by pipewire-pulse package, which should have been installed by wireplumber package as recommended. If not, install it yourself.

Bluetooth

Install the codecs and remove Bluetooth from PulseAudio, so it would be handled directly by PipeWire:

$ sudo apt install libldacbt-{abr,enc}2 libspa-0.2-bluetooth pulseaudio-module-bluetooth-

The supported codecs are SBC and LDAC.

Unfortunately, aptX and AAC are not supported because of patents and other technical reasons. aptX is available starting from 22.10 via libfreeaptx0 installed by default there (22.10 uses PipeWire by default as well). If you really need these codecs in 22.04 you may use this PPA from @aglasgall which is based on universe, but rebuilds pipewire with additional packages for aptX and AAC from multiverse. Read the discussion here.

Done

Reboot and check if it works by running:

$ LANG=C pactl info | grep '^Server Name'
@senthilskm983
Copy link

senthilskm983 commented Jul 26, 2024

After I did everything in my system, audio devices showed "Dummy output", after long battle I found it was because of permission issue.

● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-07-26 15:42:57 CEST; 3min 9s ago
TriggeredBy: ● pipewire.socket
   Main PID: 10061 (pipewire)
      Tasks: 2 (limit: 37885)
     Memory: 7.4M
        CPU: 166ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─10061 /usr/bin/pipewire

Jul 26 15:42:57 PF36MC4L systemd[10052]: Started PipeWire Multimedia Service.
Jul 26 15:42:57 PF36MC4L pipewire[10061]: ALSA lib conf.c:4096:(config_file_open) cannot access file /etc/alsa/conf.d/99-pipewire-default.conf

so basically when I copied the configuration file using sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/ it ended up like '-rw-r----- 1 root root 226 Jul 26 14:50 99-pipewire-default.conf'

so change permission using below command
sudo chmod 644 /etc/alsa/conf.d/99-pipewire-default.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment