Godot Version
V4.7
Question
Hi, I’m having some trouble adjusting the volume for my music. I’m able to adjust the sound, but I can’t figure out music. I also made music Global so that it doesn’t change between certain secenes.
Below is the node layout.
BTW, the HSlider is separate
![]()
extends HSlider
@export var bus_name : String
# bus_name for the HSlider is either Music or Sound
# Yes, the audio bus has the same names (Master, Music, Sound)
var bus_index : int
func _ready() → void:
bus_index = AudioServer.get_bus_index(bus_name)
value = db_to_linear(AudioServer.get_bus_volume_db(bus_index))
func _on_value_changed(value: float) → void:
AudioServer.set_bus_volume_db(bus_index, linear_to_db(value))
This is the Global. Called MusicControl.
extends AudioStreamPlayer
var current_music = preload(“res://Assets/SoundsAndMusic/Lost In The Desert.wav”)
func _play_level_music(music : AudioStream) → void:
# Don't want the music to change between certain scenes
if stream == music:
return
stream = music
play()
func play_general_music() → void:
_play_level_music(current_music)
Code to call MusicConytol: MusicControl.play_general_music()

This is the bus