Jay's Variable Mix BGM Manager Version 1.0.2

● ARCHIVED · READ-ONLY
Started by HeroicJay 17 posts View original ↗
  1. Many commercial video games have what is known as a "variable mix". What this means is that the game can pick a track that matches what is going on - but the tracks typically have the same (or similar) melodies and can flow from one to the other. For examples, look at Rare's Nintendo 64 games, or The Legend of Zelda: Skyward Sword's marketplace, or even Mario games that let you ride Yoshi.


    Does that sound like something you want? Well, the first thing is... you'll need the tracks. That's on you, I'm writing enough music for my own game, thanks. Here are the recommendations for the tracks: They don't need to be the same tempo, but they should correspond. Same relative length (in measure count), repeat the same way to the same point, and so on. If the tempo of one track changes, the tempo of the other track should change proportionally. If one track is longer than the other (even ignoring tempo differences), it will try to find the most appropriate place to loop back to when you switch to the shorter one in the part that doesn't exist in the shorter one, which can work in some cases, but don't push it. You shouldn't hit any major errors, but the transition will sound weird if you're not careful.


    Also, you will need to play all variable mix tracks at pitch 100 for technical reasons.


    So play the first track normally. Ahead of time (before! you need it!), with this plugin installed, call the following plugin command:


    LoadVariableMixBGM nameOfTrack [tempoRatio] [volume] [pan]


    This is the track you will be switching to. Hopefully, you should be able to figure out nameOfTrack, volume, and pan. The most notable one here is tempoRatio. You need to put the ratio of the tempo of the track that is currently playing to the tempo of the track you are switching to. Fractions (like "2/3") are okay!


    So if the CURRENT track has a tempo of 144 bpm, and the REPLACEMENT track is 120 bpm, you want to put 144/120 (or 6/5, which is the same fraction). When you go the other direction, make it 120/144 (or 5/6).


    If you don't define the three optional parameters, tempoRatio will be 1 (meaning it's assuming they're the same tempo), and volume and pan will simply match the track that is currently playing.


    Once you've loaded the replacement track, you can switch to it with:


    PlayVariableMixBGM


    No parameters here. You can only keep one track loaded at a time (but you can switch it any time you like. Just remember to give it some time before you play! On my computer, a second is plenty of time. But without that second, there's a bit of sound skipping.)


    BTW, you absolutely can call the exact same track as what is currently playing with different volume and pan settings. This isn't as useless as it might seem; the fadein/fadeout effect will make it more fluid than if you just called "Play BGM" with the different settings.


    EXAMPLE USAGE:


    You have the track "TownTheme", with a tempo of 160 bpm, and the similar "TownThemeIndoors", with a tempo of 120 bpm. (120/160 = 3/4.) You want to play TownTheme when outdoors, and TownThemeIndoors when indoors.


    On the map, put an autostart event with the commands:


    Plugin Command: LoadVariableMixBGM TownThemeIndoors 4/3
    Erase Event


    On the doors to the inside of the buildings:

    Code:
    Transfer Player: (whatever)
    Plugin Command: PlayVariableMixBGM

    Inside each building, put another autostart event, similar to the one you put outdoors:


    Plugin Command: LoadVariableMixBGM TownTheme 3/4
    Erase Event


    And on the doors leading back out:


    Transfer Player: (the outdoor map)
    Plugin Command: PlayVariableMixBGM


    (SIDE NOTE: For this example, you do not want to define map music for any of the maps involved; play the music from another map or an event.)


    If you're REALLY confident that the transition time will cover the load time (and on my computer, it does) then you can just put the load at the beginning of the transfer events and ignore the autostart events.


    THE PLUGIN:


    http://pastebin.com/Wq8SzNs5


    This plugin is free for non-commercial and commercial use, but please credit Jason R. Godding if you use it. Thank you.


    NOTE: In development of this, I had a memory leak at one point. I am 98% sure I killed it, but there's still that little 2% doubt. If you're hitting one (and it's definitely variable mixes at fault), let me know.
  2. Woah, this looks really amazing, and certainly very unique.


    Now I have the urge to implement this into a game, somewhere, somehow...
  3. Edit: Never mind. Was reporting a bug in my own plugin that wasn't really a bug, just a mistake in setup.

    (SIDE NOTE: For this example, you do not want to define map music for any of the maps involved; play the music from another map or an event.)



    Way to follow your own rule, me.
  4. This is fantastic! Looks like exactly what I need for my project.


    One little thing I came across is that you've written in the instructions:


    1.  * And then, later, to actually play the track, call

    2.  *

    3.  * PlayVariableMixBgm

     


     


    You need to use "PlayVariableMixBGM" (note the capitalisation on "BGM".)


     


    This tripped me up for about half an hour before I figured it out haha.
  5. Oops! Sorry about that. Easy mistake to make, and sometimes I forgot what is and isn't case-sensitive. Well, as long as you figured it out.
  6. Thanks for that. This is something impossible to screenshot, and at the time I created this plugin, I was keeping my own game under wraps. (It is used in Marillo in my game demo, but you use a different track for each building from the sound of things, which is better for a demo of the plugin.)
  7. Here's a little trick you can do. Write an alternate version of the track that is just a loop of the track's intro. Then use the Variable Mix BGM Manager to switch over to the main track at a suitably cinematic time, and it won't matter how much the player dawdles on their way through the maps or dialogue scenes beforehand!
  8. Oh, nice plugin! I've just tried the trick you said. I'm using the same base loop with different melodies. It's fantastic. Thanks!
  9. Awesome plugin! Is it also possible to use this plugin within battles to alter/fade/transition the battle music depending on whether you're losing or winning the battle? 
  10. I don't see why not. The plugin doesn't care whether it's called during battle or not. You could define some condition that counts as "winning" or "losing" the battle, check for that condition each turn, and LoadVariableMixBGM once the condition is met.


    The biggest thing to worry about: since it sounds like you want two alternate tracks, you might have to get a little creative with covering load times, since this plugin (to save on memory concerns) only loads one alternate track at a time. Loading a music track doesn't take that long (at least not on my computer), but you want to make sure to give it a few moments. (If you were only using one alternate track, you could load it at the beginning of battle without a problem.) That's not impossible to deal with, though.
  11. Perfect, thank you! Going to go give it a try :)
  12. Wow, this is really great, as an amateur musician this is exactly what I was hoping for. A really valuable niche plugin.
  13. [This post deleted by user]
  14. Hello Jay! This is truly awesome and gave me hope after some time looking for preloaders and anti-lag plugins to make my dymamic music work. Do you still support this plugin? if so, I was wondering if there is any way for me to control the transition time between tracks (the time it takes for the new track to finish kicking in after the PlayVariableMixBGM command). I've been trying to make the transition happen as close as possible to the start of the bar using wait commands but the problem is that I don't know for sure how many frames the transition takes. Thanks!
  15. Strictly speaking, I don't support this plugin so much as its successor (which I have been instructed not to link directly to on this forum, as it's not a free plugin.) For reference, the name of the successor plugin is "Soundtrack Manager".

    You're still allowed to use the Variable Mix BGM Manager as it exists here, I just won't be updating it any longer.
  16. Hi Jay,
    don't know if you're still active. I tried your plugin, but I think it's not what I'm looking for. I need a way to play more than one BGM at once (for example two NPCs sing a song, NPC A sings the melody and NPC B the vocals and if you kill one of them, only the other song remains). I tried to load one BGM the usual way and the other one via your plugin but as soon as the second one starts, the first one stops completly which is not what I want.
    TLDR: Is there a way to play more than one BGM at once with your plugin (or the paid version of it) or not?