This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

I tried to do it in different ways but nothing comes out. My code looks like this (I know that interpolate_property method doesn't indicate what is needed at all, I showed it for clarity):

func _on_StartButton_pressed():
    fade.fade_in()

    var tween = Tween.new()
    add_child(tween)
    tween.interpolate_property(AudioStream, "volume_db", 0, -80, 1, Tween.TRANS_QUART, Tween.EASE_IN, 0)
    tween.start()

    yield(get_tree().create_timer(transition_duration), "timeout")
    get_tree().change_scene("res://Main.tscn")

I want to interpolate audiobus I need (in my case it's Music, index 1), not master audio.
Is it possible? If so, how?

Godot version 3.3.4.stable
in Engine by (160 points)

1 Answer

+2 votes
Best answer
  1. You must create a method that will change the volume of your bus.
  2. Use interpolate_method in your tween.
tween.interpolate_method(self, "change_audio_bus_volume", 0.0, -80.0, 1.0)
tween.start()
func change_audio_bus_volume(value: float):
    var index = AudioServer.get_bus_index("bus_name")
    AudioServer.set_bus_volume_db(index, value)
by (162 points)
selected by

Note that this will most likely cause audible cracking as per https://github.com/godotengine/godot/issues/32882. As a workaround, modify the volume of individual AudioStreamPlayer nodes instead.

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.