[TESTING] Bluetooth audio streaming (A2DP)


#721

[quote=“sam_nazarko, post:720, topic:9116, full:true”]
Have you disabled the internal Bluetooth?

What application are you using on your phone? Have you tried with another Bluetooth
device temporarily?[/quote]
Yep, dtoverlay=pi3-disable-bt is in config.txt.
I tried different applications, Amazon Music and Google Play Music. Both work fine with my BT Earphones as well as the BT adapter in my car, both with A2DP support. Also no issues with a small BT speaker.
I have no other bluetooth sending device with A2DP support available to test with, but due to the other devices working flawlessly, I would not assume it is the sending device (OnePlus X by the way).

Now switched back to my Inatek BT dongle since it at least works except for the small cracking every now and then.

What I noticed is that I cannot trigger the pairing from my phone, I have to enable discovery in osmc, select my phone there, trigger “Pair with PIN” which then works fine. If I try to intiate pairing from my phone it doesn’t work.
I also tried to enable or disable contacts access when pairing on my phone, does not matter.


#722

I had a problem with Spotify some time ago sending some very out of spec sample rates
from a Samsung Galaxy S6 in 2015.

I don’t have an Android device anymore; but I’ll see if I can replicate the problem with those applications on my iPhone.

If you have another phone or tablet you can test with, it would be greatly appreciated. It would also be good if you could test this with a local music file that is situated on the device’s internal storage.

Sam


#723

Unfortunately no other phone available right now, I will see if I can organize one.

I tried now different MP3 files using PowerAmp locally, following observation:

44.1kHz 320kBit/s fixed bitrate:

  • The Inatek dongle works fine, no cracking
  • The osmc dongle has some cracking, but no significant skipping

44.1kHz variable bitrate (~200kBit/s):

  • The Inatek dongle works fine, no cracking
  • The osmc dongle has cracking and skipping

48 kHz variable bitrate (~256kBit/s)

  • The Inatek dongle has cracking sounds like with Google Play Music
  • The osmc dongle has cracking, significant skipping and accelerated playback
    –> Here both behave very similar to what Google Play Music and Amazon Music show

By the way, no significant CPU usage visible during playback. But accessing the bluetooth settings in osmc during the stuttering playback is very slow.

I will see how to get another device for sending, to compare it, will let you know.

EDIT: Connected my laptop, playback works without issues (using Amazon Music on Win10 on it), but it does not show any title information in osmc and I also cannot tell if it’s using A2DP or some kind of BT lossy encoding (don’t know how to see it). Will check further…
Once I have some time, I’ll try a clean osmc install with only the bluetooth streaming enabled to see if it might be some kind of setup on my osmc install.

EDIT2: Tried my quite old phone using the 48kHz MP3 in Poweramp, same behavior. So it’s most likely not the phone that’s causing the issue.

EDIT3: Fresh install of osmc using installer, boot on pi3, update to august release, set up wifi, disabled onboard bluetooth, installed the a2dp as written in the first post here, reboot.
–> Same as before (cracks, stutters, speed changes of audio with the osmc dongle), so it’s also not my older installation that’s causing this behavior.
Is there a way to output the BT sink to the earphone plug on pi3 so I could eliminate HDMI as a possible reason?

EDIT4: Did a “sudo systemctl stop mediacenter” but that didn’t help either. So kodi is not the source of the issue as well. I guess it might be a combination of certain audio stream formats together with the dongle(s) and drivers.
Anybody here using Google Play Music or Amazon Music successfully by streaming from an android phone to osmc?

EDIT5: I followed this discussion on pulseaudio:
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/405294
Installed b43-fwcutter and firmware-b43-installer, reboot, turned wifi off on my Pi3 -> No more stutters/dropouts, only cracking sounds which is significant improvement but still not fully fine. Not sure if the installed packages did anything on that.
I would guess it has to do with wifi coexistence: https://github.com/raspberrypi/linux/issues/1402

EDIT6: I’ll continue using my Inateck BTA-BC4B6 which works fine except for very tiny cracking sounds. I’ll have to see whether it has to do with my sound setup (like keep-alive to the AVR configured in kodi). According to some pages small cracking sounds might come from power-save features of soundcards.

The difference between the Inateck and the official osmc BT dongle is huge which is a bit unfortunate. Sam, please let me know if I can help with more information or testing.


#724

Does this autoupdate?


#725

If you update OSMC when prompted yes.


#726

I tried to pair Xiaomi Bluetooth receiver but somethings it seem doesn’t work. The receiver was paring but the led of receiver continuing red Blue pulsing… And when i tourn off the receiver and then tourn bin the receiver doesn’t work… I use and correctly functioned Aukey EP-B4.


#727

Try with the official OSMC BT dongle.


#728

With CLS Bluetooth 4.0 stick nano the aukey headphone EP-B4 working pefectly but with xiaomi receiver Bluetooth doesn’t work. Are there Command line from terminal?


#729

I’m not sure how it will remedy the situation.

If one receiver is problematic but the other isn’t, you may have your answer…


#730

bluetoothctl


#731

Ok. but to pair?
Thanks


#732

bluetoothctl can be used to discover, enable, pair,… what ever you want to do.


#733

I tried to use bluetoothctl for paring and connecting but somethings not work correctly. The led of xiaomi Bluetooth receiver continue with red and blue led. everytime that i turn off Xiaomi receiver and then tourn on, audio doesn’t work…


#734

Hi guys, here’s my issue (system fully up-to-date, bluetooth speakers successfully paired):
Selecting the ALSA output device only has the effect of introducing a delay of a second or two, but sound is still sent via HDMI. No bluetooth output whatsoever. Switching back to PI:HDMI removes the delay.
Any ideas to explain this behavior? I would have expected no sound at all if there was an issue with BT connectivity when on ALSA.


#735

What’s the exact name of the output you have chosen

No this is the design when BT speaker not connected it will output to HDMI and to BT automatically when they are connected


#736

The complete name for the device is “ALSA: OSMC streaming to Bluetooth speaker / headphones”.
My OSMC - Network - Bluetooth shows my device as paired (blue icon).

I understand the fallback to HDMI but fallback to HDMI + delay is strange, isn’t it?


#737

No that is not strange, the delay comes from the usage of pulseaudio which is used when using "ALSA: OSMC streaming to Bluetooth speaker / headphones"
So now the question is to figure out why your bluetooth speakers are not detected evenso they are showing as paired. Are they paired and connected?
I would suggest that you provide debug enabled logs maybe we find something alternatively check with bluetoothctl if the speakers are paired and connected!


#738

Please find my log here. Sorry for the CEC input noise.
Workflow: I’m in the OSMC network menu, then I pair my device (the JBL Clip - line 35 in log). I then go to settings and select the ALSA output. Al line 147 I apply the settings. I then exit settings and play a video. Sound is output through HDMI, nothing through BT.


#739

Ok, will have to fire up my bluetooth speakers in the next days to compare the log entries.
Maybe in the meantime provide full logs via grab-logs -A so that I can see the full system view.


#740

Thanks for introducing A2DP!
It works fine with a RaspberryPi 3 + LOGILINK BT0037 Bluetooth-Dongle.
Once again, great job! :slight_smile: