Skip to content

Instantly share code, notes, and snippets.

@the-spyke
Last active May 3, 2024 13:19
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'
@the-spyke
Copy link
Author

@joihn All the steps, but backwards.

@joihn
Copy link

joihn commented Mar 9, 2024

I tried it last week and it broke my Ubuntu install, gnome could not boot anymore.
I had to revert back to a backup.
It might be due to the uninstall of pipewire?

@shackra
Copy link

shackra commented Apr 19, 2024

Would it be possible to connect input/output devices on a network? like barrier but for audio

there is a chance https://sonobus.net/ is the solution I'm looking for.

@K-Michallik
Copy link

I'm running Ubuntu 22.04 LTS currently with a set of Jabra 85's. Is it possible to use High Fidelity playback while using the headset microphone? Currently if I switch my input device to the headset, I lose the high quality audio (although the Sounds settings menu still displays it as active).

If not available in Ubuntu 22.04, is the functionality available in any version? I know it works fine in Windows 10/11

@the-spyke
Copy link
Author

@K-Michallik I haven't investigated this topic deeply myself yet. But as I understand the first option is to try mSBC. It should at least have better quality. And the full solution would be using a codec supporting duplex communications: FastStream, aptX Low Latency, LC3. But for this you need the headset to support it as well.

@eygraber
Copy link

I still don't have aac or aptx in the profile settings after updating to Ubuntu 24.04 from 22.04. I thought it would be natively supported because a liveusb I tried on my system did have it, but I guess not.

I followed these steps but that didn't help. Is ppa:aglasgall/pipewire-extra-bt-codecs the only way to get support for those codecs (even on 24.04)?

@aglasgall
Copy link

@eygraber , the PPA only works for distributions that I have built packages for; this is something I maintain in my spare time on a best effort basis. I had not built and uploaded packages for 24.04 because I did not have time.

I have uploaded pipewire packages for 24.04 with AAC enabled; they will be available for install sometime in the next hour.

The latest Ubuntu Pipewire packages do have AptX enabled already; if aptx doesn't show up as a codec option it is because your headset does not support it.

@eygraber
Copy link

@aglasgall thank you!

To clarify, I understood the PPA wouldn't work until you got to updating it. I hope that didn't come across as complaining that it wasn't available yet.

I think my headset supports AptX, so I have more digging to do. Might just do a fresh install after struggling with this for years.

@aglasgall
Copy link

Packages for 24.04 ("Noble Numbat") are up now.

@jojommeke
Copy link

can anyone please help me undoing this because it broke everything, i fixed it mostly, mic is now working and outpouting sound but i can't connect to my bluethooth speaker anymore pleae help me uninstall pipewire and use pulseaudio again

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