# 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 < blockSize; i++)
fftBuffer[i] = inBuffer[i];

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

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

// complex multiplication
for(i = 0; i < 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);

for(i = 0; i < 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.

• Is irSize=512? If convBuffer only has 512 elements, then you would have a problem. – JRE May 21 '15 at 12:02
• Thanks for the reply. No, convBuffer has 1026 elements. I'm fairly sure the problem isn't from a bad memory read. It's the algorithm that has problems. – Robert Clouth May 21 '15 at 12:20