44

I have various Bluetooth headsets, and when I use these with Android and ChromeOS, I get decent bidirectional audio quality for calls and video chats.

Unfortunately, when I use them on my arch Linux laptop (with PulseAudio 13.99.2+13+g7f4d7fcf5-1, bluez 5.55-1, and pulseaudio-modules-bt 1.4-3), I have a choice (under the pavucontrol configuration panel, or using pactl set-card-profile): I can enable high quality sound using A2DP with a nice selection of codecs including SBC, AptX, and AAC, or I can enable the microphone using HSP/HSF instead of A2DP. With the HSP/HSF profile, the microphone "works" in the sense that there is bidirectional audio with both a source and sink in PulseAudio, but the sound quality is so bad that it can be hard to understand the words people are saying.

My questions are:

  1. What is actually happening when Android or ChromeOS gets decent sound quality with the mic enabled? Is it possible to use a decent codec in HSP/HSF mode? Is it possible to use a mic with A2DP? Or is there some other Bluetooth mode?

  2. On the pulseaudio-module-bt web site, all of the codecs except LDAC seem to support decoding as well as encoding, but how do I actually use the decoding functionality? Is this only for using my laptop as a virtual headset for another device, or is there a way to use these codecs for the microphone of a Bluetooth headset?

  3. What concrete steps can I take to make my headset sound better in bidirectional calls? Or failing that, even if the microphone sounds bad, can I at least make the speakers sound good without completely disabling the microphone?

Update

Well, I don't fully understand this, but it seems that maybe good sound quality requires at least HFP 1.6, and bluez currently does not support HFP because doing so requires breaking backwards compatibility with oFono, which has become a contentious question.

Until this has been sorted out, I worked around the problem by getting an Avantree DG80 Bluetooth audio dongle. It looks like an ordinary USB audio device in Linux but pairs with my headsets. The sound quality isn't as good as A2DP, but is noticeably better than what I was getting out of bluez/PulseAudio. It's also nice that I can switch between the A2DP and HSP/HSF modes either by switching between stereo and stereo+mono input in PulseAudio, or by double-tapping the switch on the front of the Bluetooth dongle.

Matthias Braun
  • 7,797
  • 7
  • 45
  • 54
user3188445
  • 5,107
  • 3
  • 21
  • 38
  • 2
    Android and ChromeOS have their own Bluetooth stack. As for Bluez, the stack on desktop Linux, see https://askubuntu.com/a/1250010/158442 – muru Oct 29 '20 at 06:57
  • @mutu I don't think A2DP and HSP/HSF are bluez things. I think they are bluetooth standards. In that case, question 1 doesn't really depend on the bluetooth software stack. There is some way to get decent bidirectional audio over bluetooth (whether or not bluez supports it), and I'd like to know what that is. – user3188445 Oct 29 '20 at 15:01
  • 1
    That's kinda like saying POSIX isn't a Linux thing - sure, it isn't, but you're depending on the stack to provide what the standards specify, and if your stack doesn't implement all of the standards (plus optional items and extensions), then what? There is some way - one way is what Android and Chrome do - use a different stack (Flouride). The other way is to get all of those optional items and extensions implemented. – muru Oct 29 '20 at 16:34
  • @mutu If you know of something good written about this, then why don't you link to it so that I can read it. You seem to have linked to something about pulseaudio, rather than Flouride or bluetooth in general. – user3188445 Oct 31 '20 at 06:43
  • 1
    @user3188445 I have a Sony WH-1000XM4 headset multipoint-paired to my phone and Linux computer. When using my Linux computer, the microphone is practically useless due to this issue. After reading about your findings, I'm considering to purchase an Avantree DG80 Bluetooth audio dongle, but wondering what makes it better regarding this issue compared to other audio dongles. – László Monda Jan 15 '21 at 22:16
  • @LászlóMonda The DG80 is something I found that supports HSP 1.6 and Bluetooth 5. There may be other audio-only dongles that do this too, in which case please report here as I'm sure people would be interested in trying other products, too. – user3188445 Jan 17 '21 at 00:25
  • @user3188445 I'm curious, what phone do you have that supports mSBC (HFP 1.6 wide band speech)? It doesn't seem supported on my oneplus 8. – billy Sep 12 '21 at 12:54
  • I was just able to get this working using the great info from this article... https://kumarvinay.com/how-to-enable-bluetooth-headset-microphone-support-in-ubuntu-20-04/ One note though as the article says at the bottom... "Please keep in mind that choosing HSP/HFP profile makes your bluetooth in mono mode and you lose stereo sound. I would recommend you to use it only in case of meetings." – Egyas Jan 05 '22 at 18:31

3 Answers3

15

A2DP is not a bidirectional profile. So it will not get bi-directional audio.

What you want is something like the mSBC codec over HFP profile.

There is a good article here that explains how to use it on Ubuntu 20.04 with pipewire instead of PulseAudio. It even includes a recording soundclip, and a playback soundclip (which was created by recording, with a mic the sound from the headset), to show the difference in quality.

rasmus91
  • 352
  • 1
  • 4
  • 9
7

You might be able to do this with PipeWire instead of PulseAudio.

Comment from Ric @tornado99 with some adaptions:

On arch-based distros:

  1. uninstall pulseaudio-bluetooth
  2. force uninstall just pulseaudio without removing any dependencies, so sudo pacman -Rdd pulseaudio
  3. install pipewire and pipewire-pulse
  4. edit /etc/pipewire/media-session.d/bluez-monitor.conf to allow mSBC
  5. make sure you are running kernel 5.8+
  6. check it works i.e. select HSP profile, and then you can use headphones+mic on your device with reasonable-sounding audio (16kHz)
  7. if you get silence, you need to switch to a Realtek RTL8761B-based USB receiver. These are very cheap (mine was branded Maxesla Bluetooth 5.0)
  8. install firmware file for RTL... (just do a web search)
  9. enjoy!
Matthias Braun
  • 7,797
  • 7
  • 45
  • 54
  • 2
    PipeWire also supports automatic profile switching, see this https://askubuntu.com/a/1397581/92428 for details. – Stephan Windmüller Mar 15 '22 at 06:08
  • @StephanWindmüller The only application that I cannot possible get this to work properly with is, ofc, Microsoft Teams. Every other communication app i have: Discord, slack and others work fine with automatic switching. – rasmus91 May 04 '22 at 19:50
4

Based on this answer https://askubuntu.com/a/1250010/35326 it looks like A2DP bi-directional audio will not work until Linux kernel and PulseAudio are improved to support this.

JLarky
  • 149
  • 1
  • 3
  • 4
    Actually this is not correct. A2DP is a bluetooth profile, that does not specify Bi-directional audio. So saying "It will not work until Linux kernel and PulseAudio are improved to support this" Is only correct in that it will NEVER support it on A2DP. What you want is a high quality codec via HFP. such as mSBC. – rasmus91 May 04 '22 at 19:54