As you might have heard, Android does not provide with low latency audio API. What I mean by low latency audio is that you should be able to get audio signals from microphone and play the sound without much time gap in-between (e.g., 5-7 ms)
I’ve tried old java (with AudioRecord and AudioTrack) and “new” OpenSL ES. They are terrible and make app unusable.The issue was well documented here. BTW, iOS API can produce about 5-7 ms latency.
Looking for Workarounds:
But I am trying to do the low latency audio anyway. Something like this answer describes.
“However, I was only able to achieve this satisfactorily by writing my
own code that did the mixing internally and accessed the low-level
audio playback API only for playing the final mixed output. The
higher-level ways of playing sounds in the .Net Compact Framework are
theoretically capable of polyphony, but in practice they work horribly
(lots of glitches, stuttering and distortion).”
Does this make sense for Android? An answer is discouraging.
So my question. Is there really no way to achieve 10 ms audio latency with Android?
To be honest, I am not expecting a solution in some time soon but just wish one great mind have answer to this problem.
android 4.1+ has low latency audio api which should give you below 10ms latency. however the value varies by hardware (welcome to rich diverse world of android).
also feature descriptor of “android.hardware.audio.low_latency” can be used for filter out devices lacking low latency support.
There is currently no way to get low latency audio on Android devices without modifying the operating system, and even then a lot of the latency can come from the hardware implementation, so the software can’t fix that. This is sad since the Linux kernel is very capable of <5ms audio latency, and much ARM hardware is capable of decent latency. I had a custom Linux build running on an old Palm TX and that actually had pretty decent latency.
as follow up the feature of
android.hardware.audio.pro starting in Android 6 promises <20ms round trip times, which we can hope to mean <10ms one-way.