Hacker News new | ask | show | jobs
by jchw 2050 days ago
Sidenote: Bluetooth audio is not in a dire state, at least compared to Windows. Let me compare my experience on Windows 10 2004 to a fairly vanilla NixOS PulseAudio configuration. Same Bluetooth chipset, same headphones (Sony WH1000XM3s.)

On Windows:

- Obviously, in Windows, you get the Bluetooth stack automatically, as well as drivers. So I did not have to do any setup. It is possible, though, that some alternate drivers would work better than the default ones, which seem to be buggy.

- Pairing is fairly straight forward. However, sometimes it doesn't work quite right: the device will connect but not function right, sometimes leading to all Bluetooth devices failing to pair or connecting and disconnecting rapidly. This may be related to the driver, although it is using the default driver.

- Playback seems fine when it works. Sometimes it is randomly choppy. My understanding is that Windows 10 supports aptX but not aptX HD, and I can't get it to show up in traces but I suspect aptX is likely the codec being used. SBC is really 'good enough' for most cases though, so it's not a big deal.

- Routing leaves something to be desired. Every single time the device is paired, anything that plays audio needs to be moved or explicitly restarted for it to work. For example, Firefox or Edge tabs playing music typically have to be reloaded even if i unpair and repair the headphones during playback. It also interacts ridiculously poorly with my Realtek drivers, also Windows 10 defaults. I typically have to jump into the weird mixer and try to get everything right when switching between the two, and some apps like Discord act a little weird even then.

On NixOS:

- Not all distros will require this, but NixOS naturally requires configuration by its nature. Here is my audio-related config, in its entirety:

      hardware.pulseaudio = {
        enable = true;
        daemon.config = {
          flat-volumes = "no";
          resample-method = "speex-float-10";
        };
        extraModules = [ pkgs.pulseaudio-modules-bt ];
        package = pkgs.pulseaudioFull;
      };
      hardware.bluetooth = {
        enable = true;
        package = pkgs.bluezFull;
      };
      nixpkgs.config.pulseaudio = true;
      environment.systemPackages = with pkgs; [
        pavucontrol pulsemixer broadcom-bt-firmware
      ];
Most of this is NixOS specific. Some of it is personal: I disable flat-volumes because I do not like flat-volumes. I switch the resampler to a different one to prevent aliasing artifacts. (This may seem like audiophile non-sense, but it actually impacted real-time resampling chibi-tech's album "The Mutual Promise" which has 18-20 kHz sounds in it, designed to sync to some Pripara toys. Pretty interesting stuff.)

In any case, it's the whole config. I don't think I ever had to trial-and-error it, I just followed the manual. So not too bad.

Honestly, I fully expected it would not work. And for a long time, I never tried the setup. However, a few months ago I tried it. Here is what I found:

- Pairing works. I have yet to hit an issue where pairing does not work.

- Playback works, and using either Blueman or the PulseAudio mixer it is trivial to switch between A2DP codecs or, if for some reason one would want to do it manually, HSP. Once again, I have not noticed problems. I tend to use the Sony LDAC codec since it seems most appropriate for the headphones.

- Routing seems okay too. I do still sometimes run into a situation where I need to switch an app manually, but it's easy to do in the PulseAudio mixer.

My verdict is that the Linux Bluetooth Audio situation is not bad. Yes, no ordinary Windows user could stomach the Nix configuration in my Nix setup. However, you can notice the lack of hacks needed here: clearly, Bluez and PulseAudio are now up to the task of handling Bluetooth Audio "correctly". I haven't tried but I suspect Debian or Fedora would, with a couple of packages installed, handle Bluetooth devices just fine so as long as the Bluetooth chipset is supported.

Bonus: In the future, Pipewire will take over for Bluetooth audio. For the time being it is limited to SBC and can't handle other codecs yet, but I gave it a shot and it seems to work just fine, too. Hopefully that holds into the future.

4 comments

On Debian one must install "bluetooth" and "pulseaudio-module-bluetooth" that for some reason are not installed by default. After that it's a matter of synchronizing things on the bluetooth GUI and if you don't want the obvious setup, deciding where the sound goes to on the mixer GUI.

But well, when I brought my current earplugs the mic didn't look like it was working on my (Android) phone and searched the web for it, I discovered that many lines of JBL plugs aren't supported on Windows by default. There are devices that only fail to work on Teams, or Skype, some only work on those applications, some reproduce anything except audio from videos (all issues confirmed by the manufacturer).

As of late this summer I was unable to get my BT headphones to work on Fedora in a 2-way transmission mode. The speakers would work but not the microphone. I don't remember the details but when I dug deep into the issue, there seemed to be a fight about merging a PR that would allow it.

There are no longer many things keeping me from going all-Linux but I am not going to sit through every meeting chained to my desktop with a little earbud wire.

Hopefully pipewire will resolve this, and I don't think any of us realized in advance what meetings were going to look like in 2020.

If it isn’t working, you might need to switch your headphones to the HSP profile. You can do this in Pavucontrol, the last tab with the devices. I prefer using wired headphones or at least a wired setup for this because HSP is piss-poor quality. But the quality issue, at least, is nothing especially new for BT devices on calls.
Most Bluetooth devices work fine for me with Fedora, but I still haven't been able to get my Bose quietcontrol headphones to work correctly - they pair but then start playing random noises and telling me there's an incoming call.

I have some wired headphones I prefer in general so haven't messed around with it too much, but it's been a source of frustration when I've been away from home and needed to do a call with only the Bose ones on me

>start playing random noises and telling me there's an incoming call.

Open your bluetooth settings and change the mode from HSP/HFP to A2DP mode. That incoming call issue happens in HSP mode because something has tried to access a microphone which has defaulted to your headphones mic which causes the bluetooth mode to switch.

Interesting. I suppose there are, then, still some serious issues to resolve. I guess for now I can just be glad I did not go with Bose QCs instead :)
While I agree that Bluetooth audio on Windows is crap, its saving grace is that when it works, it's stellar. I have the same headphones as you, and audio quality is consistently significantly better on Windows than on Linux (most notably when I'm also using the microphone).
I think with standard Bluetooth, recording will necessarily kick you to HSP with terrible phone quality. This happens to me on Windows and Linux, with my Sony WH1000XM3s. If there is a workaround please let me know. I am sure there are some non-standard extensions but I don't think my headphones support them.

If you are experiencing "bad" quality on Linux, you probably would benefit significantly from installing the additional codecs. Linux is the only desktop operating system that supports basically all of the Bluetooth audio codecs! But of course, they're patent-encumbered (except Sony LDAC) and thus not typically included by default.