There is a delay when I try to play effects on Android

Hi!
I have a problem with playing sound effects on android. In my game player taps rapidly on the screen and after each tap I would like to play an effect. (I am using Cocos2d-x v3.10)

What I do is; On load

this.audioEngine = cc.AudioEngine.getInstance();
this.audioEngine.preloadEffect(res.moveSound);

And I play the effect by using this line;

that.audioEngine.playEffect(res.moveSound, false);

This actually works great on iOS, but on Android there is a bit delay…

My file format is wav, and its duration is less than a second. I know that OGG is a better format for android, but that delay happens again with an ogg file.

I am also playing a background music during the game, but I don’t think that should affect anything.

Am I doing something wrong?

Thanks!

@OscarLeif do you have any idea for this situation?

Sorry I never have that problem before, the only problem that I have with sound are this.

  • No preload the sounds when you play it it makes the game stops for a
    short moment.
  • cannot find I good format for all platforms, sometimes
    in a platform like android mp3 files works well, but in windows 8.1 platforms fails

maybe you should try another file ? or a different settings to the codec ?
I don’t know a lot sound files :sob:

@OscarLeif I actually tried different files. It’s now working with android 4.4.2 and 5.0 great, but users using android 6.0 complaining about the lag. They said they cannot even play it. When they switch the sound off (from menu), they say it works great. I have big problem with the audio engine. I can’t actually understand what the problem is… I will try to implement cricket (http://www.crickettechnology.com/)…

Thanks anyway! :smile:

Am I the only one suffering from this?? :frowning:

I have already published my game and users having android 6.0 are complaining about this problem…

any idea @slackmoehrle ?

I don’t know of anyone having problems with this. If you want to get me an .apk of your game, I can try it on Android 5.x but I am still waiting for my Android 6 device.

@slackmoehrle yeap that would be great. You can maybe understand the problem when you see it on the device…

You can download the .apk via https://www.dropbox.com/s/bujj51c4e27w29c/PierRun-debug.apk?dl=0

As I said before, it works great on Android 5.x. Only Android 6.0 users complained about the problem. Normally on my Android 5.0 device, fps value is something between 50-60. On Android 6.0, 30-40. When they mute the game, fps is between 50-60.

@aleksmutlu I just download and install the game I don’t have a recorder app but when I get the lowest values was 40 fps and it was when I play very very fast right now I don’t have my other phones to test it, Oh right I tested in the LG G4 with android 6

@OscarLeif I am really confused. Did you play it muted or sounds on?

You are not the only one having problems with sound engine in Android. Some devices (like HTC Desire 820 ) will lag when playing sounds. Have tried tons of configurations, both sound engines (SimpleAudioEngine and experimental AudioEngine) and both Android players (Nuplayer and AwesomePlayer). Can’t avoid that lag. If you shutdown the sound then the game works 60fps.

I have read in the forum that Sound Engine is not a priority for the dev team, and I think it should be. Sound is a high priority feature for a game to be enjoying and good feel like.

I love Cocos2D, all my mobile games have been built with this awesome engine, but things like this makes me wonder if it’s the time to step forward and go with Unity.

You won’t believe this, but I recently switched from Unity to Cocos2D, and one of the reasons was that the some Android devices lags when playing sound.
This lags can be fixed in the latest version, but the support previously (within 6 months) responded that this lags for them is not a top priority.