Computing the discrete fourier transform of audio data with FFTW

末鹿安然 提交于 2019-12-09 05:10:26
Paul R

To answer some of your individual questions from the above:

  • you need a real-to-complex transform, not real-to-real
  • you will calculate the magnitude of the complex output bins at the frequencies of interest (magnitude = sqrt(re*re + im*im))
  • the frequency resolution is indeed Fs / N = 44100 / 11025 = 4 Hz, i.e. the width of each output bin is 4 Hz
  • for a real-to-complex transform you get N/2 + 1 output bins giving you frequencies from 0 to Fs / 2
  • you just ignore frequencies in which you are not interested - the FFT is very efficient so you can afford to "waste" unwanted output bins (unless you are only interested in a relatively small number of output frequencies)

Additional notes:

  • plan creation does not actually perform an FFT - typically you create a plan once and then use it many times (by calling fftw_execute)
  • for performance you probably want to use the single precision calls (e.g. fftwf_execute rather than fftw_execute, and similarly for plan creation etc)

Some useful related questions/answers on StackOverflow:

There are many more similar questions and answers which you might also want to read - search for the and tags.

Also note that dsp.stackexchange.com is the preferred site for site for questions on DSP theory rather than actual specific programming problems.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!