How to make battle BGM change when the player is selecting attacks?

On default, battles have the same music throughout the entire fight, so I wonder if there is a way through scripts to make it so that when the player is selecting their attacks the battle BGM changes to something else. This is an example of what I mean; when the player is choosing what to do, the BGM changes to a more "muffled" version.
bump

Is this possible?
Here ya go buddy.

Spoiler: Zachy Engine | Different battle BGM on action selection.
Ruby:
#===============================================================================
# Different battle BGM on action selection.
#-------------------------------------------------------------------------------
# Made by: Zachy
#===============================================================================
#===============================================================================
# Instructions:
#-------------------------------------------------------------------------------
# Lets you have a muffled version of the battle theme on the action select
# screen. When using this script you can't use BGS on battles, since to
# cross-fade between the two themes it uses both BGM and BGS "layers".
#
# To use this script you must have two versions of the song, the normal one and
# the muffled one. You'll have to do all the audio editing by yourself.
#
# The muffled version of the BGM must have a "_muffled" suffix in the filename.
# e.g., "Battle1" and "Battle1_muffled".
#
#===============================================================================

class Game_System
  
  attr_accessor :bgm_name
  attr_accessor :bgm_volume
  attr_accessor :bgm_pitch
  attr_accessor :bgm_pos
  
#--------------------------------------------------------------------------
# * Update Battle BGM (New Method)
#--------------------------------------------------------------------------
  def update_battle_bgm
    @battle_bgm ||= $data_system.battle_bgm
    @bgm_name = @battle_bgm.name
    @bgm_volume = @battle_bgm.volume
    @bgm_pitch = @battle_bgm.pitch
    
  end
  
end # Class

class Scene_Battle
#--------------------------------------------------------------------------
# * Start
#--------------------------------------------------------------------------
  alias :start_ze :start
  def start
    start_ze
    RPG::BGS.last.pos = 0
    
  end
  
#--------------------------------------------------------------------------
# * Start Turn
#--------------------------------------------------------------------------
  alias :turn_start_ze :turn_start
  def turn_start
    turn_start_ze
    $game_system.update_battle_bgm
    
    $game_system.bgm_pos = RPG::BGS.last.pos + 20000
    Audio.bgm_play("Audio/BGM/"+$game_system.bgm_name, $game_system.bgm_volume, 
    $game_system.bgm_pitch, $game_system.bgm_pos)
    
    RPG::BGS.fade(1500)
    
  end
  
#--------------------------------------------------------------------------
# * Start Party Command Selection
#--------------------------------------------------------------------------
  alias :start_party_command_selection_ze :start_party_command_selection
  def start_party_command_selection
    start_party_command_selection_ze
    $game_system.update_battle_bgm
    
    $game_system.bgm_pos = RPG::BGS.last.pos + 20000
    Audio.bgm_play("Audio/BGM/"+$game_system.bgm_name, $game_system.bgm_volume, 
    $game_system.bgm_pitch, $game_system.bgm_pos)
    
    RPG::BGS.fade(1500)
    
  end
  
#--------------------------------------------------------------------------
# * Start Actor Command Selection
#--------------------------------------------------------------------------
  alias :start_actor_command_selection_ze :start_actor_command_selection
  def start_actor_command_selection
    start_actor_command_selection_ze
    $game_system.update_battle_bgm
    
    $game_system.bgm_pos = RPG::BGM.last.pos + 20000
    Audio.bgs_play("Audio/BGM/"+$game_system.bgm_name+"_muffled", 
    $game_system.bgm_volume, $game_system.bgm_pitch, $game_system.bgm_pos)
    
    RPG::BGM.fade(1500)
    
  end

end # Class

If you find any bug/error just holler.
This is cool! I'll test it out and see if it works.
It works perfectly, thank you! The only problem is that I don't think the songs line up. (Although the test song I made was a very short loop, so I'm not sure.)
It works perfectly, thank you! The only problem is that I don't think the songs line up. (Although the test song I made was a very short loop, so I'm not sure.)

Ah, well. The audio module in RGSS isn't really made for stuff like this.

I noticed there's a short pause when trying to play two BGMs in succession, and that's why I made the little cross-fade effect. It's still not perfect tho, because when playing a BGS it still has a fade-in effect that messes up the transition.

The audio module is hard-coded into the .dll so I can't really do much about it.
Ah, that's fine then. At least it works, thank you again!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-battle-bgm-change-when-the-player-is-selecting-attacks.132587/