deconvolution challenge

OK hive mind...

i have two identical fixed-size signal buffers, each containing 4 channels of audio.

I perform a 2d REAL to COMPLEX FFTW_ESTIMATE on both, resulting in two identical spectra of the same length.

I now perform division of the two complex spectra in order to retrieve the impulse response (this is for testing).

I assume that I would see an ideal impulse response (first sample 1.0, the remaining samples 0), but this is not what I see.

With identical spectra I am seeing an impulse response that really shouldn't be there.

Should I be using real to complex FFT's here or should I be using just Real to Real?

void
iconvo_divideFFTs(iConvo * handle) {

assert(handle != NULL);

fftw_complex *a,*b,*c;

for (int i=0 ; i < handle->bufferSize * 4 ; i++) {
a=&handle->fftw_input[i];
b=&handle->fftw_output[i];
c=&handle->fftw_filter[i];

*c[0]=( (((*a[0])*(*b[0]))+((*b[1])*(*a[0])))/(((*a[0])*(*a[0]))+((*a[1])*(*a[1]))) );
*c[1]=( (((*b[0])*(*a[0]))-((*b[0])*(*a[1])))/(((*a[0])*(*a[0]))+((*a[1])*(*a[1]))) );

}
}

• if both spectra match exactcy (i.e. in phase and amplitude), then their quotient would be a constant 1 (phase zero). This IDFT must be an impulse, as you point out. Hence, check how the spectra of your intermediate steps look like. – Maximilian Matthé Dec 18 '16 at 8:16
• Further, I am not sure about operator preference in C here, maybe you should use (*a)[0] instead of *a[0]. Also, I'm not sure what your code should do. should c be the complex division of a/b? Then, at first glance this seems wrong to me. – Maximilian Matthé Dec 18 '16 at 8:17
• Ok thanks my friend some good things to try. I also think i may need to double the buffer size to take into account circular deconvolution. Will try as soon as i can and report back. Thanks for the help. – Mark Dec 18 '16 at 8:27