0

I'm using a JBL T450BT headset under Ubuntu 17.04. There are random brief interruptions in audio transmission, that, when combined, create a significant latency visible when watching videos etc. (let's assume that this very problem is inextricable).

My current workaround to make sound synchronized again is to go to Sound Settings and change headset's mode from A2DP to HSP/HFP (which kills the sound whatsoever, but I don't care) and switch it back to A2DP. Analogical operation can be made with blueman, but either way it is an irritating number of clicks to make.

Is there any other way to do that or at least to automate the method above? A single command would be most appreciated, since it can be easily assigned to a custom hotkey.

Szymon
  • 121
  • 3

1 Answers1

0

This answer to a different question helped me resolve this issue, though with one detail: on my device, the profile name in question is a2dp_sink rather than a2dp. I also decided to switch to off profile rather than hsp, hoping it gets better performance. So my eventual script looks like this:

#!/bin/bash

BLUEZCARD=`pactl list cards short | egrep -o bluez.*[[:space:]]`
pactl set-card-profile $BLUEZCARD a2dp_sink
pactl set-card-profile $BLUEZCARD off
pactl set-card-profile $BLUEZCARD a2dp_sink

In order to find what profile names you should use this command:

pacmd list card

It will produce long output, but you should be looking for fragment like this:

profiles:
    a2dp_sink: Odtwarzanie o wysokiej dokładności (odpływ A2DP) (priority 10, available: unknown)
    headset_head_unit: Jednostka główna słuchawek z mikrofonem (HSP/HFP) (priority 20, available: unknown)
    off: Wyłączone (priority 0, available: yes)
derHugo
  • 3,356
  • 5
  • 31
  • 51
Szymon
  • 121
  • 3