• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Best settings for Audio + play() latency

Engaged ,
May 06, 2011 May 06, 2011

Copy link to clipboard

Copied

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...

TOPICS
Development

Views

10.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 07, 2011 May 07, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 17, 2011 May 17, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

Here is nearly two years of debate about audio latency issues in Android, nothing to do with AIR:

http://code.google.com/p/android/issues/detail?id=3434

Here's an article talking about the latency difference between iPad and Android:

http://www.androidannoyances.com/post/38

That article only goes as far as Android 2.3. I have an Android 3.01 tablet at work, I'll test how that does later. Can you suggest any, preferably free, native Android app that requires fast responding audio?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

Those discussions seem to pertain to ultra-low latency, near-real-time sound, like music creation.  The AIR problem that I, boat5 and others see is like this: it plays the sound in a timely enough fashion (not ultra-low, but certainly well under 100ms) the first time it's play()ed, then subsequent playing of ANY sound has a very long (around 400-500ms on my tests) delay before playing.  'Latency' probably isn't even a good term, since it's a truly massive delay.  Wait several (maybe 15 or 20) seconds before calling any play()s again, and it will once more play quickly... but just once, then delayed again.

The best test is to simply make a tiny button-that-plays-a-sound AIR app and load it up on an Android device.  It demonstrates the issue on my Droid 2/Froyo nicely.  It happens whether using the standard object model, or a more game-like looping of the ENTER_FRAME event.  Here's one I did in CS5 that you can use to test.

I've downloaded several AIR-based games, and see the problem in all of them.  The most recent one I downloaded is a Tiny Wings clone called "Dillo Hills LITE".  Click an item in the main menu, and the corresponding sound plays a half second late, after the button animation has already finished.

Compiling a simple sound-playing native app does not have this first-sound-fast/later-sounds-slow problem, and needless to say you can download hundreds of native apps with timely sound.  I don't really see how this could be caused by anything but AIR.

Tested on a handful of phones, from 2.1 to 2.3.  I have not yet tested on tablets or 3, so I'm interested to know what you find.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

I'll try that Dillo Hills Lite and let you know how it goes, and your test file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

Sorry, typo, not tested on 2.1.  I don't believe AIR player runs on 2.1.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

Here you go...

Dillo Hills sound is very slow to respond, but I think it may be that the sound is triggered after the visual effect of going to the next menu.

Your test APK plays the sound sooner than Dillo Hills does, by a long way, on the first playing of the sound. On subsequent plays the sound is laggy, like it is in Dillo Hills.

Trying the swf, or the FLA, has the opposite situation, the sound is late the first time, then instant after that.

On my iPad it's a similar situation, longer delay for the first play, and then almost instant from then on.

So, the longer delay on subsequent plays seems wrong, but the delay of the first play of the sound is comparible, or better, than native Android apps.

I'll make sure the authorities know about the subsequent delay issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

Thanks.  Since Dillo Hills plays the background music first, I'm sure that's counting as the first 'on time' sound, and the effects then lag.

A slow first time would make more sense in the world of Flash and memory, and is easy to cope with.  The later delays are not.  Most of us don't need a 15ms response, we just need it to be fast enough to not look unprofessional.

Let me know who I can contact to help keep the pressure up.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

Colin Holgate wrote:


Trying the swf, or the FLA, has the opposite situation, the sound is late the first time, then instant after that.

     Do you mean playing a swf on a mobile device? When i play a swf on my andriod phone, its the same issue for me as with an air Apk.

      (edit - by "same issue" i mean the original issue, ontime first, and lag on all calls after)

     I also had noticed when testing a few months back, this same pattern happens with flash player on my windows machine playing swfs. Its very very slight, you  really have to be looking for it. First call instant... delayed therafter...wait and its instant again for 1 call.

Its the same issue, but amplified much more on android.

however playing the same swf in flash player 9 or earlier has No delay

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

When I talked about the FLA and SFW, I meant on my Mac, and the first time it plays a sound is slightly delayed compared to subsequent plays. You have to pay attention though, the difference is only slight.

I haven't heard back from questions I've asked, but I read things in public Adobe postings that could hint at some hope. Blogs and conference talks by the Flash team have talked about improved garbage collection in Flash Player 10.3, AIR 2.7, and the Incubator builds. See here:

http://labs.adobe.com/technologies/flashplatformruntimes/incubator/

and here:

http://sonnati.wordpress.com/2011/04/20/more-informations-about-flash-player-11-air-2-7-and-above/

Garbage collection is exactly the kind of thing that could lead to delayed audio, and you can imagine that it could explain why the first time a sound plays there is less lag, as there's no garbage to collect.

So, I would stop worrying too much about audio lag until AIR 2.7 is released. I don't know when that will be, but other public statements from Adobe employees have suggested it's within the next six weeks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 18, 2011 May 18, 2011

Copy link to clipboard

Copied

    Yeah, that's my plan.  It would be nice to at least know they're looking at it.  If it isn't useable in a couple months, I'll arrive at the fish-or-cut-bait moment, and will have to abandon AIR for Android as "not ready for prime time", and go native across all platforms.  Sad.  Especially since the bit blitting and other stuff all works great.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2011 May 19, 2011

Copy link to clipboard

Copied

Can I point to your test files as part of a bug report that the AIR team would look at?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 20, 2011 May 20, 2011

Copy link to clipboard

Copied

Yes, I'll leave it up.  Are you submitting at bugbase.adobe.com?  I was going to do one this weekend but won't if you're already on it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 20, 2011 May 20, 2011

Copy link to clipboard

Copied

I logged it, not there, but somewhere good.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 14, 2011 Jun 14, 2011

Copy link to clipboard

Copied

Hi

You will be pleased to know that AIR 2.7 is released, seehttp://blogs.adobe.com/flashplayer/2011/06/adobe-air-2-7-now-available -ios-apps-4x-faster.html. We have fixed the speex delay issue for iOS to an extent. If you are developing on iOS, please try the new SDK and let us know if the fix works for you.

Thanks,

Sanika

AIR team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 14, 2011 Jun 14, 2011

Copy link to clipboard

Copied

Just updated to 2.7.0.1948 player on my Droid 2 and there is no change at all in the audio performance.  The problem does not appear to have been corrected on Android.  I will pull down the SDK tomorrow and compile with 2.7, but I am not hopeful.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 17, 2011 Jun 17, 2011

Copy link to clipboard

Copied

Yes issues is still the same.

Motorola DroidX

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 19, 2011 Jun 19, 2011

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 19, 2011 Jun 19, 2011

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jun 20, 2011 Jun 20, 2011

Copy link to clipboard

Copied

Hi Colin,

Could you post the bug number here?

Also, has anybody tried it on iOS?

Thanks,

Sanika

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines