Low delay audio on Android via NDK
It seems that this question has been asked before, I just would like t开发者_开发百科o know whether there is an update in Android.
I plan to write an audio application involving low delay audio I/O (appr. < 10 ms). It seems not to be possible based on the methods proposed by the SDK, hence is there - in the meantime - a way to achieve this goal using the NDK?
there are currently no libraries in the NDK for accessing the android sound system, at least none that are considered safe to use (are stable).
Have you done any tests with the AudioTrack class? Its the lowest latency option available at the moment.
Currently 2 main apis are exposed in NDK for Audio: OpenSL (from Android 2.3 Api level 9) OpenMAX AL (from Android 4.0 Api level 14)
A good start point to learn about the OpenSL API in Android is in the samples code of the NDK: look at "native-audio" sample.
Measurement about performances were made in this blog: http://audioprograming.wordpress.com/
As summary the best latencies obtained were around 100-200ms, far from your target. But, from android NDK documentation, the OpenSL interface is the one that in the future will benefit most from HW acceleration to go towards low latency.
精彩评论