I’m assuming you are smart enough to understand the difference between loadStream and loadSound and when to properly load assets. If not, go re-read all the docs. Otherwise, here is Android audio explained in detail.
We have made a continual stream of fixes and performance enhancements behind the scenes to the new audio API since 268. (You only need to monitor the daily build logs.)
However, Android has fundamental problems in their audio system that Google must solve. Since 268, we have tuned the OpenAL implementation on Android to reduce latency as much as we can. For apps that don’t stress the CPU, the latency may be acceptable, but as CPU becomes stressed, Android behavior penalizes audio and latency becomes worse. So depending on what your app is doing, you may or may not be affected by the problems.
Ultimately, the Android problem is two-fold.
-
Their old audio API sucked.
-
Their OS (down to the kernel level) doesn’t provide low enough latency response to do real time audio.
Google has publicly admitted to these problems. And it’s no secret among Android developers…you only have to do a quick Google search to see for yourself:
http://code.google.com/p/android/issues/detail?id=3434
http://kile.stravaganza.org/blog/post/android-audio-api-sucks
http://www.badlogicgames.com/wordpress/?p=1315
http://groups.google.com/group/android-ndk/browse_thread/thread/29f88a99dc954c71
http://mindtherobot.com/blog/555/android-audio-problems-hidden-limitations-and-opensl-es/
http://music.columbia.edu/pipermail/portaudio/2010-December/011146.html
Google has started fixing (1) by introducing a brand new audio API based on OpenSL ES and is accessible through the C layer instead of Java. But this requires Android 2.3 or beyond and the API is still seems to be unstable. But obviously, to ‘fix’ audio on Android requires us to drop 2.2 which we’re not sure our users are ready for, so be careful what you wish for because you might just get it.
Unfortunately, Google has not yet fixed (2). I’ve been told their kernel team, their multimedia team, and their audio team are working on this. But I’m going to assume their problems are fundamental and serious since they have 3 teams working on this. But regardless, the fundamental latency problems must be fixed by Google and is out of our control.
That all said, we feel your pain. We are in the same boat as you. We have done what we can and continue to look for ways to improve performance. In many cases, the new audio engine is usable on Android and you should continue to give it a try and try performance tuning your app. If that fails, you can fallback to the old API, but you lose access to all the capabilities the new audio API gives you (and you are exposed to other bugs/limitations in the old audio API).
[import]uid: 7563 topic_id: 6165 reply_id: 38299[/import]