I’m experiencing audio clicks when using “fade-in”, “fade-out” or “adjust volume” functions and it’s hard to know what to do to avoid them.
In order to investigate the cause of the clicks, I spawned a sound at some location playing a wave loop with only a simple positive offset in it, asked it to fade in and out from 0 to 1 and recorded the result.
By default (assuming I used “adjust volume” instead of “fade in” to prevent the envelopes to restart at zero at each fade in) the shape of the sound looks fairly linear, like that :
But I noticed that if I check the “Enable Focus Interpolation” in the “Attenuation Listener Focus” section of the attenuation used by that sound, then the shape looks like this :
I find it strange for the “focus interpolation” to have any influence on the shape and duration of the fades.
It happens even when the focus stays entirely on or off. The gain also occasionally goes slightly above 1 or below 0. The clicks are especially loud in this context.
Still, even when not using the focus attenuation, a small click can frequently be heard at the end of fade-outs.
Here is an example of it using an actual sample, the spectrogram shows the click at the end :
I understand that the volume adjustments are probably based on graphical frame updates and that could be a possible cause for some soft clicks, but if that was the case here then they would be louder all over the fade and not just at the end.