MZ Audio lag remover

The annoying bug from RPG Maker MV is still in RPG Maker MZ and so far, none of the current plugins that are online have worked well for me. Some of the sollutions do not fix the delay on the title screen or they break functionality of some other plugins.

Basically, I just want to play audio, when the audio is supposed to play. Delay should be absolutely minimal or non-existant.
That is neither a bug nor lag - it is loading delay.
Any Audio on any computer can only be played after the audiofile is completely loaded.
That is a technical requirement that cannot be changed.

The easiest solution is to reduce the filesize - if you have long songs then it cannot be prevented completely.
Or you can try to use preload-plugins to tell the game to load a music a few seconds before it is needed, but that only works with very exact control by you - because all preloaders are basically memory leaks by design and will cause more (true) lag if used wrong.
Hi there!
Maybe that one can help you?
Hi there!
Maybe that one can help you?

It doesn't seem to affect audio delay at all.
It doesn't seem to affect audio delay at all.
of course not - as I explained in my post above nothing can change the fact that a file needs to be loaded completely before it can be played.

have you tried something along my suggestions?
Out of curiosity, have you tried deploying with native encryption of audio files to see if that helps?

Streaming audio should certainly be possible, i.e. fetch chunk, start playing, continue fetching new chunks in background.
of course not - as I explained in my post above nothing can change the fact that a file needs to be loaded completely before it can be played.

have you tried something along my suggestions?

I already have preloaded the song and it's like only 3,92 megabytes in OGG format and it still loads too long.
preloaded the song
when did you preload the song? how many seconds or commands before you need it?
If it's already in memory then I wonder if the delay is related to your file's compression ratio. Highly-compressed files take longer to decode at runtime.

I found this RMMV plugin for streaming audio, but I don't know if it'll work in MZ:
when did you preload the song? how many seconds or commands before you need it?

I tried to do on game boot up and I've tried per map, but I don't think it makes a difference. I used the feature in DK Tools for this, as I need DK Tools anyway for the localization.


I need the music as soon as possible ready to be played. Like, at start of the game when title screen appears or when I press play BGM, it plays the BGM when I did that not few seconds later. Delay should be absolutely minimal.


There was this plugin that kinda did what I wanted


but it didn't work on title screens and it seemed to conflict with Visustella (No music playing in Aftermath scenes) and hasn't been updated in ages.


This works slightly better


But it hasn't been updated in two years, comes bundled with tons of stuff I don't care about and has a bug with audio in menus going missing after shor time that has yet to be fixed.

If it's already in memory then I wonder if the delay is related to your file's compression ratio. Highly-compressed files take longer to decode at runtime.

I found this RMMV plugin for streaming audio, but I don't know if it'll work in MZ:

Just OGG format file, both with or without encryption this delay occurs.
My plugin didn't get updated the ignis one, because it didn't need updates. Anyway, the title one I could add, but the visustella as you should know is closed code, so try to see if they can fix it for you.
My plugin didn't get updated the ignis one, because it didn't need updates. Anyway, the title one I could add, but the visustella as you should know is closed code, so try to see if they can fix it for you.

Thanks from the reply! I love your plugin, but was sad to learn about the title screen not loading like that.
You could try to use a Plugin to Skip the Title Screen and create a Titlescreen on a Map with Events.
Thatway you can leave the Screen Black or show a Loading Screen Picture for a few Seconds.
In the meanwhile you preload your Audio so its ready when you show the self made Title Screen to the Player.

Not realy sure if this would help.
I tried to do on game boot up and I've tried per map, but I don't think it makes a difference.
of course not, not handled that way.
I think you need to stop and really think about what a preloader does, and where it is limited.

A preloader can load the resources into RAM before they are used in the game.
But RAM has its limits, and if you load too much you either get memory leaks (if the preloaded files stay in RAM) or the automated garbage collector removes them from RAM (making the preloader useless).
And because of the garbage collector, all preloaders need to be timed correctly or they won't function at all.

1) Title
NOTHING can preload a title, because the program does not run before it is started.
The ONLY way to reduce the loading delay on the title music is to reduce the title music, either in filesize or in music length.
IF your game goes online then you might have some effect by using streaming instead of file loading, but no preloader will ever help you with preloading a title music before the game is started, and that means you will have a delay there if your music is too large.

2) Map
Again, a preload on mapchange is simply too late for something like a background music on the next map.
That is why I asked you how many second or commands you preload before the music is needed.
If you want a preloader for map background music on a map change, then that preload command should be given on the transfer command in the previous map, and even that might be the wrong timing if the music is too long.
Basically the preload command should be given as the first command on that event, then whatever other commands are needed and the transfer command last.
for a music that is extra-large you might even have to make a second event before the transfer event to contain the preload command, to give you those few extra frames before the transfer to load the music, but that is tricky if the player can approach the transfer from multiple sides or if the preload can be triggered without intention to leave the previous map.


Automated preloaders are an oxymoron because of limited RAM.
For a preloader to really function, the developer has to be able to time their preloads to the moments when the files are needed:
too early and the garbage collector removes them from RAM before they are needed (forcing the game to load them again with loading delay), to late and you still have the rest of the loading delay.

Original thread: https://forums.rpgmakerweb.com/threads/audio-lag-remover.146473/