how to low the music volume via script without changing it?

Hi I work on a script who permit to pause the game but I don't want to change the music

just to low the current music volume  without changing it or restart it 

I know this a pretty basic question I was just not sure of how you can do this ....

did I have to do this ?

RPG::BGM.new("",50,100).play ? because the song name is empty did it will take the current song and modify it?

thanks for your further answer
no. Did you try passing it the BGM that's already playing?


I tried to do this with pitch, but there was a very short pause between the changes - you might find the same thing.
Hum I am not sure of what you mean can you show me exemple of what you mean shaz ?
I just lower the volume using events. Is there a reason you have to use a script for it?
actually yes this for a script ( a Scene script)  like I said in the first post and no I don't want to use any even method for this sorry 
Well, how would you do it with events?


Get it working with events (without switching scenes), then look at what Game_Interpreter does when you run those commands. That will give you the equivalent script calls.
Well, how would you do it with events?
Im really sorry, i was on my phone at a restaurant just as the server was coming to bring us our order when posted last, and i jumped the gun a little. I read the title but not the rest of his question 🙁 .

Im really sorry Nio. Because i didint read the rest of your topic, i thought you were talking about lowering the volume during something like a cut scene. I'll make sure i read the whole topic next time. 🙁 . 
The way to lower volumes of a BGM (or any other audio file, like ME and SFX) is that you run the following:

Audio.bgm_play("Audio/BGM/SongName", new_volume)So if you want to lower the volume down by, say, 1 point each frame, you'd have to subtract 1 from the new_volume variable before calling this. To show how I tested this really quickly with a script call in the event editor:

volume_lower_rpgmace.PNG


I know you said you wanted this as part of a script, but it's hard to say exactly how you'd implement it, because it depends on how you want the script to work. But just in terms of pseudocode, you could put it in a class's update method like this:

def update # other things that get updated control_volumeenddef control_volume if @current_volume > @new_volume @current_volume -= 1 update_volume elsif @current_volume < @new_volume @current_volume += 1 update_volume endenddef update_volume Audio.bgm_play("Audio/BGM/#{current_song_name}", @current_volumeendIf at any point you were to change @new_volume to a new value, it'd increase or decrease the volume of the current_song_name song until it reaches that desired volume. I hope this helps 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-low-the-music-volume-via-script-without-changing-it.36741/