I'm trying to seamlessly loop an audio signal. When I loop the current audio signal I have, I hear audible clicks or pops right as it loops back to the beginning. I want to be able to loop the audio signal without having any pops.
I have tried changing the signal near the end by writing an interpolation which follows this formula $$ B_n=\frac{(A_n d_1) + (Cd_2)}{d_1+d_2} $$ Where $B$ is the output, $A$ is the audio signal itself, and $C$ is the first signal value within the audio signal. $d_1$ equals to how many signal values until the first sample. $d_2$ equals how many signal values since the specified start. And I choose when the specified start is based on how many milliseconds I wish for the interpolation to be. In this case I gave 15ms a try. So, the specified start will be 15ms before the end of the signal.
And in simple terms; it's a crossfader that is linearly transitioning from the signal source $A$ onto the single value $C$.
The end result is this.
The transition points are highlighted via the cursor. Also, do not mind that both signals are not exactly the same. For the upper signal, I cut a portion of the start so that it would start at a non-0 value.
Since the crossfade is fairly quick for human ears (15ms), I did not manage to hear any disintegration of audio. But is this good practice? I am new to signal processing and cannot tell whether or not this will work for all types of signals I might have. Is there any other way this could be done in a more "proper" manner?