Normalising FFT data (FFTW)
Asked Answered
P

2

5

Using FFTW I have been computing the FFT of normalized .wav file data. I am a bit confused as to how I should normalise the FFT output, however. I have been using the method which seemed obvious to me, which is simply to divide by the highest FFT magnitude. I have seen division by 1/N and N/2 recommended, however (where I assume N = FFT size). How do these work as normalisation factors? There doesn't seem to me to be an intuitive relation between these factors and the actual data - so what am I missing?

Huge thanks in advance for any help on this.

Physic answered 31/1, 2011 at 20:51 Comment(0)
V
5

Surprisingly there is no single agreed definition for the FFT and the IFFT, at least as far as scaling is concerned, but for most implementations (including FFTW) you need to scale by 1/N in the forward direction, and there is no scaling in the reverse direction.

Usually (for performance reasons) you will want to lump this scaling factor in with any other corrections, such as your A/D gain, window gain correction factor, etc, so that you just have one combined scale factor to apply to your FFT output bins. Alternatively if you are just generating, say, a power spectrum in dB then you can make the correction a single dB value that you subtract from your power spectrum bins.

Virgy answered 31/1, 2011 at 21:1 Comment(3)
Thanks for your reply, Paul. I'm new to DSP, and it might be that my lack of a mathematical background has led me to misunderstand things, but by 'normalisation' I understand the process whereby a data set is multiplied by some factor so as to yield a second data set lying within the interval between 0 and 1. This is why I automatically chose the largest magnitude as my factor. But I don't see how multiplying by 1/N 'normalises' the FFT data in that sense... or am I misunderstanding things entirely?Physic
@ChrisM: for the most common interpretation of the FFT, if your input signal is in the range 0..1 then the output value range is 0..N, i.e. there is a scaling factor of N. So to normalise (in any sense) the output data you need to multiply it by 1/N.Virgy
I suspected that was the case. Thanks very much for your help.Physic
T
4

It's often useful with FFTs to refer to Parseval's Theorem, and other comparisons that require a meaningful magnitude. Furthermore, the height of any individual peak isn't very useful, and depends, for example, on the window that used in calculating the FFT, as this can shorten and broaden the peak. For these reason, I'd recommend against normalizing by the largest peak, as you then lose any easy connection to meaningful magnitudes, and easy comparison between data sets, etc.

Tailor answered 1/2, 2011 at 16:26 Comment(1)
Thanks Tom, some useful info.Physic

© 2022 - 2024 — McMap. All rights reserved.