Music Tone

This plugin allows you to change music while retaining the same position in the track. This is useful when there are variations of the same "song," like a calm version or an intense version. That way, the music can be more reactive to what is going on in your game. To make the transition less abrupt and distracting, fading is used, so the previous tone is fading out while the new one is fading in.










Script


Patch Notes


v0.2 - Now throws an error if Preload Manager is not on.


How To Use


Bgm files that are variations or tones of each other should have the following file name style:
Name-Tone


For example, you could have Field-Calm for one audio file and Field-Battle for another audio file.


These files should have the same length and same loop points.


You can set the parameters to automatically change tones on battle start and battle end if the respective switches are set.


The fade in/fade out duration can also be set in the parameters.


Plugin Commands:


ChangeMusicTone x
            - x is the tone to change to. It uses the current bgm. For example, if the currently playing bgm is Temple-Normal and you used the plugin command


            ChangeMusicTone Combat, the bgm will be changed to Temple-Combat.


This plugin requires Preload Manager and Web Audio Cache


Within the Preload Manager JS file, you should also preload the BGM tones, like this (read the documentation for the js file for more information):


TDDP.bootPreloadBGM = [
     "Field-Normal",
     "Field-Combat"
]


The reason for this is to prevent the normal delay of music files in default RPG Maker MV.


Future Updates
Allow for an additional bgm on top of the current one as an "overlay" instead of switching.


Terms of Use


Free to use and modify for commercial and noncommercial games, with credit.


Credits


DreamX
Thanks to Zalerinian on Rpg Maker Web forums for code on how to check if a file exists.
Oh wow! I've wanted this for ages! Nice one 😀
Ah, forgot to mention that the plugin requires





and





Within the Preload Manager JS file, you should also preload the BGM tones, like this (read the documentation for the js file for more information):


TDDP.bootPreloadBGM = [
     "Field-Normal",
     "Field-Combat"
]


The reason for this is to prevent the normal delay of music files in default RPG Maker MV.
This is what's called a "variable mix". Just an FYI, I have a version (see my signature) that doesn't require extra plugins (the plugin does the loading of the alternate track) and is compatible with tracks of different tempos, but with my version you can only load one alternate track at a time (though that doesn't mean you're limited to just one alternate track; you just have to get clever with loading.)
This is what's called a "variable mix". Just an FYI, I have a version (see my signature) that doesn't require extra plugins (the plugin does the loading of the alternate track) and is compatible with tracks of different tempos, but with my version you can only load one alternate track at a time (though that doesn't mean you're limited to just one alternate track; you just have to get clever with loading.)

Hmm, somehow I forgotten about seeing that. Nice one.
Don't get me wrong, though - there's no reason you can't develop an alternate version with different features. Using the preload manager to get all the tracks ahead of time is a clever solution, but I'll urge you to be careful about memory bloat; those music tracks don't come cheap! (That's the memory leak I mentioned in my topic - at one point in development, my version failed to clear the tracks from memory, which got costly really quick.)

Original thread: https://forums.rpgmakerweb.com/threads/music-tone.59077/