如何使用 C 中的 FFTW 从 PortAudio 的样本中提取频率信息
我想制作一个程序,使用 PortAudio 记录音频数据(我已经完成了这部分),然后显示所记录音频的频率信息(现在,我想显示每组样本的平均频率)当他们进来时)。
根据我所做的一些研究,我知道我需要进行 FFT。所以我在 google 上搜索了一个用 C 语言编写的库,并找到了 FFTW。
然而,现在我有点失落了。我到底应该如何处理我记录的样本以从中提取一些频率信息?我应该使用哪种 FFT(我假设我需要真实的一维数据?)?
一旦我进行了 FFT,我如何从它提供给我的数据中获取频率信息?
编辑:我现在还找到了自相关算法。是不是更好了?更简单吗?
提前非常感谢,抱歉,我对此完全没有经验。我希望它至少有一点意义。
I want to make a program that would record audio data using PortAudio (I have this part done) and then display the frequency information of that recorded audio (for now, I'd like to display the average frequency of each of the group of samples as they come in).
From some research I've done, I know that I need to do an FFT. So I googled for a library to do that, in C, and found FFTW.
However, now I am a little lost. What exactly am I supposed to do with the samples I recorded to extract some frequency information from them? What kind of FFT should I use (I assume I'd need a real data 1D?)?
And once I'd do the FFT, how do I get the frequency information from the data it gives me?
EDIT : I now found also the autocorrelation algorithm. Is it better? Simpler?
Thanks a lot in advance, and sorry, I have absolutely no experience if this. I hope it makes at least a little sense.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要将音频样本转换为功率谱:
magnitude = sqrt(re^2 + im^ 2)
)magnitude_dB = 20*log10(magnitude)
)To convert your audio samples to a power spectrum:
magnitude = sqrt(re^2 + im^2)
)magnitude_dB = 20*log10(magnitude)
)