Latest audio hardware support for Android? (openSL?)

Hello. I eagerly got a Nexus 7 the other month and after testing all our audio apps, non of them were able to do basic audio app functions like simple drum pad, without noticeable delay. Now I know there has been an ongoing problem with Android themselves not being able to put some thought into the audio hardware and falling further behind Apple. I was hoping that after all the hype with the Nexus 7, that they had finally fixed it. They hadnt so I sold the Nexus 7 straightaway. I now learn that they may have fixed it, possibly with their OpenSL or a newer audio library but we can only use this if you support it so Im wondering if this is all true and if you do plan to take advantage of this supposed fix and provide a way for us to use it.If so when? Android tablets are coming out all the time boasting quad cores etc but you still cant make a button make a sound with no noticeable latency.
Thanks
Rob [import]uid: 124886 topic_id: 32494 reply_id: 332494[/import]

Android latency is caused by multiple problems:

  • Android’s audio implementation
  • Android’s kernel implementation
  • Hardware available (both audio and CPU)
  • driver interface to hardware

Android 4.1 supposedly improves things in multiple areas. Running that will improve things, but Android still lags Apple in this area pretty significantly and for sensitive timing, Android latencies are still too high. (Google said this at Google I/O.)

But coincidentally, we have been integrating an OpenSL ES backend for OpenAL and we are trying to get it to appear in the Daily Build right now. Let us know how it works.
[import]uid: 7563 topic_id: 32494 reply_id: 129300[/import]

That is very interesting. I will test on a few devices ASAP and will let you know. Thanks! [import]uid: 124886 topic_id: 32494 reply_id: 129317[/import]

Also, will the Kindle Fire be able to take advantage of these changes or do they use completely different audio systems? [import]uid: 124886 topic_id: 32494 reply_id: 129324[/import]

Android latency is caused by multiple problems:

  • Android’s audio implementation
  • Android’s kernel implementation
  • Hardware available (both audio and CPU)
  • driver interface to hardware

Android 4.1 supposedly improves things in multiple areas. Running that will improve things, but Android still lags Apple in this area pretty significantly and for sensitive timing, Android latencies are still too high. (Google said this at Google I/O.)

But coincidentally, we have been integrating an OpenSL ES backend for OpenAL and we are trying to get it to appear in the Daily Build right now. Let us know how it works.
[import]uid: 7563 topic_id: 32494 reply_id: 129300[/import]

That is very interesting. I will test on a few devices ASAP and will let you know. Thanks! [import]uid: 124886 topic_id: 32494 reply_id: 129317[/import]

Also, will the Kindle Fire be able to take advantage of these changes or do they use completely different audio systems? [import]uid: 124886 topic_id: 32494 reply_id: 129324[/import]

Kindle Fire which is 2.3 based will take advantage of the OpenSL ES backend. However, the Kindle Fire hardware is terrible, so it will continue to be terrible no matter what unfortunately.

[import]uid: 7563 topic_id: 32494 reply_id: 129572[/import]

Hi. Well i have some results back from some tests. I tested two of my apps. Both fairly simple in code. I tested on a Samsung Galaxy S2 (GT-i90100) with ice cream sandwhich 4.04.
Both apps had a version from before and after this update from the daily build to compare easily. There was a noticeably longer delay than before. Almost 1/3 second delay. So its got worse. I understand this est is not on the Nexus 7 but I thought it might have still improved not got worse. I hope to test on the Nexus 7 soon if it will make a difference?
Tested using 2012.943 [import]uid: 124886 topic_id: 32494 reply_id: 129585[/import]

Kindle Fire which is 2.3 based will take advantage of the OpenSL ES backend. However, the Kindle Fire hardware is terrible, so it will continue to be terrible no matter what unfortunately.

[import]uid: 7563 topic_id: 32494 reply_id: 129572[/import]

Thanks for the feedback. I tweaked some things in the OpenSL ES backend to reduce the latency and I think I got it down to where the previous implementation was. It will appear in the next daily build.

Be aware, there is a delicate balancing act between reducing latency and maximizing mixing throughput/quality. By reducing the latency, we expose more performance risk to cracking/breakup/skipping when playing multiple channels simultaneously.

We would appreciate it if your test your programs for both the single sound latency and performance when playing lots of simultaneous sounds and let us know your results compared against the prior builds.

[import]uid: 7563 topic_id: 32494 reply_id: 129605[/import]

Hi. Well i have some results back from some tests. I tested two of my apps. Both fairly simple in code. I tested on a Samsung Galaxy S2 (GT-i90100) with ice cream sandwhich 4.04.
Both apps had a version from before and after this update from the daily build to compare easily. There was a noticeably longer delay than before. Almost 1/3 second delay. So its got worse. I understand this est is not on the Nexus 7 but I thought it might have still improved not got worse. I hope to test on the Nexus 7 soon if it will make a difference?
Tested using 2012.943 [import]uid: 124886 topic_id: 32494 reply_id: 129585[/import]

Thanks for the feedback. I tweaked some things in the OpenSL ES backend to reduce the latency and I think I got it down to where the previous implementation was. It will appear in the next daily build.

Be aware, there is a delicate balancing act between reducing latency and maximizing mixing throughput/quality. By reducing the latency, we expose more performance risk to cracking/breakup/skipping when playing multiple channels simultaneously.

We would appreciate it if your test your programs for both the single sound latency and performance when playing lots of simultaneous sounds and let us know your results compared against the prior builds.

[import]uid: 7563 topic_id: 32494 reply_id: 129605[/import]

I can confirm I have been testing with single sounds triggered with button press. I believe I was still on build 922 (a couple of weeks back) which was running slightly faster. I will make test app with just basic audio play functions just to make sure theres nothing else interfering. Ie pitch, fades etc [import]uid: 124886 topic_id: 32494 reply_id: 129644[/import]

I can confirm I have been testing with single sounds triggered with button press. I believe I was still on build 922 (a couple of weeks back) which was running slightly faster. I will make test app with just basic audio play functions just to make sure theres nothing else interfering. Ie pitch, fades etc [import]uid: 124886 topic_id: 32494 reply_id: 129644[/import]

I have just made a new test and cut everything out now just simple button and play event.
Firstly, I wanted to compare media play to the audio play event which both work on simulator. Tested on android device the media play doesnt work at all.
Secondly, that the audio play latency is still very bad - no improvement. A comparable test with perfect piano which someone suggested to try for instance and that plays much better with low latency. The last update on that app was in May so It does seem possible to have low latency on android but not through Corona it seems which is a shame. This is the same using Gideros mind you so not just Corona. [import]uid: 124886 topic_id: 32494 reply_id: 133872[/import]

Would there be anyway we can get into the audio a bit more. ie buffers ? [import]uid: 124886 topic_id: 32494 reply_id: 133873[/import]

I have just made a new test and cut everything out now just simple button and play event.
Firstly, I wanted to compare media play to the audio play event which both work on simulator. Tested on android device the media play doesnt work at all.
Secondly, that the audio play latency is still very bad - no improvement. A comparable test with perfect piano which someone suggested to try for instance and that plays much better with low latency. The last update on that app was in May so It does seem possible to have low latency on android but not through Corona it seems which is a shame. This is the same using Gideros mind you so not just Corona. [import]uid: 124886 topic_id: 32494 reply_id: 133872[/import]

Would there be anyway we can get into the audio a bit more. ie buffers ? [import]uid: 124886 topic_id: 32494 reply_id: 133873[/import]