Need help with time delay on mobile

(Solved)
So i solved my solution by putting my timer at 0.49 instead of 0.5 to counter the delay and now everything is on beat.

Im making a game where players will be able to play music files and create a pop song.
How my code works basically:
Theres a timer running at 120bpm, each sound channel is supposed to be played when the timer reaches a certain number (ex. The timer reaches 4 so sound channel 8 plays). On pc it works perfectly, but on mobile it seems that the sounds start playing with a certain delay and nothing is on beat now.

I think actually that the sound plays at the right moment relative to the timer…but i think the timer actually is not exactly 120 bpm on mobile.

I could only submit one picture, but my timer resets every 0.5 sec (so 120bpm)

I don’t think there are problems with the timer. I’m pretty sure the downside is the time it takes to load the audio before playing it. If an audio is not preloaded, Gdevelop loads it right when you give it the action to play it. That is why you notice that there is a delay on mobile, because they usually have fewer resources and require more time to load. On a PC it is faster and that is why you do not notice that delay. What you must do is preload the sounds and/or music that you will use. I’ve sometimes had problems with sound preload actions, so a good method is to play all the songs and sounds at the beginning of the scene on mute. There you will ensure that they are already loaded for when you need to run them at the right volume and time.
Try it to see if that solves it.

I suggest you to preload the mp3 file:

I actually tried preloading sound and it still has a delay. Also, in my game, each time you add a sound it actually starts playing but then stops immediately (i did that specifically for it to load the file) and then when you press play the file will play at a specific time, but for some reaso. still has a delay. My files are wavv. I dont know if that might be the problem.

Have you tried checking out this item in the resources section?


In any case, it has happened to me that the sound preloading does not work correctly.
I don’t want to be pushy, but just to know if the problem is due to the sound loading or something else, have you tried this?

You play the sound you want silently so that it is not detectable.

Don’t play and pause the sound, try to remove that action and try playing the sound silently at the beginning of the game. If this delay only happens to you on mobile devices, I think the problem is the loading time.

i tried it but there is still a delay, i tried almost everything and had to resort to compensate by lowering my timer interval to 0.49 instead of 0.5.

Thanks a lot for your help!:blush:

Can you test this on your device?

As you see i have there play sound and vibration action

I have Samsung a7 from 2018 so like potato phone

And i instantly feel vibration when i touch screen
Yet i do have like almost half sec delay for hearing sound

I do instantly hear it except the first time, but after that i hear it…however i tried preloading my sounds and they still have a delay.

What a shame to hear that. I know that Gedevlop has some things to improve in terms of sound. A few months ago Silver-Streak had reported problems with preloading sounds on Github. I had also seen some isolated problems, including mine, that many times the preload action did not work. I hope this can be resolved soon.

I tested it on both my PC and mobile, and noticed a slight delay on mobile relative to PC, which persisted the entire time I played it (not just at the beginning). This delay is around 1 tenth of a second. While the delay is not huge, it can be significant in another context.

1 Like

Issue is not when YOU hear it
Issue is A LOT of ppl have potato phones
I don’t play on my phone so i don’t really care but that is issue that a lot of gdevelop devs who aim for mobile games will see as huge problem

My GF have (i don’t remember but) some phone made last year
And on her phone i notice pretty much same small delay as you do
Delay on my phone is way longer

So thx for confirming its not only issue related to me and let’s hope it will get fixed in the future

1 Like