Configuring LDAC Quality in PipeWire

You can set the LDAC quality between High, Standard, and Mobile quality, corresponding to 990/660/330 kbps. You can do it either statically or dynamically.

Static Configuration

Place the following configuration in ~/.config/wireplumber/wireplumber.conf.d/10-bluez.conf:

monitor.bluez.rules = [
  {
    matches = [
      {
        ## This matches all Bluetooth devices.
        device.name = "~bluez_card.*"
      }
    ]
    actions = {
      update-props = {
        bluez5.a2dp.ldac.quality = "sq"
      }
    }
  }
]

The value of quality can be set to either hq, sq, mq, or auto.

You can also change the match fragment to match only a specific device. Use the following command to list all currently available devices:

$ pw-cli ls | grep device.name

After changing the configuration, you’ll have to restart WirePlumber:

$ systemctl --user restart wireplumber

Dynamic Configuration

This method is less user-friendly. The first step is to find the id of the relevant output node. You can do this by examining the output of pw-cli ls or wpctl status. Make sure you pick the id of the corresponding node and not the device. Next, use pw-cli set-param to set the quality, for example:

$ pw-cli set-param 93 Props '{quality=0}'
Object: size 32, type Spa:Pod:Object:Param:Props (262146), id Spa:Enum:ParamId:Props (2)
  Prop: key Spa:Pod:Object:Param:Props:quality (269), flags 00000000
    Int 0

Where 93 is our node id, and 0 corresponds to hq quality. Other possible values are: -1 for auto, 0 for hq, 1 for sq, and 2 for mq.

Empirically Verifying Bitrate

You can deduce the actual bitrate by sniffing the Bluetooth traffic and analyzing the capture using Wireshark.

$ sudo btmon -w btsnoop.log
$ wireshark btsnoop.log

In Wireshark, go to Statistics -> Capture File Properties, and there you can see the average bits/s and compare it to the bitrate of the expected quality setting.

One thought on “Configuring LDAC Quality in PipeWire”

  1. FYI:

    Sony 1000 MX4 ldac …

    [ ! ] —> The solution was frustratingly easy. Just set the Sound quality mode to “Priority on sound quality” in the Headphone App, and the LDAC codec appeared.

    [ ! ] —> I’m going to leave this here for people searching for the same thing. On top of setting “priority on sound quality” you also have disable the “connect to multiple devices” otherwise the maximum you get is AAC.
    https://www.reddit.com/r/linuxquestions/comments/s9kh79/sony_wf1000mx4_pipewire_or_pulseaudio_ldac/

    AND (maybe also…)
    -> mkdir -p ~/.config/wireplumber/bluetooth.lua.d/
    -> cp /usr/share/wireplumber/bluetooth.lua.d/50-bluez-config.lua ~/.config/wireplumber/bluetooth.lua.d/
    -> vi ~/.config/wireplumber/bluetooth.lua.d/50-bluez-config.lua
    -> (add:) [“bluez5.roles”] = “[ a2dp_sink a2dp_source ldac ]”

Leave a Reply

Your email address will not be published. Required fields are marked *