The top reply here works, but not for every Bluetooth audio device. Some devices have different profile names than what that poster has with his Bluetooth speakers. For instance, in the following code, which was originally posted by that person, it apparently has profiles named a2dp
and hsp
. Neither of these are available with my LG Tones, for example, but they are with other devices like my Sony headset.
#!/bin/bash
BLUEZCARD=$(pactl list cards short | egrep -o bluez.*[[:space:]])
pactl set-card-profile $BLUEZCARD a2dp
pactl set-card-profile $BLUEZCARD hsp
pactl set-card-profile $BLUEZCARD a2dp
That code will work for most bluetooth devices it appears, but to get this working correctly for those devices that don't have the a2dp profile or the hsp profile, type in:
pactl list | grep -Pzo '.*bluez_card(.*\n)*'
This will return everything after where it finds a bluetooth device. For instance, with the LG Tone Ultra headset, I get this:
Name: bluez_card.B8_AD_3E_**_**_**
Driver: module-bluez5-device.c
Owner Module: 36
Properties:
device.description = "LG HBS810"
device.string = "B8:AD:3E:**:**:**"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "headset"
bluez.path = "/org/bluez/hci0/dev_B8_AD_3E_**_**_**"
bluez.class = "0x240404"
bluez.alias = "LG HBS810"
device.icon_name = "audio-headset-bluetooth"
device.intended_roles = "phone"
Profiles:
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: a2dp_sink
Ports:
headset-output: Headset (priority: 0, latency offset: 0 usec)
Part of profile(s): a2dp_sink, headset_head_unit
headset-input: Headset (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit
We are interested in the profiles
section. In this section, we see three profiles, which are a2dp_sink
, headset_head_unit
, and off
. The two profiles we need should have in them (A2DP Sink) and (HSP/HFP). In this case, they are a2dp_sink
for the a2dp profile, and headsethead_unit
for the hsp profile. Notice this is different than the original poster's a2dp
and hsp
.
Now, with the above code, we will modify it and put it into a file. I called the file bluezswitch.sh
.
Change to the directory you want to put the file. It can be anywhere.
touch bluezswitch.sh
Then
nano bluezswitch.sh
Copy and paste the code at the very top of this comment and replace the a2dp
and hsp
with the values you got when you ran the above command, and paste it in that file. For instance, this is what my file looked like for my LG Tones.
#!/bin/bash
BLUEZCARD=$(pactl list cards short | egrep -o bluez.*[[:space:]])
pactl set-card-profile $BLUEZCARD a2dp_sink
pactl set-card-profile $BLUEZCARD headset_head_unit
pactl set-card-profile $BLUEZCARD a2dp_sink
Now, ctrl-x
then y
to save the file and exit nano, and then make the file executable:
chmod +x bluezswitch.sh
Then follow up by setting a keyboard shortcut as has been explained.
Go to Settings...Keyboard...Shortcuts, and create a
custom shortcut; name it whatever you want, with the command as
/home/$USER/bluezswitch.sh (substitute appropriate username in
path!). Click Apply, and then click on the right where it says
Disabled to set up a keyboard shortcut to execute the script.
That should be all there is to it. This should work for all those that it didn't work for before.
mplayer
, you do so by pressing the+
and-
keys. In VLC, I don't know how to set the delay, but I'd be surprised if VLC doesn't have such an option.Tools->Track Synchronisation
, or play with the--audio-desync
option. I'm afraid I'm not sure what the units are, and which direction is positive, and the help is not forthcoming on the matter, but that's where you want to look.