This forum is read only and just serves as an archive. If you have any questions, please post them on

6 years ago by Donzo


I am making a game with like 10-15 mb in music files.
Some of the files won't be played till much later and
preloading them is causing the game to load slowly.

What is the best way to load music files at runtime
so that they are available when the player reaches later levels?

Any help would be appreciated.

6 years ago by Joncom

You don't have to preload songs. You can just create (and therefore load) a new sound on the fly as needed.

var song = new ig.Sound('path/to/song.mp3');

Remember, if you define a sound as a class property, it will be preloaded. If you define a sound somewhere else, like an init or update function, it will be loaded at runtime instead.

6 years ago by Donzo

Thanks, Joncom.

So, if I run a sound file at zero volume early on in the game,
I can re-run it later at standard volume and it will be cached?

I'll give this a shot.

Thanks again.

6 years ago by Joncom

No need to specify "zero volume". Simply load the audio file, but then don't call play() right away.

6 years ago by Donzo


Page 1 of 1
« first « previous next › last »