DSPRelated.com
Forums

producing spectrogram from audio file.. confusion with FFT

Started by louis October 10, 2006
Some nit-picking in your program:

louis skrev:

> //******* Create Hann Window ****************// > for (k = 0; k < fftsize; k++) > { > hanning[k] = 0.5 - 0.5 * cos(6.2832 * k / fftsize); > }
Use a proper represntation of pi. There is a defined constant in math.h. I think it is called M_PI. Check with the docs. Also, check if the Hann window function is correct. I think it should be something like cos(M_PI*k/(fftsize -1)); Rune
Hello
I haven't been following the post, but may be one possibility of your
'noise' is related to time-frequency uncertainity of the Short Time
Fourier Transform. Please take into account, the shorter the window,
you get better time resolution but your frequency resolution will
suffer. The longer the window, you get more frequency resolution but
your time resolution will suffer. So may be give it a try with
different windows size, and you can get more nice results, depending on
your application.

Regards

Juan Pablo Narino


Rune Allnor ha escrito:

> Some nit-picking in your program: > > louis skrev: > > > //******* Create Hann Window ****************// > > for (k = 0; k < fftsize; k++) > > { > > hanning[k] = 0.5 - 0.5 * cos(6.2832 * k / fftsize); > > } > > Use a proper represntation of pi. There is a defined constant > in math.h. I think it is called M_PI. Check with the docs. > > Also, check if the Hann window function is correct. I think it should > be something like > > cos(M_PI*k/(fftsize -1)); > > Rune