DSPRelated.com
Forums

DFT-based Filtering: does it matter if I normalize by N in the FFT or iFFT?

Started by rger...@ea.com August 30, 2005
Hi all, and apologies in advance for the long-winded question. 

I have recently implemented a fast convolution algorithm using the FFT/iFFT to
convert input signal and filter into the frequency domain, multiply them out,
and iFFT them back to the time domain to get my result. It all seems to work
fine, however, I recently got a little confused on one point. 

I need to determine the gain that my filter will be applying to the signal.
I've done this by importing my coefficients into Matlab and calling freqz
(sig proc toolbox, I think). It works fine and I get gains goings from about 50
dB at DC to around 0 dB at Nyquist (fs/2). I get the same result if I call fft
and plot the magnitude of the coefficients.

That all seemed to make perfect sense. Then I thought I'd have a look at
the spectrum of my filter in an Audio Editor like Sound Forge or GoldWave. When
I look at it there, the gains are down by about 95 dB. Now my filter is very
long (impulse response reverb); in this case around 62,000 samples. I can
account for the difference by assuming that these audio editors, when they
calculate the spectrum, do the divide by N (FFT/iFFT length) in the FFT, not the
iFFT, since 20 * log10(62000) is around the 95 dB (unless this is a weird
coincidence). I know that Matlab's FFT/iFFT combo does the divide by N in
the iFFT (which, I believe, is where it's normally done (e.g.,
Oppenheim/Schafer), and where I do it in my implementation. Is that a reasonable
conclusion?

In any case, what is the real gain of the filter? If I would do my divide by N
in the FFT instead, or perhaps divide by sqrt(N) in both FFT and iFFT, I would
see a different magnitude response for this filter. My understanding is that for
the FFT to conserve energy, you need to normalize by sqrt(N), yet I don't
see that happening in the Matlab case. I might have thought that doing so would
give a magnitude response for which you could conclude that those values are the
gain of the filter.

More importantly, wouldn't the result you get in doing fast convolution
differ depending on where the FFT/IFFT 1/N normalization was done? Is it perhaps
a given in the definition of it that the iFFT will do the 1/N normalization? I
can say that when I do it this way, the result is correct (i.e., if I do a time
domain convolution I get the same result as with the fast convolution in the
freq domain).

I know I'm a bit confused on this, just not sure which part(s) I've
got wrong.

Thanks very much,

Ron