What causes weird cracking/popping sound when playing 3d sound
I am having a problem where when I spawn a prefab with an AudioSource, the sound it makes is distorted/pops when it firsts starts playing. After a half second it plays as normal. The sound clip should just be a constant humming sound
Does anyone know how to set this up so I don't get this cracking sound? (I can't tell if this is distortion or an artifact of 3d sound or what). I've tries using different audio clips and I am still getting this problem.
Unity Version: Unity 2018.3.4f1
Video demonstrating the issue: https://streamable.com/gzus5
AudioSource Settings:
Answer by rh_galaxy · Feb 11, 2019 at 12:29 PM
Sounds like clipping is occurring. Maybe you unintentionally start more than one clip, so that they together get too loud. Or that it is too loud to begin with. Volume 0.082 speaks against that... Does this still happen if you move the missile start to be at where it was after 0.5 sec in the original setup... does it sound ok from the start then?
I've tried spawning it further ahead of the camera, and it still does it. It shouldn't be playing the sound twice because the audio source is on the missile, and there is only one missile being fired at a time (using Play(), not PlayOneShot())
I think it might be clipping too, e.g. unity's spatial audio system is boosting is volume for closeness. But there needs to be a way to set the max volume on it so it doesn't go over the clipping level.
Right now as a workaround I am fading in all of my spatial sounds for the first second of playing to avoid the clipping noise. It's ok for bullet engine noises and stuff but making the ti$$anonymous$$g of the sound look delayed when used with explosions.
have you tried to instantiate the source first then add the clip to the source after its been created then making it play and not play on awake? maybe nute volume of source when no clip is active and restore it once a clip isPlaying. this could all be removed again, its to see if the clip or the source is the cause of the unwanted sound.