Stop Music from Stalling Audio?

Get help using Construct 2

Post » Sun Sep 22, 2013 6:37 am

I've noticed that when I start a music loop, it takes about a second for the music to begin playing (when it should begin immediately, like it does in the raw sound file). During that second, all other sounds (short sound effects that worked prior to the longer track starting) don't make any sound, as if they're muted.

Any idea what's up and how to fix it?
B
5
Posts: 15
Reputation: 357

Post » Sun Sep 22, 2013 6:41 am

Yep. Set up an event On Start Of Layout > Preload Sound. This downloads the sound in advance so it plays immediately when you run the Play Sound event.
B
47
S
17
G
82
Posts: 2,231
Reputation: 48,609

Post » Sun Sep 22, 2013 7:14 am

@plinkie

Thanks! So what time is it recommended that songs are loaded, particularly if there are multiple songs, including ones that don't come until later in the game?
B
5
Posts: 15
Reputation: 357

Post » Sun Sep 22, 2013 7:20 am

The recommended time is at the start of layout/ upon layout loading. The only problem that can really arise is if you are preloading lots of audio at the same time as this can slow down browsers, so the recommendation is no more than 2 or 3 audio objects being preloaded at once.

If you find that the preload is still causing a delay, this is because you are preloading a large file. It is best to keep music in the music folder so that it is streamed and have sounds in the sounds folder, which are downloaded before being played. Preload doesn't apply to objects in the music folder.plinkie2013-09-22 07:29:46
B
47
S
17
G
82
Posts: 2,231
Reputation: 48,609


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests