0 votes

I'm wanting to allow the player to lower or outright disable volume levels for sound effects and music as desired. So, I created two additional audio buses (named sfx and music respectively). However, setting the node to the bus (For example, a death sound effect to the sfx bus) and then adjusting the volume yields no difference in playback. What am I doing wrong?

EDIT: I'm using Godot 3.2.3

in Engine by (193 points)
edited by

1 Answer

0 votes

You can change the volume of a particular bus with the AudioServer, see https://docs.godotengine.org/fr/stable/classes/class_audioserver.html

For example, to set the audio level of a bus called "SFX", I would do:

var sfx_index= AudioServer.get_bus_index("SFX")
AudioServer.set_bus_volume_db(sfx_index, value_in_db)

Make sure to check that the value you're using in is decibels, the higher the number, the lower the volume. https://docs.godotengine.org/en/stable/tutorials/audio/audio_buses.html#decibel-scale

by (615 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.