BT audio from TV to RPI4 OSMC

Hello, I’ve went through this guide, however I can’t get it to work.

I am trying to connect my Samsung Q6FN TV (source) to the RPI4 (destination) for audio. The idea is that I might be able to stream TV broadcasting, YouTube, Spotify, or other TV native apps to OSMC. This is because the RPI has an HiFiBerry DAC on its GPIO leading to external amplified speakers that I simply cannot connect directly to the TV, so the RPI acts as a passthrough.

Steps of debugging

I am running the currently lates OSMC version (2023-01). When looking at the TVs BT audio menu, OSMC doesn’t shop up at all.

If I use the bluetoothctl cli, and make it discoverable and pairable, it still doesn’t show up on the TV, however it does show up on my Android 12 phone.
I’ve managed to pair to OSMC with Android, and it seems to work; until you try to play audio, and nothing happens on OSMC :thinking:

Samsung<->RPi

Can you set the Samsung to discoverable and pair it from the Pi?

Audio to HiFiBerry

Can you post the output of aplay -L and cat /lib/systemd/system/bluealsa-aplay.service so we can check.

Yes, I can pair OSMC → Samsung TV. In this instance the TV automatically enters the (useless) ambient mode and assumes that OSMC will be the source of audio, so the TV will act as a speaker. I can’t skip this mode, so no luck there.

aplay -L output (while connected to the TV):

osmc@osmc:~$ sudo aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
bluealsa
    Bluetooth Audio Hub
btaudio
    Bluetooth Audio
hw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0
    Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0
    Hardware device with all software conversions
default:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0
    Default Audio Device
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0
    Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0
    Direct sample mixing device
hw:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Direct hardware device without any conversions
plughw:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Hardware device with all software conversions
default:CARD=vc4hdmi0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Default Audio Device
sysdefault:CARD=vc4hdmi0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Default Audio Device
hdmi:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    HDMI Audio Output
dmix:CARD=vc4hdmi0,DEV=0
    vc4-hdmi-0, MAI PCM i2s-hifi-0
    Direct sample mixing device
hw:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Direct hardware device without any conversions
plughw:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Hardware device with all software conversions
default:CARD=vc4hdmi1
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Default Audio Device
sysdefault:CARD=vc4hdmi1
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Default Audio Device
hdmi:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    HDMI Audio Output
dmix:CARD=vc4hdmi1,DEV=0
    vc4-hdmi-1, MAI PCM i2s-hifi-0
    Direct sample mixing device

cat /lib/systemd/system/bluealsa-aplay.service output (should be as default, since I haven’t changed the contents):


osmc@osmc:~$ cat /lib/systemd/system/bluealsa-aplay.service
[Unit]
Description=A2DP Playback
After=bluealsa.service syslog.service
Requires=bluealsa.service
StopWhenUnneeded=true

[Service]
ExecStartPre=/bin/sleep 3
ExecStart=/usr/bin/bluealsa-aplay --profile-a2dp 00:00:00:00:00:00
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=A2DP-Playback
Restart=on-failure

[Install]
WantedBy=bluetooth.target

You need to re-read this bit .

Try adding -D default:CARD=sndrpihifiberry.

I was afraid of that. You did have agent on on the Pi? (I think it automatically comes on when you start bluetoothctl though).

I can only suggest wiping the pairing (ie remove the devices) from both Samsung and Pi and trying again.

With the proposed changes to SystemD service, my Android phone did successfully playback audio on the DAC.

But the TV still does not see OSMC at all :cry:
Pairing other BT audio devices (headphones) to the TV works as expected.

After you enter discoverable on in bluetoothctl, do you see any messages that suggest the Samsung is trying to connect?

Unfortunately no, there is no activity coming from the TV. But this seems logical to me, as OSMC is not listed at all on TV as an available BT device.

One thing that is strange to me is, why would Android pick up OSMC as available, but TizenOS and MacOS do not? Can it me something regarding advertised BT profiles that makes Samsung and MacOS ignore the device? :thinking:

BT is voodoo to me but I thought devices ought to recognise each other even if they don’t have compatible profiles. They’re all required to have a profile that advertises what they do. Very strange.

I wondered if Samsung was rejecting OSMC because bluez-alsa is both an audio source and a sink, but still I would expect to see something in bluetoothctl. For the record, I’ve successfully sent audio between two OSMC devices in both directions. As you have found, it matters which device initiates the pairing so that they can agree in which direction the audio goes. Still, you could try taking out -p a2dp-source from the ExecStart line in /lib/systemd/system/bluealsa.service.

Another idea: do you have a BT USB dongle you could try in the Pi?

Removing -p a2dp-source unfortunately did not change anything.
I am already using an external USB BT adapter. It is configured as my main and only adapter. The built-in RPI adapter is disabled using dtoverlay property in config-user.txt.

Maybe try the built-in one then?