我怎样才能在赫兹DFT / FFT的输出频率? [英] How can I get DFT/FFT output frequencies in Hertz?

查看:281
本文介绍了我怎样才能在赫兹DFT / FFT的输出频率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发音符探测器作为我的学位项目,我想从头开始做。我已经写了code为.WAV文件,该文件从提取音频音乐文件的所有信息,并给了我振幅的结果。

I want to develop musical notes detector as my degree project and I want to do it from scratch. I have written code for ".wav" file which extracts all info from that audio music file and gives me amplitude as a result.

然后我写了一个code的DFT - 它给了我输出作为一个复数,其中轴线之一(实/虚)是幅度/幅度等是相

Then I have written a code for DFT - it gives me output as a complex number where one of the axis (real/imaginary) is amplitude/magnitude and other is Phase.

现在我想在频率上回答这个问题(在赫兹不是矢量),所以我可以检查我是否DFT给我适当的输出与否。如何将我的DFT输出转换为频率?

Now the question I want the answer in frequency (in Hertz not in vector) so I can check whether my DFT gives me the proper output or not. How can i convert my DFT output into frequency ?

我要在C语言中code这一点,我不希望使用任何内置库

I have to code this in C language and I don't want to use any built-in library

推荐答案

您需要找到高峰的大小的然后制定出相应的频率:

You need to find the peak magnitude then work out the corresponding frequency:


  • 计算每个DFT输出纸盒的大小: =幅度的sqrt(重*重新+ IM * IM)

  • 找到的最大震级的bin,调用它的指数最大电流

  • 计算这个箱子的等效频率:频率=最大电流* Fs的/ N ,这里 FS =采样率(赫兹)和 N =没有在FFT点。

  • calculate the magnitude of each DFT output bin: magnitude = sqrt(re*re+im*im)
  • find the bin with the largest magnitude, call its index i_max.
  • calculate the equivalent frequency of this bin: freq = i_max * Fs / N, here Fs = sample rate (Hz) and N = no of points in FFT.

请参阅this解答获取如何仓索引和频率相关的更详细的解释。

See this answer for a more detailed explanation of how bin indices and frequency are related.

这篇关于我怎样才能在赫兹DFT / FFT的输出频率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