[Deprecated] [TESTING] Bluetooth audio streaming (A2DP)

I am using the Marshall Mid headset almost daily. It is connected via a BT dongle I had laying around and a Raspberry Pi3. Reconnect is a bit “buggy”. I use a script to connect them:

curl -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue", "params":{"setting":"audiooutput.audiodevice","value":"ALSA:pulse"},"id":1}' http://user:pass@osmc:8080/jsonrpc
curl -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification", "params":{"title":"Audioausgang", "message":"Bluetooth Kopfhörer"}, "id":1}' http://user:pass@osmc:8080/jsonrpc

sudo echo -e "connect xx:xx:xx:xx:xx:x \nquit" | bluetoothctl

Sometimes it works sometimes not. I have to stop the movie before the audio output can be changed. Once connected it works ok. Sound is a little bit tinny but for watching movies at night it doesn’t really bother me. Sound is much better when using the headphones with my smarthone via aptx codec.

Thx @karower exactly the kind of feedback I am looking for, cheers for the script!

Many thanks for all chat and advice esp. to Sam.

Up and running using your OSMC CSR dongle and Layen 4.1 30 pin adapter for Bose Sound Dock. Had a few probs installing the a2dp-app-osmc as when relying Y to “Continue Y/n” it kept aborting. In the end I looked at recommended packages just above the ‘abort’ and installed them individually.

Just one question. Is there a way to see whether it is the BT Dongle or the internal BT that is connected? It would be nice to know.

All the best,

Pgs

If you didn’t disable the internal adapter, then that’s being used

Thanks for that. In that case then the internal BT on Rpi3 works fine to send to LAYEN i-DOCK Bluetooth 4.1 Stereo Audio Adapter.

I will disable internal and use the external anyhow as the overwhelming consensus is that it is better.

atb

pgs

Seem like its connecting properly from this. But the sound fades out and have to do the ole reboot to get it back going but before this move it just appeared to be connected but Im not using a BT just the stock bluetooth on the rpi3

External is only better if using a good Bluetooth dongle.

Yes - I bought the dongle from you some time ago, Christmas time or just after, but only now have had the chance to get things working.

It works absolutely fine - more than happy. (tape over red led).

Interestingly, after the post & reply yesterday I used ‘bluetoothctl’ before disabling on board bluetooth and it indicated that your OSMC dongle had been accepted as the default - both bluetooth MACs shown but next to OSMC dongle MAC starting 00.XX was “[default]”.

I disabled on board BT later anyway.

Many thanks for the whole project.

pgs

Yes – if you use the command line, you’ll be able to select the dongle. However My OSMC only connects using the first attached dongle. This is something we might adjust in the future if there’s demand for it.

Sam

Can anyone advise if Bluetooth audio is working well with the Vero 4k internal Bluetooth yet? I want to stream audio from my smartphone to the Vero 4k and then out the hdmi port to my amp.

It’s been working since the Vero 4K was released in February. It’s still experimental as it is on all platforms but is getting there. You can also remove it fairly easily if it doesn’t work out.

Hi there,
I just tried to use my phone as an A2DP source. In general everything works fine, but I can’t figure out why my Pi is outputing the audiosignal via HDMI only. I checked my settings twice, but couldn’t find a mistake. After that I started Googling and found some posts about similar problems. Now my question: Is there a way to output the signal via the analogue output of the Pi?

Got my Vero4K finally, Bluetooth works OK, I have been testing with crappy Jabra BIZ 2400 II I got from work before buying proper headphones.

At the beginning there was a bit of dark magic in play:

paring/connecting was not working via MyOSMC and bluetoothctl, was getting Failed to connect: org.bluez.Error.Failed, maybe something that helped was sudo apt-get install pulseaudio but it was not working still then out of the blue (tooth) it started to work via bluetoohctl but no via MyOSMC then after some reboot it started to work with MyOSMC

No manual switching for me @sam_nazarko, when I power the headsets it works almost instantly and audio switches to BT, when I power off the BT headset it takes few seconds to switch back to TV

