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
  Mobian, Suspend, and Audio Playback biketool 0 129 12-11-2024, 12:56 AM
Last Post: biketool
  Audio output switching anomalies treebeard 1 1,036 06-10-2024, 06:37 AM
Last Post: anonymous
  Bluetooth audio revisited 3x5co 1 1,491 01-10-2023, 05:51 PM
Last Post: Zebulon Walton
  No audio on calls after updating today Zebulon Walton 10 6,569 12-12-2022, 09:55 PM
Last Post: BaronAlbatross
  Ringtones and Audio Modes biketool 0 1,040 09-05-2022, 10:42 AM
Last Post: biketool
  Giving certain audio apps priority on the lock screen and pulldown 3x5co 0 1,132 07-17-2022, 10:34 AM
Last Post: 3x5co
  Any fix for bluetooth crash when entering pairing password? kk22 0 1,122 06-18-2022, 07:51 PM
Last Post: kk22
  Blueman GUI Bluetooth Network Access Point - fixing Bridging biketool 12 11,063 05-26-2022, 05:56 AM
Last Post: biketool
  Scripting Bluetooth Hotspot for Mobian biketool 1 1,948 03-20-2022, 03:03 PM
Last Post: biketool
  Bluetooth audio support? Zebulon Walton 5 4,661 02-28-2022, 08:59 AM
Last Post: Zebulon Walton

Forum Jump:


Users browsing this thread: 2 Guest(s)