Slight crackle with overlap-add frequency-domain convolution I'm trying to make an FFT audio filter using overlap-add but there's some slight rhythmic distortion/crackle in the output. I have an irSize (impulse response size) of 512 samples and a blockSize of 512. The overlap is 512 samples. Since fftSize >= blockSize + irSize - 1, fftSize is 1024 samples. I'm using FFTS for the FFT so the output size of forward_real (fftBlockSize) is 1026.

Here are my steps:

// copy input
for(i = 0; i &lt; blockSize; i++)
    fftBuffer[i] = inBuffer[i];

// set rest to zero
for(i = blockSize; i &lt; fftBlockSize; i++)
    fftBuffer[i] = 0;

FFT::forward_real(fftSize, fftBuffer, fftBuffer);

// complex multiplication
for(i = 0; i &lt; irSize + 1; i++)
{
    convBuffer[i * 2] = fftBuffer[i * 2] * irBuffer[i * 2] - fftBuffer[i * 2 + 1] * irBuffer[i * 2 + 1];
    convBuffer[i * 2 + 1] = fftBuffer[i * 2] * irBuffer[i * 2 + 1] + fftBuffer[i * 2 + 1] * irBuffer[i * 2];
}

FFT::inverse_real(fftSize, convBuffer, fftBuffer);

// overlap-add
for(i = 0; i &lt; blockSize; ++i){
    outBuffer[i] = fftBuffer[i] + parts[i];
    parts[i] = fftBuffer[i + blockSize];
}


Here you can see the little jump in the output every 512 samples. This is the source of the distortion.



Any ideas? I've been struggling with this for days. It seems like either I'm doing the complex multiply or the overlap add slightly wrong. But I can't for the life of me figure it out. It seems like I'm doing the theory right.

Thanks.
For FFT fast convolution, the complex multiplication in the frequency domain needs to be done over the full length of the FFT (fftSize), not just the length of the impulse response in the time domain.  Otherwise (for strictly real data and a strictly real impulse response) the IFFT input will likely no longer be conjugate symmetric.