MZ Playing a sound effect disregarding se volume in settings

Hi guys.
I'm trying to play a sound effect at a random volume (stored in variable 4) using a script call that looks like that:

JavaScript:
AudioManager.playSe({name: `$name`, pan: 0, pitch: 50, volume: $gameVariables.value(4)});
My issue is that this volume is then modified in regard to the SE Volume in the settings. How do I bypass that setting to make sure that my sound effect will be played at the same volume no matter what the setting is?
Thanks
How do I bypass that setting to make sure that my sound effect will be played at the same volume no matter what the setting is?
While it is possible to change the values of the settings midgame within the ConfigManager to do that, i strongly suggest against it. Presumably, the player set their sound effect volume level, and between game settings, the operating system settings, and the actual physical setup, theres no knowing how loud youll be making those sounds
It's not gonna be over the 100% of MV, so the OS settings and the physical setup won't be an issue if the rest of the game is not an issue when I don't change the setting, my SE won't be louder than the rest of the game.
Hi there!
If you want to preserve the previous settings of the player, you can do something like that:
JavaScript:
const oldVolume = ConfigManager.seVolume
ConfigManager.seVolume = XX //(Replace with a number from 0 to 100)
AudioManager.playSe({name: `$name`, pan: 0, pitch: 50, volume: $gameVariables.value(4)});
ConfigManager.seVolume = oldVolume
I think this can work on a script call. I just not sure if when changing the volume back to the old value so quickly, the current SE that is playing will also change it's volume.
That's the workaround I've eventually found, except that instead of ConfingManager.seVolume, I used
AudioManager._seVolume. Could you elaborate on the difference?

I'd like to take moment to thank you for helping me, and I don't mean on this thread specifically. I've been using a lot of your work and you are really a tremendous person.
You should not do this. The player turned their volume down for presumably a good reason. It's rude to mess with their settings.
That's the workaround I've eventually found, except that instead of ConfingManager.seVolume, I used
AudioManager._seVolume. Could you elaborate on the difference?

I'd like to take moment to thank you for helping me, and I don't mean on this thread specifically. i've been using a lot of your work and you are really a tremendous person.
- Thanks for the cumpliment! ^^

The difference is that one is the player preference that is saved. The other is the actual volume while the game is playing:
ConfigManager.seVolume is the player’s saved setting.
it's on the options menu. Changing it updates the preference, but it doesn’t directly control the volume I think.

AudioManager._seVolume is the actual volume used .
This is the value the RPG Maker uses when playing a sound effect. I think, changing it affects the volume right away. But it is not saved.

Normally, RPG Maker copies the value from ConfigManager.seVolume into AudioManager._seVolume when the options change. So I guess is even best if you use the AudioManager._seVolume instead.

You should not do this. The player turned their volume down for presumably a good reason. It's rude to mess with their settings.
- Although I agree with this. In terms of game development, I don't think it is a good idea to change the volume without the player knowing this way. But also, I don't know all your game case scenarios. So, before, I sticked to just answer your question and don't give an opinion about if it is a good thing for your game or not. But I think since I'm providing an answer to you, I guess it is also good for me to reinforce what Solar Flare said.
Thanks for your help and opinion.

