[How-to] set up Bluetooth audio

BTW, I got a spare dongle (CSR 4.0) that I can try out, but I’m not sure how to set it up in Kodi.

IIRC you just have to disable the internal BT with a line in config. Then it should just work.

1 Like

I’m happy to report that the sound is streaming perfectly over bluetooth when I use the spare dongle.
Thanks for the help!

Thanks for letting us know. The Pi internal dongle an be sketchy but it was working for me. But good to know that it also can be the source of interuptions.

The chip in RPi deals with both WiFi and BT so when you are streaming over WiFi there can be BT glitches.

Yes, that was the issue since I’m connecting to NAS over WiFi.

There is no issue with integrated BT when I’m connected over cable and WiFi is disabled.

Thanks for the tip!

Hi @grahamh, thanks for the clear instructions! :+1:

I’ve been able to make both bluetooh devices working with OSMC after several reboots and using command line (not a matter, but not very friendly on a daily basis). Let’s see if the BT will be pairable automatically upon reboots. :slight_smile:

I’ve got a minor issue though, not being able for a while to make both devices visible in OSMC settings, I have a speaker and headset, the first looked to be prioritized.

I figured out that I had to rename second section to avoid name collision in my .asoundrc, as following:

pcm.mybtdevice {
        type bluealsa
        device "5C:FB:7C:36:1C:7D"
        profile "a2dp"
        hint { show on description "AUKEY EP-B40"}
}
#pcm.mybtdevice { <= name conflicting, overrides the first device if let as this
pcm.my2ndbtdevice {
        type bluealsa
        device "08:EB:ED:84:AD:D7"
        profile "a2dp"
        hint { show on description "Soundcore 2"}
}

Now, it works seamlessly!

Thanks to both of you and @fzinken for the link!

Thanks for the feedback. Yes we know it’s clunky - still WIP.

Thanks @grahamh works great. Good fast connection.

Had issues with onboard bluetooth in past looks good so far.

Is there a way to set a volume level per device?

My bluetooth reciever starts off full blast everytime can be bad for ears if i forgot reduce kodi volume beforehand.

Alsa has a way of setting the initial volume level but I don’t know if it works with devices that aren’t there at boot time. It’s all a bit mysterious. I just set the volume on my BT speaker to something sensible and it remembers it.

Hi Guys

I have a question.

I am currently using Bluetooth with my headphones but I will say with the old method. A2dp

What are the benefit of the bluez-asla ?

I will have to uninstall ad2p if i want to install bluz-asla ?

Thank you

Well one advantage is it doesn’t require pulseaudio. And it will be the standard default method in the future for OSMC.

Yes, recommend to run
sudo apt-get remove --purge a2dp-app-osmc bluetooth bluez pulseaudio-module-bluetooth pulseaudio

1 Like

Thanks

I am going to install that next week!

is there a limit about the number on device on the file .asound.rc

I have three headphones

two are working ok, the third one is present, paired, connected but I have no sound and when I start a movie, everything is very slow, and then I can’t do nothing

Not afaik. Are you sure one of the other headphones is not connected/trying to connect when you are using the third?

I have followed the above instructions and I can confirm they work fine for me, with some caviats that might be of interest:

I am running osmc VERSION_ID=“2020.11-1”
Hardware: Raspberry Pi 3B
Bluetooth HW: RPi internal

When I pair my Bose SoundSport Headphones
[NEW] Device 28:11:XX:XX:XX:XX Bose SoundSport
Everything works perfectly. Good quality sound. Only some glitches when watching 5.1 content and the “Raspberry Pi is not receiving enough power” warning shows up (but this is another story).

When I pair my JBL GO small BT speaker
[NEW] Device 78:44:YY:YY:YY:YY JBL GO
Everything works but the sound is choppy. Bad quality sound. Not really usable.

When I pair my Nokia BH-905 Headphones
[NEW] Device 00:0B:ZZ:ZZ:ZZ:ZZ Nokia BH-905
Pairing works fine, but there is no sound, and I get the same behaviour @Yvan is getting.
I end up needing to reboot osmc to get back to normal, and in the shutdown process I’ve sometimes seen a bluez stop script hung and had to wait an extra 1m30s for it to timeout.

I will try to disalbe internal bluetooth and test all 3 devices again with an external BT dongle that I have around too.

Yes I also notice the bluez stop script for 1 min 30.

I am going to perform more tests

We are aware of that bluez-alsa stop problem. Looking into it.

1 Like

Hello

Here is the info about my three devices:

Only the PB22T is working at the moment

osmc@osmc:~$ bluetoothctl
[NEW] Controller 44:2C:05:9D:12:61 osmc [default]
[NEW] Device 08:E8:4D:87:64:33 E11BT
[NEW] Device 5C:FB:7C:31:45:43 P22BT
[NEW] Device 42:24:56:45:7A:74 TWS50
[P22BT]# info 08:E8:4D:87:64:33
Device 08:E8:4D:87:64:33
        Name: E11BT
        Alias: E11BT
        Class: 0x240418
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: bluetooth:v005Dp223Bd0100

[P22BT]# info 5C:FB:7C:31:45:43
Device 5C:FB:7C:31:45:43
        Name: P22BT
        Alias: P22BT
        Class: 0x240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[P22BT]# info 42:24:56:45:7A:74
Device 42:24:56:45:7A:74
        Name: TWS50
        Alias: TWS50
        Class: 0x240418
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: bluetooth:v005Dp223Bd0100

Could it be that the class is causing them problem?

If it is, it’s strange. The PB22T is classed as a headset (xxx404) and doesn’t offer a2dp. But by default bluealsa should be using a2dp. Can you post the contents of /lib/systemd/system/bluealsa.service and /etc/default/bluealsa (if it exists)? My unit file looks like this:

osmc@vero4kp2:/lib/systemd/system$ cat bluealsa.service
; Unit file from bluealsa wiki by borine

[Unit]
Description=Bluealsa daemon
Documentation=https://github.com/Arkq/bluez-alsa/
After=dbus-org.bluez.service
Requires=dbus-org.bluez.service
StopWhenUnneeded=true

[Service]
Type=dbus
BusName=org.bluealsa
EnvironmentFile=-/etc/default/bluealsa
ExecStart=/usr/bin/bluealsa -p a2dp-source -p a2dp-sink --a2dp-volume
Restart=on-failure
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
PrivateDevices=true
RemoveIPC=true
RestrictAddressFamilies=AF_UNIX AF_BLUETOOTH
; Also non-privileged can user be used
;User=bluealsa
;Group=audio
;NoNewPrivileges=true

[Install]
WantedBy=bluetooth.target

and I don’t have a /etc/default/bluealsa. The other two devices are classed as headphones (xxx418). I doubt the class is actually used by bluealsa - it’s the UUIDs for the profiles which matter and both of those headphones offer a2dp (0000110d) so ought to work. Can you get them to work if the PB22T is completely removed?

Can you also post your .asoundrc, please?