Although PipeWire supports codecs like LDAC and AptX out of the box, these might not always be enabled by default or unsupported by your distribution or Bluetooth device.
Thanks to u/Zettinator who pointed this out on Reddit.
Because my distro of choice, Fedora, only lets completely free and open-source packages into its repos, PipeWire is built without AptX support due to licensing issues.
Fortunately, we can make use of SBC-XQ, a sort of unofficial lifehack that forces the SBC codec to run at a very high bitrate (up to 730 kbit/s). SBC is mandatory for Bluetooth devices that want to support A2DP, a profile that is used for Bluetooth devices to send audio to each other. As it turns out most devices support SBC going up to 720 kbit/s, even though the A2DP standard is just 345 kbit/s, so just upping the bitrate is a free lifehack to get better audio quality and works on most Bluetooth devices.
Tl;Dr: SBC is supported by every modern Bluetooth device that plays audio, and we can (most of the time) force it to use a higher bitrate than usual, resulting in a better audio quality.
PipeWire will either have a editable config file in /etc/pipewire
or not. This can vary depending on distribution but not having this file is not a problem, just follow this guide.
If your system has the config file then there is no need to copy it and you can just skip this next step.
We need to copy the default PipeWire configuration file to a place where we can modify it. If we edit the default in /usr/share/pipewire
then our changes might get overwritten when a PipeWire update gets applied.
$ sudo mkdir /etc/pipewire # create a folder for the config file
$ sudo cp /usr/share/pipewire/pipewire.conf /etc/pipewire/ # copy the default configuration
Open the config file either in a graphical editor or in the terminal using:
$ sudo nano /etc/pipewire/pipewire.conf
You can navigate the terminal UI with your arrow keys and exit and close with Ctrl + X
.
There, just uncomment the following line (or add it if it's not there):
bluez5.enable-sbc-xq = true
and then just restart PipeWire:
$ systemctl --user restart pipewire pipewire-pulse
Also feel free to try out other settings, but these might break your config, so be careful.
Finally, go to your audio settings and change the profile to either High Fidelity Playback (A2DP Sink)
or codec SBC-XQ
For me on KDE, this looks like this:
I actually didn't get it to work the first time, so you might wanna try a mix of systemctl --user restart pipewire pipewire-pulse
and pkill pipewire
and see if that helps.