BT audio sync workaround

  • I'm not sure if this is a bug report or an observation, but I'd very much like to know why it's happening and if there's anything I can do to improve the situation.

    [BTW, I'm using the latest LE with Wetek Play2 & Core.]


    My audio output is set to Pulse. I listen almost exclusively via a pair of BT headphones. After powering on my box I connect the headphones via the LE settings add-on. 80% of the time the playback will have an audio lag of a second or so. The 20% perfectly synced playback can't be relied upon for more than 30 mins - at some point the audio stream will be interrupted by an audible glitch which introduces the aforementioned audio lag.

    However, there is a workaround with which I can guarantee the BT audio will always be perfectly synced and infinitely reliable.

    1. Connect the headphones via the LE settings add-on.

    2. Switch the audio stream to HDMI.

    3. Play a few seconds of video with the audio streamed through the TV.

    4. Stop the playback.

    5. Switch the audio stream back to Pulse - I can hear the Pulse audio reconnect to the headphones.

    6. Return to my library and play a video. The audio now 100% synced and undisturbed.

    Why is this happening? And is there an easier and less cumbersome means of obtaining a reliable BT audio stream?

    Thanks for your time.

    Thomas

  • Actually, I still have a drift in my BT headphones on packet loss, f/w 8.2.3.

    Any progress here?

    My current workaround is switching to receiver (or non-connected ALSA) and back to BT using “Audio Profiles” add-on hot key (a script below)

    switching BT-headphones off and on.

    Which I don’t like doing every time I significantly move my head during playback.

    Display Spoiler

    gen.xml Keymap:

    Code
    xbmc.runscript(special://userdata/keymaps/bt.py)

    The script bt.py switching to ALSA then reset back to PulseAudio:

    Code
    import xbmc
    xbmc.executebuiltin('XBMC.RunScript(script.audio.profiles,3)')
    xbmc.executebuiltin('XBMC.RunScript(script.audio.profiles,2)')

    Edited 10 times, last by i3laze (April 1, 2018 at 6:51 PM).

  • UPD: LibreELEC 9.0/Kodi Leia rocks!

    Bluetooth lip sync is in the past now. Kodi v18 compensates BT-connection losses instantly.

    No more increasing delays!

    Edited 2 times, last by i3laze (February 24, 2019 at 2:00 PM).

  • Still impressed how LE 9.0’s PulseAudio skips lost frames and rapidly syncs audio back)

    A small disappointment:

    Kodi “Mute” key doesn’t work for headphones :(

    Could have been useful during the ads.

    P.S. Confused, better tick the thread as “Resolved”.

    Edited 4 times, last by i3laze (April 5, 2019 at 3:46 AM).

  • Sorry to report that it isn't resolved for me.

    I've only just updated to LE9. I've been postponing until Kodi 18 has support for Hue lights. Which it now does with this add-on.

    I still have LE8 on my Wetek Play 2 NAND. LE9 is on the SD card. With both LE8 or LE9 I find that with video playback the BT headphone connection glitches everytime after 20 seconds or so. Post-glitch the audio is at least 1-2 seconds out of sync.

    As my BT headphones are perfect with every other connection, and this is resolved for others with LE9, I was wondering if this is just an issue with the Wetek box. Has anyone encountered this problem with the RPI4, Vim and other SBC with integrated bluetooth?

  • I has the same audio glitches/async/drop offs on my RPi3 with LibreElec 18. I disabled the internal Bluetooth chip and using a modern USB Bluetooth v5 stick. Since no more problems with audio!

  • I has the same audio glitches/async/drop offs on my RPi3 with LibreElec 18. I disabled the internal Bluetooth chip and using a modern USB Bluetooth v5 stick. Since no more problems with audio!

    I have the same problem. I have now got a BT USB stick. I deactivated the internal. How do I get the stick to work? Does it have to be installed? Sorry for the stupid question.

  • Hello again.

    With the BT Dongle the sound is definitely not delayed anymore. That's great.

    What doesn't work anymore is that my BT devices pair automatically. I've added them and trusted them. For example, when I start LibreELEC, they don't connect when I turn them on.

    I just found a bad workaround:

    I created /storage/.config/autostart.sh

    Bash: autostart.sh
    #!/bin/bash
    (
    echo -e "connect xx:xx:xx:xx:xx:xx\nexit" | bluetoothctl
    ) &

    This only works if the headphones are already in pairing mode at startup.

    Is there a nicer solution? Is it because of my BT-Dongle? With the internal BT the pairing worked without problems.

  • Read here:

    Autochange audio output

    Works with Audio Profile Addon, two scripts and udev rules perfectly for me!

    Doesn't matter if i use the internal RPi3/4 or an external USB BT dongle.

    I read that. But if I understood it correctly the script only looks for the BT address of the device. If device XY is online then switch to the defined profile. If device XY is offline then switch back to the normal profile. Is this correct?

    But if the device (my headphones) are not paired, which is my problem, the profile does not change?

    At the moment I have to do this every time before. Settings -> LibreELCE -> Bluethoot -> pair. Only then it works.

    As said before with the BT of the RP3 this worked. What kind of BT-Stick do you have, what brand/type?

  • Upps, you r right. Delete parings. Pair and reboot. Then no auto connect?

    Must look which BT chipset is in the dongle. I'm switched since 3 month to the RPi4 and there i doesn't need the external BT dongle anymore. All fine with the internal Bluetooth now.

  • Upps, you r right. Delete parings. Pair and reboot. Then no auto connect?

    Must look which BT chipset is in the dongle. I'm switched since 3 month to the RPi4 and there i doesn't need the external BT dongle anymore. All fine with the internal Bluetooth now.

    I tried that. Delete it and redo it. It didn't work.

    Under Linux Ubuntu/Mint I often had problems with some chipsets. The one I had now was running reliably under Mint. Maybe the RPi3/LibreELCE does not like this one... ;)

    bt0015.pdf