Audio slightly pops when updating HSlider every second for a progress bar, from _process(delta)

Godot Version

4.5

Question

Is there any way to update the HSlider without getting slight popping sounds? This is important because the program is an actual audio player.

Code:
$HSlider.value = int(get_node(“/root/Globalvar/AudioStreamPlayer”).get_playback_position())

The pops are very slight, but if I don’t update HSlider for the song progress bar, it’s pristine audio.

At this point, I can disable the feature or have a toggle to turn it off and on, but that’s not ideal.

I have found a very good work around. I no longer update the HSlider as it will create pops if you continuously update (value). I left the HSlider, but used Modulate to make it invisible and then created a PathFollow2D with a sprite and background image to simulate the song progress bar with a few calculations. The HSlider is still there (although invisible) and will only update when you click or drag on the song progress bar.

Note: I tried continuous updating of HSlider in a separte Thread and it still had slight pops and clicks when updating the HSlider value on the fly. In thinking about this further, updating the HSlider value is not ideal and would create an odd change in audio timing, even if it’s very small.

I hope this tip is valuable to other programmers.

Rock on!

I’m guessing it’s popping because its signal Range.value_changed is connected to a function that change the playback position. If that’s the case then you should use Range.set_value_no_signal() to update its value instead so the signal isn’t fired.

1 Like

Thank you for this. I didn’t know of this and it may have saved me from the alternative. On a good note, as it’s already done, it does look a little more interesting with the graphics in the PathFollow2D.