Problem:
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.
But if you want to play a software sampler in real time from a MIDI keyboard, or to hear a processed (by the computer) version of your audio input, you need to strive for low latency. Anything in the region of 10ms or lower is generally considered acceptable. Low single-figure values are quite easily achieved.
We measure latency in milliseconds (ms), and we consider a good latency value to fall between -55 ms to 75 ms.
Audio latency is the delay between that time that sound is created and when it's heard. Having low audio latency is important for several key scenarios, such as: Pro audio. Music creation. Communications.
A smaller latency value simply means that your computer needs to work harder to process all those samples in time. It does not impact the sound quality.
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.
check out http://www.youtube.com/watch?v=Yc8YrVc47TI&feature=player_de%20tailpage#t=1366s
and this: http://createdigitalmusic.com/2012/07/android-high-performance-audio-in-4-1-and-what-it-means-plus-libpd-goodness-today/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With