[How-to] set up Bluetooth audio

blueasla.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 $OPTIONS
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

/etc/default/bluealsa

OPTIONS=“-p a2dp-source -p a2dp-sink --a2dp-volume”

.asoundrc

This file describes the bluetooth sinks available for Kodi to play to
add lines like the following for each BT device (speaker or headphones)

pcm.mybtdevice {
type bluealsa
device “08:E8:4D:87:64:33”
profile “a2dp”
hint { show on description “E11BT”}
}

pcm.my2ndbtdevice {
type bluealsa
device “5C:FB:7C:31:45:43”
profile “a2dp”
hint { show on description “P22BT”}

}

pcm.my3rdbtdevice {
type bluealsa
device “42:24:56:45:7A:74”
profile “a2dp”
hint { show on description “TWS50”}
}

using the MAC of the device (see bluetoothctl) instead of 12:34:56:78:9A:BC
Use any letters or numbers for the description which will show up in Settings-System-Audio

Thanks. That looks OK. You could try using a plug device for each of your BT devices like so:

osmc@vero4kp2:~$ cat .asoundrc
pcm.jblflip {
type plug
slave.pcm {
        type bluealsa
        device "FC:A8:9A:B3:42:4F"
        profile "a2dp"
}
        hint { show on description "JBL Flip 3"}
}

@felichas might like to try that as well.

Thanks @grahamh. I just gave it a go with the proposed .asoundrc
but the behaviour of my Nokia BH-905 Headphones is exactly the same as before: no sound, things start to slow down until I need to reboot, which again stops 1m30s on bluealsa when stopping.

[Nokia BH-905]# info
Device 00:0B:E4:3B:DD:3D
	Name: Nokia BH-905
	Alias: Nokia BH-905
	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: 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)

I will have some time tomorrow to test everything again using the external BT dongle only.

I have now tested everything again using an external bluetooth dongle, and the results have been 100% identical. I have used both “versions” of .asoundrc
I am happy to run any further tests or get more logs.

I haven’t forgotten you guys. I need to work out some troubleshooting steps. Can we start with uploading some debug logs: reboot->connect BT device->restart Kodi (Power->Exit)->select BT device in Settings->System->Audio then upload logs (may have to use command line if Kodi has slowed down).

Hi

Sorry for the delay … I needed some vacations

This is the first time i create a log file …

https://paste.osmc.tv/exoralodex

Hope it will be useful for you

I try to connect with my bluetooth headphones TWS50

what is the status of bluetooth (bluezasla ?) with the currently tested version kodi v19 ?

would it a benefit to upgrade and test with this version ?

It’s working fine with the current v19 build

Is this working on the RPI4 test build?

Yes

is onboard bluetooth on pi4 working as good as pi3?

Can get headphones to connect but it automically disconnects

Pi3 connected without issue

I would need to do some test, I just quickly checked it a couple of weeks ago during our test phase most likely with my external adapter.

We just figured out that the package seems not be pushed to the repository. So you need either install it manually as described in post 1 or wait a few days.

1 Like

In which directory should I copy the deb package and its it possible to copy the file using file manager on kodi?

Copy it where ever you want to run dpkg. Normally you would copy it into /home/osmc/.
If you have access with Kodi filemanager to the location where you have the file it is fine to use that.

And after I copy where should I type the directory in the command in order to run it? Thank you for your time

In the home directory which you access via command line

Details regarding how to access the command line interface can be found here on our Wiki: Accessing the command line - General - OSMC

I’ve upgraded my Vero 4K to Kodi 19.1, but there is no bluez-alsa package installed. Should I install it manually?

Yes, actually the package sofar was not included as planned so manual install as in the post is still required.

1 Like

Streaming audio from Kodi to headphones does not work. The Bluetooth pair is successful, but the audio still plays from the TV.

Streaming from phone to Kodi is working, but there is no visual hint. Many car audio systems can show the track name and data, send next and previous controls and even seek the audio track. It would be nice to have them in Kodi.

Here is my .asoundrc file:

osmc@vero:~$ cat ~/.asoundrc
pcm.mybtdevice {
        type bluealsa
        device "A4:77:58:73:4D:4C"
        profile "a2dp"
        hint { show on description "Philips"}
}