Delay in BGM

Hello everyone, I have a small but very frustrating problem and I don't know how to solve it, this is:

BGM DELAY.

This consists of the Sound Tester and the game test, the BGM sounds a little after having entered said map or in the case of the menu when the game has been started.

(Sorry for my English I use a translator, thank you)
Do you mean the automatic BGM for each map? Or are you trying to use an event or script?
Automatic BGM.
Does it happen for all BGMs, or only specific ones? If it's only happening for specific BGMs, check their properties, e.g. duration, bitrate, and compression ratio:
  • Audio with high compression takes longer to decode after loading from disk.
  • Bigger files usually take a little longer to load/decode.
If you want to use long BGM tracks with no noticeable delay, maybe look for a "preload audio" or "streaming audio" plugin.

Alternatively something like this might help for automatic map BGM (untested):
[Edit: actually, this may not help at all, because BGM autoplay happens after the scene starts. 😴]
Spoiler: plugin code
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc Scenes wait for requested audio to be ready before starting.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/158429/
 * @help Free to use and/or modify for any project, no credit required.
 */
void (function(alias) {
'use strict';

  const allBuffers = function() {
    return [
      AudioManager._bgmBuffer,
      AudioManager._bgsBuffer,
      AudioManager._meBuffer
    ].concat(
      AudioManager._seBuffers,
      AudioManager._staticBuffers
    );
  };

  const isAudioReady = function() {
    for (const buffer of allBuffers())
      if (buffer && !buffer.isReady())
        return false;
    return true;
  };

  Scene_Base.prototype.isReady = function() {
    return alias.apply(this, arguments) && isAudioReady();
  };

})(Scene_Base.prototype.isReady);
It does not remove the delay, it just tells the game to wait until all requested audio is ready to play before starting a new scene (e.g. a new map).
It's possible some of the tracks you use have a lot of quiet or silence at the beginning. Are they BGM tracks that came with RPG Maker, or something else?
@WilmerGG As you can perhaps guess after the answers above, your description it too vague to allow us to pinpoint which of several possibilities is the true cause.
The better and more detailed a description is, the easier it becomes to solve the problem.


That said, there is a very high chance that what you're experiencing is loading delay - any music file has to be completely loaded before it can be played.
If that is the case you can either reduce the filesize (make the audio shorter, compress it with a better program or similar), or you have to change the way it is loaded (preloader plugin, streaming plugin).

The second group of options is the more complex one however, only go there if you have some experience with those programs and plugins.

Original thread: https://forums.rpgmakerweb.com/threads/delay-in-bgm.158429/