google / oboe

Oboe is a C++ library that makes it easy to build high-performance audio apps on Android.
Apache License 2.0
3.72k stars 571 forks source link

Request: Some documentation for low latency wireless #414

Open ShariqM opened 5 years ago

ShariqM commented 5 years ago

I'm trying to see what's the lowest latency I can get with the LiveEffect app using a pair of wireless earbuds. I think this essentially just depends on what bluetooth profile and codec I use but some more documentation on this would be nice. I see a few options:

1) From this document [1] it seems like I can get 20-30ms latency if I use the HSP or HFP bluetooth profile. Those are designed to use the low quality audio codec CVSD which I'm ok with using. Is it possible to use this inside an Android App? Or is this something that is only for phone calls and is impossible to use with audio recorded in an Android App?

2) Google is developing Audio Streaming for Hearing Aid (ASHA) [2] which I'm guessing is partly a new bluetooth profile. I couldn't find much information about latency but from the best connection interval numbers it seems like it could be under ~30ms. Is there any more information about this? Can an Android App use this profile? I understand I would need a specialized earbud receiver to decode this data.

3) If I must use the A2DP Profile then it seems like the best option is to use the aptX-LL codec which has a latency of ~32ms [3]. Unfortunately Android doesn't seem to support aptX-LL (though it supports the other aptX codecs). Is aptX-LL ever going to be supported? A workaround for this is to use a aptX-LL transmitter (I'm using [4] + [5]) which works nicely but is cumbersome.

Thanks for any help!

[1] https://www.silabs.com/documents/login/presentations/Developing-Bluetooth-Audio.pdf [2] https://source.android.com/devices/bluetooth/asha [3] https://en.wikipedia.org/wiki/AptX#aptX_Low_Latency [4] http://www.avantree.com/bluetooth-audio-transmitter-avantree-priva-iii.html [5] https://soundpeatsaudio.com/q12-plus-soundpeats-bluetooth-headphones-magnetic-wireless-earbuds-ipx6-in-ear-bluetooth-5-0-wireless-earphones-9-hours-playtime-aptx-ll-cvc-8-0-10mm-drivers.html

dturner commented 5 years ago

@philburk Any guidance here on obtaining the lowest latency audio over Bluetooth?

The only thing I have to add is that you may be able to measure the output latency using the same method as the hello-oboe sample, relevant code is here

dturner commented 5 years ago

@ShariqM I don't have much experience with Bluetooth audio profiles so have requested more info from Android Audio team