Music stutters when the game does

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

Hi. I’m trying to add background music to my game, using a simple AudioStreamPlayer playing an .ogg file. It works-ish, but the problem is that the audio stutters occasionally.

It happens if the FPS drops for a split second, but it also happens seemingly completely randomly every 5-10 seconds or so even when the game is doing almost nothing, so I cannot solve it simply by eliminating these known performance drops.

Is this normal? If not, what am I doing wrong? What is the best way to play a sound so that it plays properly without being affected by the performance of the rest of the game?