To answer this question, I did some tests in Matlab.
This shows that the answer depends on
- implementation of FFT
- type of signal
a) FFT implementation: there is no unique FFT implementation. The only rule is that IFFT(FFT(x)) = x. for this somewhere a division by the length of the FFT (nfft) must be included. Very often this scaling is used asymmetrically with the inverse FFT (IFFT). But symmetrical use (scaling FFT and IFFT by 1/sqrt(nfft)) can be found. This must be checked for every implementation.
b) the following Matlab code considers 3 signals
- transient
- tonal
- random noise
using the Matlab implementation of the FFT I get the following results
- transient: peak spectral level is obtained with FFT without window and scaling
- tonal: peak spectral level is obtained by scaling with 2/sum(window)
- noise: RMS (std) spectral level is obtained by scaling with 2/sqrt(sum(window.^2))
Noise (or any random signal) is treated differently as only RMS is a sensible measure but not peak level as with tonals.
% amplitude for signal or std for noise
aa=100;
% window size and fft length
nw=2048; % result does not change when set to, say 512
nfft=max(2048,nw);
% generate impulse with amplitude aa at some location
xx=zeros(nw,1);
xx(11)=aa;
% generate sinusoidal signal with constant amplitude aa
yy=aa*sin(2*pi*16*(0:(nw-1))'/nw);
% generate window
ww=hann(nw);
y1=yy.*ww;
y2=2*y1/sum(ww);
% generate random noise (normalize to std=1)
uu=randn(nw,1);
zz=aa*uu/std(uu);
z1=zz.*ww;
z2=2*z1/sqrt(sum(ww.^2));
[aa,max(abs(fft(xx))), max(abs(fft(y2,nfft))), std(abs(fft(z2,nfft)))]
resulting to
100.0000 100.0000 100.0000 90.3902
Note the spectral noise level itself is a random variable scattering around the expected (true) value.
Edit: Note FFT length (per se) is not relevant, what is important is the window length (any zero padding does not add to the FFT result apart from interpolating the frequency bins). In case of a rectangular window, the scale factor is equal to the window length. This can be seen changing the nw parameter to say 1024 and keeping the nfft at 2048.
The actual FFT length and therefore the spectral bin-width is, however, important if the result (of noise) is presented as power spectral density (PSD) (e.g. in Pa^2/Hz), and the bin-width is rescaled to 1 Hz, but this is another question.