This is with the BT internal adapter with WiFi ac 5ghz enabled (getting my 120Mbps WAN speed so perfect)

I am very happy so far with the box, thank u very much

1 Like

Evening all, just wandering if anyone out there is using hardware as old as mine with a Pi series 1 B?
A2DP works great with the osmc dongle until you try and change songs from the phone (seems to carry on playing from cache or not changing songs for 30 seconds or so unless i switch the phone output to phone and back to osmc) btplayer also doesn’t keep up with the songs playing, it just keeps counting seconds onto the first song it seems, and sometimes it won’t display at all.

The reason for the hardware question is that it gets a lot less glitchy if I dial back the cpu to 750MHz, but then the cpu can’t keep up. Currently seeing if i can have my setup turn a few things off (without going as far as stopping Kodi) to save the CPU.

Solution is likely to be getting my wallet out and looking at a Pi3 or vero so please don’t burn your valuable time digging into this, was just wandering if anyone else was getting this to work with old hardware.

Alistair

It’s been a while since I tested this on older hardware.
The problem is that there’s likely some resampling occurring, which could be causing these delays.

Sam

Evening all. After the august update is anyone else having trouble streaming?

I note that my hciconfig now says Name: ‘osmc’
Class: 0x00041c
instead of 0x20041c which is in audio.conf.
I can connect to bluetooth but my phone won’t recognise it as a sink.
I have re-run the install script but it didn’t change anything.

Alistair

There haven’t been any changes for some months.

Sam

No, all good here

I have still big issues with my A2DP streaming to osmc (august update but also happened on earlier builds) running on my Pi3, powered by the official 2A power adapter. The sound goes via HDMI to my Onkyo AVR which does not have any issues on regular audio/video playback.
I used the Inateck BTA-BC4B6 and had small (but slightly annoying) cracks every few seconds during playing from my phone via bluetooth (osmc being my audio sink).
Bought the official BT dongle for osmc from Sam but it is even worse with big stutters, pauses, then it immediately plays much faster, stops again etc. Totally unusable, it behaves just like the internal bluetooth.

Tried to disable all WiFi (including internal Pi3 wifi) in my flat to avoid interference, tried to connect each BT dongle using an extension cord. Nothing changed either of the behaviour. Of course re-pairing, reboots, disconnecting everything, nothing worked.

It isn’t my phone since streaming to my bluetooth earphones works flawlessly with great quality.

journalctl shows following output which might give a hint:

Sep 07 19:00:51 osmc bluetoothd[394]: /org/bluez/hci0/dev_C0_EE_FB_59_04_C1/fd0: fd(21) ready
Sep 07 19:00:52 osmc pulseaudio[292]: E: [alsa-sink-bcm2835 ALSA] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write!
Sep 07 19:00:52 osmc pulseaudio[292]: E: [alsa-sink-bcm2835 ALSA] alsa-sink.c: Most likely this is a bug in the ALSA driver 'snd_bcm2835'. Please report this issue to the ALSA developers.
Sep 07 19:00:52 osmc pulseaudio[292]: E: [alsa-sink-bcm2835 ALSA] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
Sep 07 19:00:53 osmc kernel: input: C0:EE:FB:59:04:C1 as /devices/virtual/input/input2
Sep 07 19:01:21 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 65490).
Sep 07 19:01:31 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 87634).
Sep 07 19:01:41 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 109202).
Sep 07 19:01:51 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 128338).
Sep 07 19:02:01 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 143506).
Sep 07 19:02:11 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 154770).
Sep 07 19:02:21 osmc pulseaudio[292]: W: [pulseaudio] module-loopback.c: Sample rates too different, not adjusting (44100 vs. 167698).

I have no more clue what to try. Does anyone have an idea what to look for? Any further logfiles? Other troubleshooting?
I’m pretty disappointed to see the official BT dongle to behave even worse than my old dongle…
Thanks in advance!

Have you disabled the internal Bluetooth?

What application are you using on your phone? Have you tried with another Bluetooth
device temporarily?

Sam