bonus-audio-channels

Bonus: Godot’s audio channels

This bonus guide talks about Godot’s audio mixer, which you can use to control the volume of many stream players at once and to add audio filters.

We use the audio mixer to change the music when opening the pause menu in the completed game project.

In almost every game, you have options to control the volume of effects and music separately.

Some games even allow modifying separately menu sounds or dialogues.

Each of those sliders corresponds to what we call an audio channel (you’ll also find them called audio bus).

An audio channel is a way engine transports a sound to the actual hardware speakers of the user.

You can adjust the volume of each audio channel independently, but you can also add effects, such as reverb (echo) or distortion.

To create or edit an audio channel, click on the Audio tab of the bottom drawer:

Typically, you’ll create two Channels (additionally to “master”, which is the default):

“Master” is impossible to delete and controls the sound volume of all the other channels. These are the traditional names, but you can name them anything.

Caution: In Godot, if you rename a channel, all sound players that use that channel will revert to “Master.” So make sure to pick the name before you use it.

Creating channels will automatically create a file called default_bus_layout.tres in your project. Godot saves the audio channel (audio bus) layout there.

To use a channel, select any AudioStreamPlayer, AudioStreamPlayer2D, or AudioStreamPlayer3D node and set the channel in the Bus section.

To edit channels in code, you can do something like:

func _on_Slider_value_changed(value: float) -> void:
    var bus := AudioServer.get_bus_index("Music")
    AudioServer.set_bus_volume_db(bus, value)