I am trying to design a pipeline that will repeat a certain segment of audio N times (for instance, for 10s of input, repeat the segment from 3s to 5s four times). This generates unwanted high frequencies at the joints between the repeats. I understand that this could be improved by directly manipulating the amplitude around the joints to improve the continuity of the signal, but I was wondering what would happen if I used a low pass filter of the region around the joint, if this would have a similar effect, or whether I would simply end up with the same problem occurring at the ends of the segment which underwent the low pass filter.
1 Answer
The answer is to be found in understanding what a crossfade is. A crossfade can be either "Constant Level" or "Constant Power". One is linear, one is logarithmic in shape.
You need to build a table of coefficients (float values between 0 and 1) that represent the shape you require. I would think you need a logarithmic fade for this application.
You need to use these coefficients in a way that the incoming signal will "fade in" and the outgoing signal will "fade out" at exactly the same time.
If you want a fade of say 500ms, you will need 24000 coefficients at a sampling rate of 48000. These can easily be generated programmatically.
Simply butt-editing each segment together will generate the pops and clicks you are hearing and filtering this out will not achieve the desired result. Crossfades will work perfectly.