Bluetooth Audio Cutting Out

Hello all! I am experiencing problems with my Bluetooth headphones. The audio will be fine, then the audio stops. After a few seconds, it will come back a bit scrambled, then work for a few seconds, then cut out again. To be clear, the Bluetooth connection still works, but the audio drops out. I’m not sure where to even start debugging, so all assistance would be helpful.

Some info:

  • NixOS version: 24.05
  • Headphones: Bose QC35 II
  • Codec: A2DP Sink, codec AAC or SBC

My configuration:

  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    jack.enable = true;

    wireplumber.extraConfig.bluetoothEnhancements = {
      "monitor.bluez.properties" = {
        "bluez5.enable-sbc-xq" = true;
        "bluez5.enable-msbc" = true;
        "bluez5.enable-hw-volume" = true;
        "bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" ];
      };
    };
  };
  hardware.bluetooth = {
    enable = true;
    powerOnBoot = true;
    settings = {
      General = {
        Enable = "Source,Sink,Media,Socket";
      };
    };
  };
  services.blueman.enable = true;
  hardware.enableAllFirmware = true;

I am not an expert at all on Bluetooth, so I’m not even sure where to look for errors.

Thank you for any assistance!

have you seen

https://wiki.nixos.org/wiki/PipeWire

 services.pipewire.wireplumber.extraConfig."10-bluez" = {
    "monitor.bluez.properties" = {
      "bluez5.enable-sbc-xq" = true;
      "bluez5.enable-msbc" = true;
      "bluez5.enable-hw-volume" = true;
      "bluez5.roles" = [
        "hsp_hs"
        "hsp_ag"
        "hfp_hf"
        "hfp_ag"
      ];
    };
  };

Thank you for the link! I’ve been using this:

https://nixos.wiki/wiki/PipeWire

I’m not sure what the difference between wiki.nixos.org and nixos.wiki is <_<.

I tried the configuration that you’ve shared here, and then I saw no changes to the behavior, so I switched back. Now I can’t select an A2DP sink at all, so I’m going into headset mode, where the audio quality decreases, which is somewhat strange <_<.