How to make sound not distorted by Game Thread bottleneck?


Sometimes it’s not possible to avoid performing a heavy operation in the Game Thread that takes 50-100ms to complete in a context in which the visual stall is not perceptible (e.g. in a menu). That’s fine. The problem comes with sound, especifically when using “Play Audio 2D” to play a sound just before the heavy operation. The sound will be distorted in pitch/volume. It only happens if a heavy CPU operation is performed, otherwise plays fine. I tried starting
to play the sound first and wait for starting the heavy operation after a 0.1-0.2s delay, but the unwanted distortion still happens.

Do you know how to solve this? To make audio independent of bottlenecks in the Game Thread.