Script to lower in-game volume without modifying the options

Basically, for a few cutscenes I need the music to get lower or cut completely. The standard fade-out option takes at least 1 second before cutting the music. To bypass this I used the script "AudioManager.fadeOutBgm(0);", basically cutting the music instantly.

However, in cases where I need the music to just get lower I can't use this. I tried using the script "ConfigManager['bgmVolume'] = x;", which lowers it, but at the same time it changes the game options. The same goes for when I raise the volume back to normal, it changes the options.

For example: if the player lowers the BGM volume from the options to 60%, during that cutscene the volume will first be set to, let's say, 50%, and then it will be set to 100% because the ConfigManager will CHANGE the options.

Is there a way to get around this? Maybe getting the value from the options, putting it in a variable and using it as the "x" of the ConfigManager?
Any reason you can't just use play BGM "None" to cut it out and just play BGM (The same music that plays on the map/cutscene) with a lower volume?
if you absolutely need the script for it, try setting
Code:
AudioManager._bgmBuffer.volume
to the decimal value of the volume you want
Any reason you can't just use play BGM "None" to cut it out and just play BGM (The same music that plays on the map/cutscene) with a lower volume?
It would work, but then the music would start from the beginning. I'd like too keep it going, like the "save BGM" and "resume BGM" option
if you absolutely need the script for it, try setting
Code:
AudioManager._bgmBuffer.volume
to the decimal value of the volume you want
Tried it, but in this case "AudioManager._bgmBuffer.volume" takes the value from the command that plays the music instead of the value from the options.
I play BGMs with volume set to 90 instead of 100 (since I'm just used to this), so when I run the code it reads 0.9 instead of 1. Changing the volume with that value through the AudioManager then results in the volume going to 90% instead of, for example, 100%
Tried it, but in this case "AudioManager._bgmBuffer.volume" takes the value from the command that plays the music instead of the value from the options.
the value used there is the volume of the track set by the command that plays it multiplied by the bgm volume setting in options.

I play BGMs with volume set to 90 instead of 100 (since I'm just used to this), so when I run the code it reads 0.9 instead of 1.
if your bgm option is set to 100, then it will be .9 if the command that played the track is 90%. is your bgm option not at 100?

Changing the volume with that value through the AudioManager then results in the volume going to 90% instead of, for example, 100%
im not sure what you mean here. what did you use to change it, and what did it result in, and what were expecting that didnt happen? if you need it to adjust based on the option, then you just factor it in. you already know where that data is held.
Code:
AudioManager._bgmBuffer.volume = .3 * ConfigManager.bgmVolume/100
It would work, but then the music would start from the beginning. I'd like too keep it going, like the "save BGM" and "resume BGM" option
No it doesn't

1741538990914.png

And you can use "Save BGM" before cutting it out and then Replay BGM just fine as well. You can even play an entirely different track inbetween.

1741539202205.png
im not sure what you mean here. what did you use to change it, and what did it result in, and what were expecting that didnt happen? if you need it to adjust based on the option, then you just factor it in. you already know where that data is held.
Code:
AudioManager._bgmBuffer.volume = .3 * ConfigManager.bgmVolume/100
I'll use screenshots to explain it better


immagine_2025-03-09_180653295.png


The settings are all set to 100%. After running this script:
Code:
var V = AudioManager._bgmBuffer.volume;
V = V * 100;
ConfigManager['bgmVolume'] = V;

immagine_2025-03-09_181003896.png


Then the volume will (rightfully) set itself at 90%. What I'm trying to do is, if I set the volume to 100% beforehand, to make it go back at 100%. So if I'm playing at 60%, it will go back to 60% (because with this script, it will go back to 54%)
Ok so apparently it was way easier than I imagined it (or described it).

Code:
var c = AudioManager._currentBgm;
c.volume = 50;
AudioManager.updateBgmParameters(c);

This is what I was looking for. Thank you for your replies

Original thread: https://forums.rpgmakerweb.com/threads/script-to-lower-in-game-volume-without-modifying-the-options.176102/