The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

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 (242 points)
edited by

2 Answers

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 (643 points)
0 votes

Use the linear to don method, convert the sound quality depending on slider value. Check these video on how to use it:
Make a volume slider in 3 Minutes

by (75 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 Frequently asked questions and 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 [email protected] with your username.