For clarification, it is not rude, but it's ok you assumed that, you don't have context. And if it is ok on your part to assume my player have reasons for setting the volume a certain way, it should also be ok to assume I have a good reason to do it my way. To actually design something with an intention behind it. Are you angry at a game that dims the light (let say because it's night) after it made you set your screen lighting at the beginning of the game? Is this rude?

I know my player. I know what he will do and think. Yes, the game is made just for him. I will provide him the setup. And even if I don't, that's still ok.

And to not leave you in the dark, I'll give you the context. I have a sound based bard character and I want to make sound based mechanics and gameplay. To solve one of my enigmas, my player will have to listen to a sound effect twice. The first time with the intended volume, and the second one with his current SE volume settings. He will have to solve a riddle to understand that he has to set SE volume to the same level than the first SE. When both of the effects will be played at the same volume, the door will unlock.

You're always welcome to ask clarifications before saying I do rude things.

No hard feelings now, but I have to say I got say at some point I felt attacked by some comments here. I'm well aware that is probably not what you wanted, but in this case, once again, always ask first if you don't know.
To clarify, I do not read anyone as attacking you, but instead suggesting that ignoring options that players set is really kind of a no-no that might infuriate your players. You were still provided an answer regardless, as we also understand it's your game.

Are you angry at a game that dims the light (let say because it's night) after it made you set your screen lighting at the beginning of the game?
It depends on the situation, this is sort of an apples-to-oranges comparison, but depending on how dark the night is; yes. But the truth is that it's not changing the option when it goes night. The gamma value is still the same. It's not ignoring the option that's been set, it's simply a different lighting situation.

I have a sound based bard character and I want to make sound based mechanics and gameplay.
Then instead it might be better if you had a separate sound slider for just the bard. That way the player could turn down SE but leave the bard volume at a respectable level. That's a little bit more complicated, but not impossible. I think this option would be far more respectful of your players.



The problem is that you have no sense of what the player's system volume is at. Just because you don't exceed RM's 100% volume, doesn't mean it isn't loud.
Depending on the type of content on my computer, Youtube I typically keep the system volume at around 32 for a comfortable listening volume. Games tend to have quite a large variance in their volume range. Some games I have to turn the system volume up to 70.

Now imagine, I start your game, mix the volume sliders to be comfortable, and have my system volume up to 100. Suddenly your SE plays when I turn that down (or even off). It might either be upsetting, or even worse case could cause damage to my own hardware.

I highly suggest you read my topic on loudness in RPG Maker games.
Because the truth is loudness is not the same as volume. Just because the volume is low, doesn't mean we perceive it as quiet.
The problem is that you have no sense of what the player's system volume is at. Just because you don't exceed RM's 100% volume, doesn't mean it isn't loud.
Depending on the type of content on my computer, Youtube I typically keep the system volume at around 32 for a comfortable listening volume. Games tend to have quite a large variance in their volume range. Some games I have to turn the system volume up to 70.
Now imagine, I start your game, mix the volume sliders to be comfortable, and have my system volume up to 100. Suddenly your SE plays when I turn that down (or even off). It might either be upsetting, or even worse case could cause damage to my own hardware.
I realize I was still unclear, but he will play with me, at my home, on my computer with the volume I set. He will be allowed to change master volume (that is implemented in VisuStella's OptionsCore, as it doesn't exist in plain MZ) and my own speakers, but the balance between the others element is already set after thinking this through, for the design I want to make, for the experience I want him to live.

I understand your concerns about messing with users settings, I've been developing for a long time now (mostly C), and I know about the damage it can do. But in this particular case, there's no concerns to have. I also understand, and know, the mutual respect that must be between a game designer that makes an experience, and a player that has to not be harmed by that experience.

The gamma value is still the same. It's not ignoring the option that's been set, it's simply a different lighting situation.
You have a point. Then could you tell me the equivalent of the different sound situation in this example? What would the dimming and brightening be in this case?


I highly suggest you read my topic on loudness in RPG Maker games.
Because the truth is loudness is not the same as volume. Just because the volume is low, doesn't mean we perceive it as quiet.

My next read, thanks for the suggestion.
The difference is that one is the player preference that is saved. The other is the actual volume while the game is playing:
ConfigManager.seVolume is the player’s saved setting.
it's on the options menu. Changing it updates the preference, but it doesn’t directly control the volume I think.

AudioManager._seVolume is the actual volume used .
This is the value the RPG Maker uses when playing a sound effect. I think, changing it affects the volume right away. But it is not saved.

Normally, RPG Maker copies the value from ConfigManager.seVolume into AudioManager._seVolume when the options change. So I guess is even best if you use the AudioManager._seVolume instead.
Actually, while this explanation of their purpose is broadly correct, there is no difference between them. They are synonyms – ConfigManager.seVolume is defined so that reading from it returns the value of AudioManager._seVolume, and writing to it updates the value of AudioManager._seVolume. There is also AudioManager.seVolume which is another synonym for the same thing.
I realize I was still unclear, but he will play with me, at my home, on my computer with the volume I set. He will be allowed to change master volume (that is implemented in VisuStella's OptionsCore, as it doesn't exist in plain MZ) and my own speakers, but the balance between the others element is already set after thinking this through, for the design I want to make, for the experience I want him to live.

I understand your concerns about messing with users settings, I've been developing for a long time now (mostly C), and I know about the damage it can do. But in this particular case, there's no concerns to have. I also understand, and know, the mutual respect that must be between a game designer that makes an experience, and a player that has to not be harmed by that experience.


You have a point. Then could you tell me the equivalent of the different sound situation in this example? What would the dimming and brightening be in this case?




My next read, thanks for the suggestion.
Understood! Then apologies for prodding.
Good luck with your bard game! 👋

Original thread: https://forums.rpgmakerweb.com/threads/playing-a-sound-effect-disregarding-se-volume-in-settings.181807/