Is there a way to use python to control the master volume in game. I want that all sounds are controlled by one object so I can do any settings in game.


Globally change volume with this Python snippet. Also affects sound actuators.

import aud

device = aud.device()
device.volume = 0.5  # Change this value to whatever


Keep in mind that a new device isn't created until you re-start blender, so any changes made in-game will persist until you actually close blender.

  • $\begingroup$ This is the solution. $\endgroup$
    – Daniel
    Oct 3 '16 at 13:42

Check out Tutorials For Blender 3D for a solid reference on basically everything you'll ever need for scripting. Link here for the Sound Actuator Python reference.

Ended up sitting down finally, and got you this: Volume Control

I'll let you see the script and sort out how it works on your own. Not to be an ass, but because it'll make more sense and stick better if you do.

Reference for sound actuator python. http://bgepython.tutorialsforblender3d.com/SoundActuator

  • $\begingroup$ Is there a different way. I don't want to set this up on every single object that uses sound. You see, I am making a big game and everyone knows that more logic bricks are more lag. so... $\endgroup$
    – Hendriks3D
    Nov 1 '15 at 9:18
  • $\begingroup$ Ah. I was thinking in terms of music. But it's still easy. Unfortunately I'm again not at my computer so let me explain this as best I can. $\endgroup$
    – Daniel
    Nov 1 '15 at 9:20
  • $\begingroup$ Give me a bit, I'll be editing my answer. $\endgroup$
    – Daniel
    Nov 1 '15 at 9:21
  • $\begingroup$ Done. Untested. Let me know how it works. You can see any possible errors by going to Help and showing system terminal. $\endgroup$
    – Daniel
    Nov 1 '15 at 9:32
  • $\begingroup$ Updated one more time. Gave you a .blend to play with and see how it works. $\endgroup$
    – Daniel
    Nov 1 '15 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.