iPhone FFT with Accelerate framework vDSP

前端 未结 3 1708
臣服心动
臣服心动 2020-12-23 15:49

I\'m having difficulty implementing an FFT using vDSP. I understand the theory but am looking for a specific code example please.

I have data from a wav file as bel

3条回答
  •  感情败类
    2020-12-23 16:17

    1. You put your audio sample data into the real part of the input, and zero the imaginary part.

    2. If you are just interested in the magnitude of each bin in the frequency domain then you calculate sqrt(re*re + im*im) for each output bin. If you're only interested in relative magnitude then you can drop the sqrt and just calculate the squared magnitude, (re*re + im*im).

    3. You would look at the magnitudes of the bin or bins (see (2)) that correspond to your frequency or frequencies of interest. If your sample rate is Fs, and your FFT size is N, then the corresponding frequency for output bin i is given by f = i * Fs / N. Conversely if you are interested in a specific frequency f then the bin of interest, i, is given by i = N * f / Fs.

    Additional note: you will need to apply a suitable window function (e.g. Hann aka Hanning) to your FFT input data, prior to calculating the FFT itself.

提交回复
热议问题