new audio api is damn slow!

Greeting there,

today i jz change my media.playSound code to audio.play

 -- play sound  
-- media.playSound(gBGMusic.menu)  
 gAudio.bgMusic.handler = audio.loadSound(gAudio.menuBgMusic.src)  
 gAudio.bgMusic.channel = audio.play( gAudio.bgMusic.handler )  

both code are working but the new audio api is super slow!
it waited around 2 seconds with blank screen, i guess it’s loading
while media.playSound doesn’t need that
anyway to boost up the speed for new code? [import]uid: 10373 topic_id: 4468 reply_id: 304468[/import]

Yes, but you’ll run into other problems.

http://developer.anscamobile.com/forum/2010/12/13/audioloadstream-more-resource-intensive-any-way-increase-buffer-size [import]uid: 10835 topic_id: 4468 reply_id: 13999[/import]

You should be using audio.loadStream() for large files like music, not audio.loadSound(). Please read the Additional Audio Notes found here.
http://developer.anscamobile.com/reference/audio-guide
As for IgnacioIturra’s performance problems, we’ll investigate that, but I hope most people aren’t going to run into those problems.

[import]uid: 7563 topic_id: 4468 reply_id: 14172[/import]

I’m finding that the new audio api is very slow for sound effects, as noted in a separate post. The effects are triggering about a second too late. Any idea if this can be fixed?

If anyone from Ansca is looking into this, let me know and I’ll send you a URL for the .apk. [import]uid: 1560 topic_id: 4468 reply_id: 15261[/import]

hi, what ewing said is correct
use audio.loadStream instead [import]uid: 10373 topic_id: 4468 reply_id: 15273[/import]

I’ll give loadStream a try. But these short sound effects are in the 8K to 164K range and the API docs suggest that loadSound is better for that. If that’s not the case, what’s loadSound for? [import]uid: 1560 topic_id: 4468 reply_id: 15275[/import]

I changed the code to loadSteam and it’s not any better. [import]uid: 1560 topic_id: 4468 reply_id: 15278[/import]

loadSound() is the correct API to use for short, lowest latency sound effects.

I presume your problems are limited to Android. We are aware of performance limitations on Android. There are a few things we are experimenting with on Android to improve performance, but the Android audio engine prior to 2.3 has a bad reputation for having unacceptably high latency. Moving forward, we eventually hope to utilize the new engine in 2.3, but right now devices supporting 2.3 are limited and being 2.3 based does not yet necessarily guarantee us better performance depending on how Android and hardware manufacturers implement things.

For now, if you find that the legacy audio API works better for you on Android, you may continue using it for now (though you will be subject to all the existing limitations well known about that API). [import]uid: 7563 topic_id: 4468 reply_id: 15279[/import]