[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

<AUDITORY> Re: Frequency Content

Dear Marius,

very compact C code for Fourier transforms is available in a book called Numerical Recipes by Press et al., which is widely available. Copy your 512 chars to an array of 512 floats, then use the function "realft" to convert this inline to a spectral representation (you also have to type in the function "four1").

As for the result, data[1]*data[1] is the direct-current power (f = 0), and data[2]*data[2] is the power in the highest frequency, which is half of the sample rate.

The first genuine frequency power (f = sample rate divided by 512) is data[3]*data[3]+data[4]*data[4], the second frequency power (f = 2 * samplerate/512) is data[5]*data[5]+data[6]*data[6], and so on, up to data[511]*data[511]+data[512]*data[512], which is the power at f = 255 * samplerate/512.

Best wishes,


Paul Boersma
Institute of Phonetic Sciences, University of Amsterdam
Herengracht 338, 1016CG Amsterdam, The Netherlands
phone +31-20-5252385