Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Audio Latency Workarounds

So anybody worth their salt in the android development community knows about issue 3434 relating to low latency audio in Android. For those who don't, you can educate yourself here. http://code.google.com/p/android/issues/detail?id=3434

I'm looking for any sort of temporary workaround for my personal project. I've heard tell of exposing private interfaces to the NDK by rolling your own build of android and modifying the NDK.

All I need is a way to access the low level alsa drivers which are already packaged with the standard 2.2 build. I'd like to have the ability to send PCM directly to the audio hardware on my device. I don't care that the resulting app won't be distributable over the marketplace, and likely won't run with any other device than mine.

Anybody have any useful ideas?

-Griff

EDIT: I should mention, I know AudioTrack provides this functionality, but I'd like much lower latency -- AudioTrack sits around 300ms, I'd like somewhere around 20-30 ms.

like image 574
Griffin Avatar asked Nov 17 '10 00:11

Griffin


People also ask

How do I fix audio latency?

In particular, look through your soundbar's menu for equalizer settings, presets like “movie” and “sports” mode, dialogue enhancers and volume levelers, or features like “virtual 3D” surround sound. Turn them all off, and you should find the delay is much smaller, if not eliminated.

Which audio latency is best?

Around 15ms to 20ms is what you'll get off of 2.4GHz, which is fast enough that you won't even pick up on any lag. Compare that to Bluetooth, which sits around 200ms of latency and can go even higher depending on what device you're using.

Will more RAM reduce audio latency?

In some instances, more RAM makes better sense. In other cases, you will see better results going with a higher frequency and less latency. You may also notice a difference depending on which operating system you run.


1 Answers

Griff, that's just the problem, NDK wil not improve the known latency issue (that's even documented). The hardware abstraction layer in native code is currently adding to the latency, so it's not just about access to the low level drivers (btw you shouldn't rely on alsa drivers being there anyway).

like image 171
dljava Avatar answered Nov 07 '22 15:11

dljava