MV Any plugin or way to randomize BGMs or have a music playlist?

I'm gonna have the player walk around the same town doing a bunch of stuff most of the time, and I want to actually change the music up, like have one track after the other. How can I do this?
just use event autro run -> random variable -> play BGM -> erase event
just use event autro run -> random variable -> play BGM -> erase event

i would do that, but that would just play ALL bgms, right? I want to change up the list of the songs later on, though, so I need to play random BGMs from a set/playlist of BGMs.
i would do that, but that would just play ALL bgms, right? I want to change up the list of the songs later on, though, so I need to play random BGMs from a set/playlist of BGMs.
That random variable won't play all bgms, you should combine it with conditional branches.

For example, name your BGM in audio folder -> song1, song2, song3, and so on.
Set an event -> random variables 1 - 12 -> name that variable "random song"
-> and make conditional branches : random song = 1 to play song1, random song = 2 to play song2.

Now you can freely add your song later, just name it song1, song2, and overwrite
the old ones. Hope that helps. 🙂
i dont think there's a conditional branch for when the song ends. since bgm are designed for loops. so you will need a plugin. the auto run event is just to play a random song when entering a map.
As I understand it, you want that when the song ends, the next one starts right after.

I don't know if it is easy to find out the final position of BGM.
Here is a post that I was showing you how to use the RMMV function that controls the WebAudio API:

One idea I have is to check when the "POS" of the range returns to zero, so just use an IF.
As I understand it, you want that when the song ends, the next one starts right after.

I don't know if it is easy to find out the final position of BGM.
Here is a post that I was showing you how to use the RMMV function that controls the WebAudio API:

One idea I have is to check when the "POS" of the range returns to zero, so just use an IF.

Yeah, I want to play the next song after the one that's on ends. I'm very new with all of this so I'm very confused with everything. I read that thread, too and I'm still very much confused.

i dont think there's a conditional branch for when the song ends. since bgm are designed for loops. so you will need a plugin. the auto run event is just to play a random song when entering a map.

yeah I want to make the same song playing between mapchange and also, when that song ends, randomly play another one from a list of songs.

That random variable won't play all bgms, you should combine it with conditional branches.

For example, name your BGM in audio folder -> song1, song2, song3, and so on.
Set an event -> random variables 1 - 12 -> name that variable "random song"
-> and make conditional branches : random song = 1 to play song1, random song = 2 to play song2.

Now you can freely add your song later, just name it song1, song2, and overwrite
the old ones. Hope that helps. 🙂

I'll give that a shot!


Tbh I don't care if they're playing AS bgm, but the songs will act as BGMs, so maybe there's more flexibility in adding them as sounds?

I just want it to act like a music playlist set to "random".
actually if you know the length of song, you can store them in a variable, since there are many timer plugins. if song 1 is 2 min long, set timer to 2 minutes, when timer variable is zero, random number, play that song.
the best way will be using hash array not sure how to set them up, then just use script calls.
actually if you know the length of song, you can store them in a variable, since there are many timer plugins. if song 1 is 2 min long, set timer to 2 minutes, when timer variable is zero, random number, play that song.
the best way will be using hash array not sure how to set them up, then just use script calls.
oh, that sounds like a viable way to do it! thanks! I will have to make a bunch of variables, though, since there'll be a lot of songs that last different times each one.

i'll search around for a timer plugin and check if I can do it.

thanks
i think you only need 1 variable for the song length, you just need to change its value every time you pick a song to play.
If you use Loop you will need only one variable:
Code:
◆Comment:Track 1 - Restart time-count
◆Control Variables:#0002 Track-Length = 0
◆Play BGM:Field1 (90, 100, 0)
◆Loop
  ◆If:Track-Length > 4140
    ◆Break Loop
    ◆
  :End
  ◆Wait:1 frame
  ◆Control Variables:#0002 Track-Length += 1
  ◆
:Repeat Above
◆Comment:Track 2 - Restart time-count
◆Control Variables:#0002 Track-Length = 0
◆Play BGM:Field2 (90, 100, 0)
◆Loop
  ◆If:Track-Length > 4320
    ◆Break Loop
    ◆
  :End
  ◆Wait:1 frame
  ◆Control Variables:#0002 Track-Length += 1
  ◆
:Repeat Above

Every 1 second equals 60 frames, so every minute has 3600 frames.
If a song is 1:09 you will need to use the calculator:
9 x 60 = 540

Then add the minutes of the song:
540 + 3600 = 4140

Another example, a 2:15 tempo song:
15 x 60 = 900
3600 x 2 = 7200
900 + 7200 = 8100


This calculation does not work with songs with altered speed in the game.

The big problem with this method is that it does not work with the menu open, as the parallel process is in standby mode.

You can use "Fade Out" to trick the player's ears, you will need to calculate the number of frames over time and subtract from the total time value of each song.
If the "Fade Out" has 3 seconds:
60 x 3 = 180
Track 1: 4140 - 180 = 3960



Hence create a "Conditional Branch" that verifies the exact moment:
Code:
◆If:Track-Length = 3960
  ◆Fadeout BGM:3 seconds
  ◆
:End
◆If:Track-Length > 4140
  ◆Break Loop
  ◆
:End

About the WebAudio API, in this case it would really be necessary to develop a plugin that would control the current BGM system. And currently I don't know anyone who is studying this that could create such a system.
@Dev_With_Coffee
Thanks! Tbh, this sounds way too complex for my level of rpgmaker knowledge. I could follow you until the fade out part.
The video you posted seems to be about mapping, is that the correct video?
For me, the video that appears shows the song being changed.

About the system:
I updated the system today, now it is possible to move on to the next song with a Switch.
The system works in a common event, for music there is another Switch.
Edit: The "Stop BGM" switch was not working at the right time, it is now fixed.

Extra:
I'm still studying the Web Audio API to be able to create a plugin that allows me to list several songs or randomize a list.
I'm sorry to necro this, but this is exactly what I used for my game's soundtrack. It's cool to know that it's the way you pros would have done it anyway. However, I know from experience it has some flaws, or at least it did in VX Ace. For one thing, because the timers are really variables part of parallel processes, things like message boxes, which freeze parallel processes will interrupt the timer and resume once the message box closes, making a mess of the timer. A work around I found was to put the entire contents of the parallel process into a loop, which would keep it running. However, that doesn't help when it comes to new scenes like opening the menu. Is there anyway to keep the parallel process running no matter what scene? I tried Tsukihime's Scene Interpreter for Ace but it didn't work. Best solution I could think of was to save the game time into a variable before the menu was opened then save the game time into another variable once it was closed then find the difference to get the time elapsed, then subtract that from the timer variable. It works to catch the timer up again, but it won't prevent the music from looping if it reaches its end while in the menu.
Necro-post notice: @CurtMerciless

Please start your own thread

Original thread: https://forums.rpgmakerweb.com/threads/any-plugin-or-way-to-randomize-bgms-or-have-a-music-playlist.136347/