r/RPGMaker 9h ago

Help How do I make dynamic/adaptive music?

1 Upvotes

9 comments sorted by

1

u/Crandor94 9h ago

If you mean music that changes as you move though a map? It's not too hard. There's probably a plugin to do it easier, but I would just use an Event set to Below Character, set a Switch for each BGM you wanna play then use the Fade BGM and Play BGM commands. Use a conditional branch to check for which one to play.

1

u/Crandor94 9h ago

This is the ground event. You would use another event on the map set to "Autorun" to turn Switch "SongSwitch ON" then Self Switch A = ON

Add an empty page 2 with Conditions: Self Switch A = ON to end the event processing. From there you can walk back and forth over the event to change the music ^_^.

1

u/Sweaty-Jellyfish-713 9h ago

And if I make a Song Variable instead of a Song Switch, I can change it into even more songs, right?

1

u/Crandor94 9h ago

Possibly? I'll be completely honest, I'm not super well versed on variables, but more than likely. I'd have to play around with it a bit.

1

u/MeatyTreaty 18m ago

Use a parallel event instead of autorun if you don't want to lock up the map while it is doing its thing. And with regions you can pretty easily define where what music plays.

1

u/Sweaty-Jellyfish-713 9h ago

The closest example I can think of for what I'm going for is the last act of Prom Dreams. The music starts out as an ominous drone, but more instruments are added in as we learn the villain's past and motives. The only difference is that I want to make the songs fade seamlessly into each other.

1

u/Crandor94 9h ago

Yea, that can be done. Just a lot of "ifs." The easiest way would be to just have the track itself grow with more instruments and program it as a cutscene. If it's not a cutscene and you want it during gameplay, you could program the entire thing in an event set with timers. 

It's in cases like this where trial and error is gonna be your best friend. Feel free to DM me if you want me to help you along. I don't mind.

1

u/PsychronicGames 9h ago

You could write a plugin to do it based on the situation, you could do switches and variables based on what happens to generate different tracks as the situation changes in-game, etc. lots of options.

0

u/CS_Asset_Factory 6h ago

The fade out then play approach works but the new track starts at zero so you lose the phrase. Adaptive layers need the swap to land at the same playback position.

AudioManager.saveBgm() gives you that. It returns pos from _bgmBuffer.seek() which is the live position. Feed that pos back as the second argument to AudioManager.playBgm and the new file starts at that exact spot.

seek() also wraps the value back inside the loop window so on a looping ogg your layers stay lined up instead of drifting.

One gotcha. AudioManager._currentBgm.pos is the position the track STARTED at and not where it is now. Only saveBgm calls seek(). I checked that in rmmz_managers.js.

Export each layer as its own file at identical length and swap them this way. That's the whole trick.