Progressive/Layered Music Script for VXAce?

So in the game I'm making there's a puzzle in which you need to collect musical notes that add a voice to the music already playing, like progressive/layered music. Is there a script for that or could that be achieved through eventing?
I've searched for scripts but I've found nothing.

I assume everyone knows what I mean by progressive music, but in case I'm not explaining myself here's an example:

In Skyward Sword's Lanayru desert you could travel back in time. The music would change based on what time period you were in: it was the same melody but with different instruments. Here you have the links:

Ah yes, multi-channel music. I wish this were possible, but the audio engine would need to be different. I know for sure FMOD can handle what you're looking for, but sadly, whatever RMVXAce is using can not, so technically this isn't possible. I wish it was, though!
I would think that whatever you used for the music in the game would need to modified to use variables. so then you can just change a value and it would change what file to play. But that also means you would need a separate file for each song to play.
The RGSS3-engine supports very fast streaming of looping OGG-content without pre-caching the entire file and can also start a BGM at a specified position if you use Ruby-code instead of an event-command.

I don't know and haven't tested if there is any noticeable delay when you swap the track and give it the current position of the previous BGM as its starting-point. But if not, everything you need would be multiple tracks that are perfectly aligned with same format, same basic properties and absolutely same playtime. There will be no fade between tracks.

Ruby:
#==============================================================================
# ** Audio Module
#==============================================================================

module Audio
  #--------------------------------------------------------------------------
  # * Change BGM track and keep position
  #--------------------------------------------------------------------------
  def self.bgm_swap(sf, sv=RPG::BGM.last.volume, sp=RPG::BGM.last.pitch)
    bgm_play(sf, sv, sp, bgm_pos)
  end
  #--------------------------------------------------------------------------
  # * Change BGS track and keep position
  #--------------------------------------------------------------------------
  def self.bgs_swap(sf, sv=RPG::BGS.last.volume, sp=RPG::BGS.last.pitch)
    bgs_play(sf, sv, sp, bgs_pos)
  end
end

How to use:
Ruby:
# Swap the BGM:
Audio.bgm_swap("FilenameOfNewTrack.ogg")

# Swap the BGS:
Audio.bgs_swap("FilenameOfNewTrack.ogg")

Another idea would be to sacrifice the BGS-channel if you don't need it to serve as a second layer of BGM and manually adjust both channels' volume-property all the time so both tracks are playing, BGS' position being synced to BGM's, but one of them sits silent in the background.

~炬燵あ
The last time I tried, bgm_pos was unreliable. It is not based on audio/waveform-sample value, and the value is not increasing steadily as the audio goes, which means it does not give the exact audio position if your goal is to seamlessly transition from one BGM to another. However, it was enough to fool people, and looks like it started from the last position after transitioning from battle.

You could try to see the bgm_pos value yourself. Here
Code:
Audio.bgm_play('Audio/BGM/Battle1', 100, 100)
loop do
  Graphics.update
  Input.update
  p Audio.bgm_pos
end
The RGSS3-engine supports very fast streaming of looping OGG-content without pre-caching the entire file and can also start a BGM at a specified position if you use Ruby-code instead of an event-command.

I don't know and haven't tested if there is any noticeable delay when you swap the track and give it the current position of the previous BGM as its starting-point. But if not, everything you need would be multiple tracks that are perfectly aligned with same format, same basic properties and absolutely same playtime. There will be no fade between tracks.

Ruby:
#==============================================================================
# ** Audio Module
#==============================================================================

module Audio
  #--------------------------------------------------------------------------
  # * Change BGM track and keep position
  #--------------------------------------------------------------------------
  def self.bgm_swap(sf, sv=RPG::BGM.last.volume, sp=RPG::BGM.last.pitch)
    bgm_play(sf, sv, sp, bgm_pos)
  end
  #--------------------------------------------------------------------------
  # * Change BGS track and keep position
  #--------------------------------------------------------------------------
  def self.bgs_swap(sf, sv=RPG::BGS.last.volume, sp=RPG::BGS.last.pitch)
    bgs_play(sf, sv, sp, bgs_pos)
  end
end

How to use:
Ruby:
# Swap the BGM:
Audio.bgm_swap("FilenameOfNewTrack.ogg")

# Swap the BGS:
Audio.bgs_swap("FilenameOfNewTrack.ogg")

Another idea would be to sacrifice the BGS-channel if you don't need it to serve as a second layer of BGM and manually adjust both channels' volume-property all the time so both tracks are playing, BGS' position being synced to BGM's, but one of them sits silent in the background.

~炬燵あ
So I should copy the code as a new module and then use those script calls? I'm kinda new to this so I don't fully understand, sorry!

Original thread: https://forums.rpgmakerweb.com/threads/progressive-layered-music-script-for-vxace.151851/