How to improve Bluetooth audio quality
#7
Hi @fernando_c_m,

oh thanks for your feedback. I don't know how this error has crept in! I've fixed the original post.

Here's an updated version of bluetooth.sh:

Code:
#!/bin/bash
# Note: Bluetooth headset must be connect when running this script.

# Enable auto connection of the bluetooth device (add "load-module module-switch-on-connect" to /etc/pulse/default.pa first):
MACADDR=`pactl list cards | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'`
bluetoothctl trust $MACADDR

# Increase latency:
BLUEZCARD=`pactl list cards short | egrep -o bluez.*[[:space:]]`
SNDDEVICE=`pactl list | grep '\-output:' | head -n1 | cut -d ":" -f1 | xargs`
pactl set-port-latency-offset $BLUEZCARD $SNDDEVICE 100000

# Restart bluetooth:
sudo service bluetooth restart

# Reconnect:
bluetoothctl connect $MACADDR

# Show current settings:
pactl list | grep -Pzo '.*bluez_card(.*\n)*'

Notice that the script now tries to reconnect the bluetooth device after restarting the bluetooth service. It also tries to setup an automatic bluetooth reconnection (you need to edit /etc/pulse/default.pa first, see script).

This sort of works, but is not perfect! Sometimes there is a loud hum after reconnecting, this has happend with both of my bluetooth headsets. Using delays in the script could potentially help.

What I haven't figured out yet is how to get the buttons on the headsets working. According to https://wiki.archlinux.org/index.php/Blu...a_controls, this should work with "mpris-proxy". The tool recognizes the bluetooth connections and the players (I've tried Lollypop and Rhythmbox), but it does not work.

Cheers,
Sebastian


Messages In This Thread
RE: How to improve Bluetooth audio quality - by CyberSeb - 07-28-2020, 01:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Bluetooth audio revisited 3x5co 1 1,019 01-10-2023, 05:51 PM
Last Post: Zebulon Walton
  No audio on calls after updating today Zebulon Walton 10 4,006 12-12-2022, 09:55 PM
Last Post: BaronAlbatross
  Ringtones and Audio Modes biketool 0 705 09-05-2022, 10:42 AM
Last Post: biketool
  Giving certain audio apps priority on the lock screen and pulldown 3x5co 0 809 07-17-2022, 10:34 AM
Last Post: 3x5co
  Any fix for bluetooth crash when entering pairing password? kk22 0 807 06-18-2022, 07:51 PM
Last Post: kk22
  Blueman GUI Bluetooth Network Access Point - fixing Bridging biketool 12 7,781 05-26-2022, 05:56 AM
Last Post: biketool
  Scripting Bluetooth Hotspot for Mobian biketool 1 1,467 03-20-2022, 03:03 PM
Last Post: biketool
  Bluetooth audio support? Zebulon Walton 5 3,545 02-28-2022, 08:59 AM
Last Post: Zebulon Walton
  Help! Audio stopped working Barugon 4 3,197 11-03-2021, 10:58 AM
Last Post: Barugon
  File Transfer With Bluetooth food 0 1,029 10-29-2021, 11:00 AM
Last Post: food

Forum Jump:


Users browsing this thread: 1 Guest(s)