Jump to content

Memory usage increases 10x after sound loading


gcardozo
 Share

Recommended Posts

Hi,

I have a folder with 23MB of sounds (including music), all of them are in .ogg format because I need to support really old browsers.

When loading those sounds, memory usage goes up to 900MB. If I comment the lines below, it stays about 90MB.

What am I doing wrong?

 


       

        Controller.numMusic = 5;
        //Load music:
        for (var i = 0; i < Controller.numMusic; i++) 
        {
            let soundName:string = "music" + i;
            this.game.load.audio(soundName, "assets/audios/music/" + soundName + ".ogg");
        }
        this.game.load.audio("menu", "assets/audios/music/menu.ogg");
        this.game.load.audio(ESounds.ACERTOU, "assets/audios/" + ESounds.ACERTOU + ".ogg");
        this.game.load.audio(ESounds.ERROU, "assets/audios/" + ESounds.ERROU + ".ogg");
        this.game.load.audio(ESounds.ANDANDO, "assets/audios/" + ESounds.ANDANDO + ".ogg");
        this.game.load.audio(ESounds.CAINDO, "assets/audios/" + ESounds.CAINDO + ".ogg");
        this.game.load.audio(ESounds.CLICK_BT, "assets/audios/" + ESounds.CLICK_BT + ".ogg");
        this.game.load.audio(ESounds.CLICK_RUN, "assets/audios/" + ESounds.CLICK_RUN + ".ogg");
        this.game.load.audio(ESounds.GRAB_ARTIFACT, "assets/audios/" + ESounds.GRAB_ARTIFACT + ".ogg");
        this.game.load.audio(ESounds.PUT_ARTIFACT_ALTAR, "assets/audios/" + ESounds.PUT_ARTIFACT_ALTAR + ".ogg");
        this.game.load.audio(ESounds.BREAK_ARTIFACT, "assets/audios/" + ESounds.BREAK_ARTIFACT + ".ogg");

 

Link to comment
Share on other sites

 

I have no clue, it will still depend on final filesize come to think of it. For my own game  the music was pretty repetitive, so I would chop the unncessary and have an intro and chorus part and  loop those two using markers. the music went from 800kB to 100kB, but it depends on what kind of music you have if this will work or not. 

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...