Adjust sound channel volume.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 9BitStrider

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

:bust_in_silhouette: Reply From: MrEliptik

You can change the volume of a particular bus with the AudioServer, see AudioServer — Documentation de Godot Engine (4.x) en français

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. Audio buses — Godot Engine (stable) documentation in English

:bust_in_silhouette: Reply From: Venex2004

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