Skip to main content
Inspiring
May 6, 2011
Question

Best settings for Audio + play() latency

  • May 6, 2011
  • 7 replies
  • 12180 views

Can anyone reccomend the best audio settings/audio export settings to use for game sound effects in android and/or iOS.

I have done a little bit of experimenting, but not sure on the best to use yet.

my concerns are performance, size, and of delay when calling play()

The delay when calling play() is still very present for me on android.I have tried many settings, wavs and mp3s. Hopefuly i am doing something wrong here...

This topic has been closed for replies.

7 replies

Inspiring
May 4, 2013

Let's be clear:

1) There is "acceptable" latency of the order of half a sec or so ( often less ), which according to the post by Holgate, #7 above, is an issue with -- some versions of ( ? ) -- Android ( not Air specifically ).

2) Then, there is unacceptable delay, which appears to be specific to Air on some Android devices ( particularly Nook Color and Kindle Fire ), where a sound will sometimes play in near sync ( with "normal" Android latency ), and sometimes with a delay of SEVERAL SECONDS ( like 5 or 10, in one of my apps! ), which apparently has something to do with garbage collection ( Holgate post #14, above ).

I can confirm that the unacceptable delay has NOT been fixed as of Air 3.6, testing on Nook Color and Kindle Fire, though it is fine ( no delay ) on the Nexus One.

As pointed out in another forum, playing all your sounds in a silent loop, will prevent sounds from being garbage collected, and will eliminate the delay issue whenever you play a sound, like so:

private function initSounds():void

{

     var silentSndXF:SoundTransform = new SoundTransform( 0 );

     _sound01.play( 0, int.MAX_VALUE, silentSndXF );

     _sound02.play( 0, int.MAX_VALUE, silentSndXF );

     _sound03.play( 0, int.MAX_VALUE, silentSndXF );

     // Note: int.MAX_VALUE is about 2 billion, so even a very short "click" sound of 1/20

     // of a sec would play for 3 years or so -- if the app was never closed !!

}

private function onButtonClick( evt:MouseEvent ):void

{

     _sound01.play();

}

This hack eliminated the severe delay I was getting on Nook Color and Kindle Fire ( several seconds for some sounds, in some situations ), leaving me with the "regular", acceptable Android latency.

Known Participant
April 24, 2012

Count us in. We're seeing pretty bad sound latency on Nook and Kindle Fire too.

Inspiring
September 1, 2011

Just to put in a current two cents: this is happening still. Hope someone addresses it as it makes any sort of game - or for that matter any UI - pretty amateurish looking/sounding. I am using Flash CS5.5 and Air for Android and running the app on a Galaxy Tab 10.1 with Air 2.7.1.1961. I see terible delays in sound effects playing. Like more than 1/4 second delay on a sound effect tied to a button press. And even worse on the in game FX.

Any word on a possible fix any time soon?

boat5Author
Inspiring
June 20, 2011

yes i also hope adobe can come up with a fix, I also was thinking we might be able to create a work around when air apps get the ability to call native code...which i think might be out later this year.

boat5Author
Inspiring
June 17, 2011

Yes issues is still the same.

Motorola DroidX

Participating Frequently
June 19, 2011

I'm having the same problem and it will stop me from using Flash Builder to develop a music-oriented application.

Is there any progress on this?

Colin Holgate
Inspiring
June 19, 2011

I checked the bug I reported exactly a month ago, and it is still listed as unverified. I've asked if the bug report could be moved to somewhere that it might be seen.

Meanwhile, could you not perfect your app for iOS, and then either Android will have improved by then, and you ship the app for both, or it hasn't improved, and you just make your fortune off of the iOS version?

relaxatraja
Inspiring
May 18, 2011

I do attachments in the packager for iphone for external mp3 and use sound class within my main fla. Not faced any issues on delay.

Colin Holgate
Inspiring
May 18, 2011

The key difference is Android. The Android OS has a built in latency that can be up to one second long. Typically it seems that sounds happen half a second late. Not sure if that will be improved in future Android OS.

May 18, 2011

I don't mean to sound snide, but obviously the difference is Android, and obviously the AIR player (not Android itself) is the problem, since native sound works great.  My questions remain:

- No workarounds yet?  With the number of people claiming to have 'released' software for Android, I expected that someone had found one, but that doesn't seem to be the case.  Every one I've found suffers this problem.

- No word from Adobe on cause or correction?

This basically keeps AIR for Android in the realm of 'toy' instead of legitimate platform.  Wish I'd known it before I'd started an implementation.

relaxatraja
Inspiring
May 8, 2011

Have mp3 as an external file with the minimum of 64kbps

May 17, 2011

relaxatraja, you can confirm you have acceptable levels of latency?  What Android device and what version of Android?  I have tested this with countless sounds and phones, and have a half second latency on every sound after the first that plays.

boat5Author
Inspiring
May 18, 2011

same here, it makes me cry... well almost