Jump to content

Bluetooth headset noise when set to HSP/HFP


Florin

Recommended Posts

Hi. I am trying to connect a bluetooth speaker that also has a microphone to armbian. When using it as a plain speaker via A2DP, it works fine. However when i switch it to HSP/HFP  in order to use the microphone, i get a lot of static, random crackling and very low volume on both the microphone and the speaker. Using a usb bluetooth adapter for this.
I've used the same adapter + speaker on a different machine (x86 running lubuntu 19.10) and i did not have any static at all when using HSP/HFP (sound was indeed a bit lower quality that A2DP but nothing major).  
Also i could not get the speaker to switch to HSP/HFP with the default audio tool in armbian desktop, nor on the CLI with 'pacmd set-card-profile ...'. The only thing that worked was using 'pavucontrol'.

 

I am running "Armbian_20.08.0_Arm-64_focal_current_5.7.0-rc7_desktop_20200531.img.xz" from balbes150's post on an x96 mini.

Link to comment
Share on other sites

Leaving this here since it might help someone in the future. Moved to a raspberry pi with raspberry pi os but had the exact same problem. Guessing the issue is the same but cannot 100% confirm yet. 
So, i basically applied this fix:
https://hackaday.io/project/165208-an-old-rotary-phone-as-bluetooth-set/log/162491-setting-up-the-bluetooth
Looks like the problem is with pulseaudio not setting the proper values when communicating over bluetooth, so you need to compile your own version. 
```
 

git clone git://anongit.freedesktop.org/pulseaudio/pulseaudio




The changes need to be made on the files 

src/modules/bluetooth/backend-native.c

and

src/modules/bluetooth/backend-ofono.c

from the Pulseaudio source. The line that reads

*imtu = 48;

has to be changed to

*imtu = 60;

Once this is done the Pulseaudio module can be compiled by calling

sudo apt-get build-dep pulseaudio 
cd pulseaudio
./bootstrap.sh 
make 
sudo make install 
sudo ldconfig


```
Copy/Pasted the original information just in case the link changes. 
Hope this helps someone, i dug a few days to find that :D

Later Edit: Finally got to testing this myself. Doesn't work, but leaving this here since it might be a push on the right track..

Link to comment
Share on other sites

Thank you!  This worked for me!

 

I am using a Pi Zero W  to act as a HandFree adapter for my iphone.  Hardware-wise, I am using:

  • a USB audio adapter for 1/8" microphone input  /  speaker output
  • The internal ONBOARD BRCM bluetooth chipset (no need for USB bluetooth adapter!)

I followed these instructions:  https://scribles.net/enabling-hands-free-profile-on-raspberry-pi-raspbian-stretch-by-using-pulseaudio/  and installed the full version of Raspbian Stretch (don't use lite - it won't work).  After I followed those instructions,  I could place calls but the problem was as described above --- the audio was horribly disjointed / crackly and pretty much unusable / unintelligible.  

 

After a couple of tries, I read the above about SCO packages being 48 / 60 bytes, and I recompiled Pulseaudio as above and it works!!!  To note, I expanded on the instructions above to be easier follow for a beginner like me:  

 

So we need to recompile pulseaudio:

git clone git://anongit.freedesktop.org/pulseaudio/pulseaudio

The changes need to be made on the files (use sudo nano <filename>)

pulseaudio/src/modules/bluetooth/backend-native.c
pulseaudio/src/modules/bluetooth/backend-ofono.c

from the Pulseaudio source. The line that reads

*imtu = 48;

has to be changed to

*imtu = 60;

Now execute the following.  Note that if you don’t do this, bootstrap below will fail.

sudo apt-get install autopoint

Now ensure that the deb-src lines are not commented out,  Remove the comment if it is commented out.

Note that if you don’t do this, then getting build dependencies for pulseaudio below won’t work.

sudo nano /etc/apt/sources.list

Now you have to do this after activating the deb-src lines.

sudo apt-get update

And then the following.  Note that "make" will take at least an hour on a Pi Zero W

sudo apt-get build-dep pulseaudio
cd pulseaudio
./bootstrap.sh
make
sudo make install
sudo ldconfig

 

Now reboot and try a call again — it should work and be clear!  However, now my issue is that I have horrible echo.  What's happening is that the microphone is picking up audio from the speaker and giving lots and lots of echo to the person on the other end of the call, and I need to figure out how to fix that....

Link to comment
Share on other sites

Hi @misterzanos. Regarding your issue, you might want to look into pulseaudio's echo cancellation.
I remember hearing that it does quite a lot of other things too, like noise reduction. You can also enable beanforming if your mic has more than 1 physical microphone embeded.

http://forums.debian.net/viewtopic.php?f=16&t=128306

https://arunraghavan.net/2016/05/improvements-to-pulseaudios-echo-cancellation/

 

Link to comment
Share on other sites

  • Werner locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines