- Home /
Game Music Sometimes Being Distorted
Frequently when I start my game in the Unity Editor the game's music is badly distorted, sounding slowed-down and glitchy. This also happens occasionally when I play a build. However, this doesn't happen every time I play the game.
I've set the doppler level to 0 both in the audio settings, as well as on the audio source I am using to play the music - as suggested by a few posts that I've seen - but that hasn't helped.
Does anyone have any idea what might be causing this?
In case it's relevant, I am using 2020.1.7f1.
Answer by simiel7 · Jan 20 at 04:26 PM
@HectorSmoke
I do not know an exact answer for this, but could you profile your game and check out any performance issue?
My guess is that some of your logic or the Garbage Collector doing it's job and occupy most of the CPU, which can cause that the game has not enough CPU time to play the sound effect properly.
If you are not familiar with the profiling, you should check out the https://docs.unity3d.com/2021.2/Documentation/Manual/Profiler.html page.
If this is the problem and you can see that the shuttering and glitching happens when the CPU is occupied, you should check what happened there and try to optimize it to lower the CPU cost.
Also, if I remember correctly you can set how the system parse the audio file by streaming it, decompress and so on. Switching to another method may solve your issue. You can check out this topic here: https://docs.unity3d.com/2021.2/Documentation/Manual/AudioFiles.html