I am trying to replicate the spetrum as given in Audacity and other commercial software... I am getting crazy with the correct scaling needed in order to have dBFS (with reference to a full scale sine wave).
Suppose xt is the PCM sample at k bit precision, first of all I rescale the PCM samples
st=xt2k−1√2
Suppose now wt is some window function, I compute the FFT of of size N of the product stwt.
Let P1,P2,…,PN be the FFT complex values. Since I am only interested in one-side spectrum, I just retain the fist half of the sequence. Moreover suppose for simplicity that the time series matches the window size N.
Taking
pi=2|P[i]N|2
for i=1,2,…,N/2−1 should give the power spectrum values. Then one would take 10log10(pi) to get dBFS.
But I think that in order to express dBFS one needs to scale the pi in some way taking into account the effect of the window. In fact I produced a pure 1KHz sine wave then I computed my spectrum and compared it with that obtained with Audacity, Adobe Audition etc. My FFT stays below by few dBFS so I think it's really a problem of scaling.
I hope somebody knows if there is a standard ways of doing that!
Regards Pierre
No comments:
Post a Comment