Bluetooth audio output

Hello there,

my Vero 4K just arrived! I’m trying to configure it in the same way as my ancient laptop is, that means to stream audio through bluetooth. I have read various topics in here, but still no luck.

  1. I have installed the a2dp-app-osmc package.

  2. I have managed pair with the device using bluetoothctl, but unable to connect.

  3. I have started pulseaudio using pulseaudio -D

  4. After that, I have managed to connect to the device using bluetoothctl.

[BM10]# info 4C:21:D0:9F:7F:A8
Device 4C:21:D0:9F:7F:A8
        Name: BM10
        Alias: BM10
        Class: 0x240428
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
  1. Bluetooth device is now visible using pactl list short sinks, whatever that command does.
osmc@osmc:~$ pactl list short sinks
shared memfd open() failed: Function not implemented
0       alsa_output.platform-aml_m8_snd.46.analog-stereo        module-alsa-card.c      s16le 2ch 44100Hz       SUSPENDED
1       bluez_sink.4C_21_D0_9F_7F_A8.a2dp_sink  module-bluez5-device.c  s16le 2ch 44100Hz       SUSPENDED
  1. I have switched to that sink using pacmd set-default-sink 1. It is now stared when I type pacmd list-sinks.

  2. In Kodi Settings - System - Audio - Audio output device, I have switched to Playback/recording through the PulseAudio sound server.

But sound is still playing from the HDMI connected projector, not the Bluetooth audio receiver. Help me please :disappointed_relieved:

Edit: I have also added user osmc into the pulse group. But I don’t know if that changed anything.

I think the latest updates have broken Bluetooth audio. It’s a known issue that’s being looked at I believe.

https://discourse.osmc.tv/t/testing-bluetooth-audio-streaming-a2dp/9116/793

It has been locked 2 months ago. There must be some kind of workaround to make it work, it’s just Linux :slight_smile:

There was a very detailed post a week or so ago that, although it focused on the Raspberry Pi, might give some clues:

Thanks, that looks promising…

Same as Vero, and not platform dependent.

Is there an approximate timeline to get Bluetooth working properly on the vero4k? I appreciate its not an easy fix otherwise you’d have achieved it by now

Does Bluetooth work out of the box on the new raspberry pi 3 b+ ? I could switch to one of those instead

No, the Bluetooth audio issue is not Hardware dependent but just a software audio system issue.
While it also still will have to be seen if the internal Bluetooth of the Pi3B+ is better than the one in the Pi3

Still no luck. I guess my problem si different. I have no “system instance” running on Vero 4K.

osmc@osmc:~$ systemctl status pulseaudio
Unit pulseaudio.service could not be found.
osmc@osmc:~$ systemctl --user status pulseaudio
● pulseaudio.service - Sound Service
   Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-03-24 13:01:08 CET; 6min ago
 Main PID: 2020 (pulseaudio)
   CGroup: /user.slice/user-1000.slice/user@1000.service/pulseaudio.service
           └─2020 /usr/bin/pulseaudio --daemonize=no

Mar 24 13:01:08 osmc systemd[1456]: Starting Sound Service...
Mar 24 13:01:08 osmc pulseaudio[2020]: E: [pulseaudio] shm.c: shared memfd open() failed: Function not implemented
Mar 24 13:01:08 osmc pulseaudio[2020]: W: [pulseaudio] core.c: Failed to allocate shared memfd memory pool. Falling back to a normal memory pool.
Mar 24 13:01:08 osmc pulseaudio[2020]: W: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunc
Mar 24 13:01:08 osmc pulseaudio[2020]: W: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-
Mar 24 13:01:08 osmc systemd[1456]: Started Sound Service.

If I disable autospawn in /etc/pulse/client.conf, pulseaudio output is no longer available in Kodi.

Also If I disable pulseaudio service systemctl --user disable pulseaudio, I can no longer list sinks.

osmc@osmc:~$ systemctl --user stop pulseaudio
Warning: Stopping pulseaudio.service, but it can still be activated by:
  pulseaudio.socket
osmc@osmc:~$ pacmd list-sinks
No PulseAudio daemon running, or not running as session daemon.

However with configuration described in my first post of this topic, I can hear sound from my bluetooth speakers using command speaker-test. Apparently Kodi is the problem.

I’m testing on a fresh install of OSMC on a Pi3, which is my sandbox machine, but I’m seeing the pulseaudio service – which is what I’d expect.

Based on some tests I’ve managed to run, the system-wide pulseaudio.service is installed as part of the a2dp-app-osmc package. If it’s not there, it looks like you haven’t yet installed the package you built.

osmc@osmc:~$ dpkg -l | grep a2dp
ii  a2dp-app-osmc                        1.1.1                             all          A2DP streaming capabilities for OSMC

Did you compile and then install the compiled package? My compiled version is 1.1.0, whereas the version from the repository is 1.1.1.

osmc@osmc:~$ dpkg -l a2dp-app-osmc
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                            Version              Architecture         Description
+++-===============================-====================-====================-====================================================================
ii  a2dp-app-osmc                   1.1.0                all                  A2DP streaming capabilities for OSMC

The system instance of pulseaudio is not included in version 1.1.1.

In the other thread you mentioned @Den4t installed latest osmc 2018-02-01.

Hi Sam !

Made a fresh installation (latest osmc 2018-02-01) with the git-version of a2dp-app-osmc, and here is my dicovering.

However system instance was removed in December. See History for package/a2dp-app-osmc - osmc/osmc · GitHub.

Kinda weird. Are you suggesting that I should use the older version? Like the one from Nov 21, 2017?

The version of OSMC was the latest but the version of a2dp-app-osmc was taken from git, per this post:

as you seem to be willing to tinker with this a bit, I’d recommend you get to where we were before we made changes to try and get it running out of system mode.

apt-get install git build-essential
git clone https://github.com/osmc/osmc
cd osmc
git checkout 27a9e28b6d7224c540424445b45da87096042030
cd package/a2dp-app-osmc
make

Sam was suggesting that Den4t use the previous version of a2dp-app-osmc , which contains the system instance of pulseaudio.

Ok, I will try. Thanks!

It seems to be working. Thanks!

Ehm. Audio is out of sync by 1 or 2 seconds. Not the Bluetooth issue because my laptop with Kodi running on Arch Linux has no such issue.

Can this be fixed without manually adding offset?

PulseAudio has a big buffer, so this is an unfortunate side effect, and why we don’t want to use PA for the long term.