godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.8k stars 21.13k forks source link

Audio stutter/artifacts when lagging or overworking CPU #96662

Open SlienCode opened 1 month ago

SlienCode commented 1 month ago

Tested versions

Reproducible in 4.1.1 and later versions

System information

Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 950M (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 Threads)

Issue description

This is a major audio performance issue and I can't find any bug reports related to this so my guess is that it's specific to certain (possibly old) hardware.

Whenever the CPU is overworked, the audio lags significantly. This usually happens every time an expensive task outside the engine is being worked on but if the game itself is computationally expensive then it can also lead to it. In the following preview I'm playing the audio and then switching to YouTube using Google Chrome. While on the website, I jump back and forth on the video to cause lag and showcase how the audio from within Godot is affected. Recording is focused on Godot's window so any activity done on the browser is not captured. It should be mentioned that such behavior has not been detected before on this hardware and Godot is the only application that seems to cause it.

I managed to replicate the issue on 4.3 stable too but my recording is from 4.1.1.

https://github.com/user-attachments/assets/0feb7f6c-e163-42e3-b015-5bfd6bdc5505

Steps to reproduce

Any scene using an AudioStreamPlayer will cause this issue. Simply start playing the audio (either through the editor or through running the project) and start any process that will possibly lead to lag.

Minimal reproduction project (MRP)

MRP.zip

fire commented 1 month ago

Are you using the web threaded or nothread build?

SlienCode commented 1 month ago

Not sure how to check that. I'm using the version which you are prompted to download once you get on Godot's website; the "default" one if there's such a thing. Applies for both 4.1.1 and 4.3.

I'm running everything locally and the audio issue still exists upon exporting the project if this somehow helps.