Can you change the game music volume in game via python?

I was wondering is there a way to change the music volume in game?
The scenario : the game music plays then when voice clip happens, the game music is too loud over the voice clip. There have to be a way to turn down music while the voice clip plays. messages can be used to trigger the music volume to normal to low.

Anyone knows a way?

Yep, it’s pretty easy to do.

If you’re using a sound actuator you can use obj[‘Sound’].volume = X.

If you’re using audaspace, you can actually adjust the volume of the device, factory, and handle individually. Based on what you’re describing, you probably want to adjust the handle volume using handle.volume = X.

Yes, you can. You can change the volume of a sound actuator via getting the actuator and settings its volume property.

from bge import logic

cont = logic.getCurrentController()
jump = cont.actuators['JumpSound']
jump.volume = 0.5

You can also use the Audaspace module for sound, which gives you greater control and more effects than just the sound actuator.

I don’t mean to butt in, but are there any tutorials regarding the Audaspace module? It seems to have a lot of potential, but I have no clue how to use it.

Thanks alot guys! also Ima look into audaspace.

I could make a tutorial if you guys want.

Okay, I made a tutorial.

Awesome, thanks SolarLune!

Ahh, very cool - SolarLune (haha it rhymes :))
In my game I was changing the logic to play different bricks which made it keep starting from the beginning!