C++ 使用 FFT 的实时音高检测
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1466968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Real-time pitch detection using FFT
提问by Niall
I'm trying to do real-time pitch detection using C++. I'm testing some code from performous (http://performous.org/), because everything else hasn't worked for me. I know for sure that this works, but i just cant get it to work. I've been trying this for a few weeks now, and I haven't been able to get any pitch detection code working.
我正在尝试使用 C++ 进行实时音高检测。我正在测试来自 performous ( http://performous.org/) 的一些代码,因为其他一切都对我不起作用。我确信这行得通,但我无法让它发挥作用。我已经尝试了几个星期了,但我一直无法让任何音高检测代码工作。
回答by Dan Hook
Instead of using input from the mic, you should create data of a known single frequency and run that through the program and see if it gets you the correct result. Then you can add harmonics to it and see if that works. Real world data is just too variable for initial testing.
不要使用来自麦克风的输入,您应该创建已知单一频率的数据并通过程序运行它,看看它是否能得到正确的结果。然后你可以向它添加谐波,看看是否有效。真实世界的数据对于初始测试来说变化太大。
回答by Tronic
Performous audio code has some optimizations, frequency limits and heuristics that make it only suitable for singing (and other similar tones). The optimal range is around 80-600 Hz.
Performous 音频代码有一些优化、频率限制和启发式方法,使其仅适用于唱歌(和其他类似的音调)。最佳范围约为 80-600 Hz。
回答by P i
C/C++/Obj-C Real-time algorithm to ascertain Note (not Pitch) from Vocal Input
C/C++/Obj-C 实时算法从人声输入中确定音符(不是音高)
Check the accepted answer on this link.
检查此链接上接受的答案。
I have scoured SO for an answer to this problem, and this is the most useful resource I have found.
我已经搜索了这个问题的答案,这是我找到的最有用的资源。
It appears that Performous uses this algorithm, but it's hard to make out from the Performous code
看起来 Performous 使用了这个算法,但很难从 Performous 代码中看出
EDIT: I have finally managed a working solution. e-mail me if interested sunfish|gmail|c0m
编辑:我终于管理了一个有效的解决方案。如果有兴趣,请给我发电子邮件 sunfish|gmail|c0m