算法来确定潜在的谐波的基本频率 [英] Algorithm to determine fundamental frequency from potential harmonics

查看:187
本文介绍了算法来确定潜在的谐波的基本频率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从声源中提取的基本频率。也许有人在唱A3对着麦克风,所以我想被检测〜110Hz

I am attempting to extract a fundamental frequency from a sound source. maybe someone is singing A3 into the microphone, so I want to be detecting ~ 110Hz

我的做法是:

  • 在FFT 1024彩车
  • 使用每个区间的相位准确地确定其precise频率
  • 确定峰(一般为50左右)
  • 为了他们最响亮的第一个

(峰值[0]。电力= 1063.343750,.freq = 2032.715088
(峰[1]。电力= 1047.764893,.freq = 3070.605225
(峰[2]。电力= 1014.986877,.fr​​eq = 5925.878418
(峰[3]。电力= 1011.707825,.freq = 6963.769043
(峰[4]。电力= 1009.152954,.freq = 4022.363037
(峰[5]。电力= 995.199585,.freq = 4974.120605
(峰[6]。电力= 987.243713,.freq = 8087.7​​92480
(峰值[7]。电力= 533.514832,.freq = 908.691833

(Peak[0].power=1063.343750, .freq=2032.715088
(Peak[1].power=1047.764893, .freq=3070.605225
(Peak[2].power=1014.986877, .freq=5925.878418
(Peak[3].power=1011.707825, .freq=6963.769043
(Peak[4].power=1009.152954, .freq=4022.363037
(Peak[5].power=995.199585, .freq=4974.120605
(Peak[6].power=987.243713, .freq=8087.792480
(Peak[7].power=533.514832, .freq=908.691833

  • (MARKER1)先从最响亮的,并匹配它所有剩余的峰值,所以如果我有N个峰值,我会在这一点上N-1的峰对
  • 检查每个峰对用于调和;也就是说,它是如何接近一些部分A / B,即可以发现A / B与B< 20,从而| peakA.freq / peakB.freq - A / B | < 0.01(这将赛中谐波到20的)
  • 我们现在被认为是谐波彼此峰精致列表

  • (MARKER1) start with the loudest, and match it against all remaining peaks, so if I had N peaks, I will have at this point N-1 peak-pairs
  • examine each peak-pair for harmonicity; ie how close is it to some fraction a/b, ie can we find a/b with b<20 such that |peakA.freq/peakB.freq - a/b| < 0.01 (this would match harmonics up to the 20th one)
  • we now have a refined list of peaks that are considered harmonic with one another

谐波PeakPair:(0,1)= 2/3的错误:0.00468 => F0 @ 1019.946289
  谐波PeakPair:(0,2)= 1/3,错误:0.00969 => f0的@ 2004.003906
  谐波PeakPair:(0,3)= 2/7,错误:0.00618 => F0 @ 1005.590820
  谐波PeakPair:(0,4)= 1/2,错误:0.00535 => f0的@ 2021.948242
  谐波PeakPair:(0,5)= 2/5的错误:0.00866 => F0 @ 1005.590820
  谐波PeakPair:(0,6)= 1/4,错误:0.00133 => f0的@ 2027.331543
  谐波PeakPair:(0,7)= 9/4,错误:0.01303 => F0 @ 226.515106

Harmonic PeakPair: (0,1)=2/3, error:0.00468 => f0 @ 1019.946289
Harmonic PeakPair: (0,2)=1/3, error:0.00969 => f0 @ 2004.003906
Harmonic PeakPair: (0,3)=2/7, error:0.00618 => f0 @ 1005.590820
Harmonic PeakPair: (0,4)=1/2, error:0.00535 => f0 @ 2021.948242
Harmonic PeakPair: (0,5)=2/5, error:0.00866 => f0 @ 1005.590820
Harmonic PeakPair: (0,6)=1/4, error:0.00133 => f0 @ 2027.331543
Harmonic PeakPair: (0,7)=9/4, error:0.01303 => f0 @ 226.515106

我的问题是:我怎么能设计一个算法,将正确识别上述基本为〜1000Hz的

My question is: how can I devise an algorithm that will correctly identify the above fundamental as ~1000Hz?

有没有任何保证将有值的更高浓度〜1000比在〜2000或3000〜等等它甚至不保证将有任何条目〜1000。我们可以有〜5000倍的一个条目,〜4000×3项,〜3000×2项,和几个假值左右浮动的,如上面的列表中的226。

It is by no means guaranteed that there will be a higher concentration of values at ~1000 than at ~2000 or ~3000 etc. it isn't even guaranteed that there will be any entry ~1000. we could have ~5000 x one entry, ~4000 x three entries, ~3000 x 2 entries, and a couple of bogus values floating around, like the 226 in the above list.

我想我可以再重复以上步骤,淘汰认为基本面不属于调和与列表的其余部分。这至少会摆脱假值...

I guess I can repeat the procedure again, weeding out suggested fundamentals which are not 'harmonic' with the rest of the list. this would at least get rid of the bogus values...

这可能是因为我还没有问正确的问题。也许这整个方法很烂。但我认为这是有道理挑最强峰和提取一组与该峰相关的谐波。

it may be that I'm not even asking the right question. Maybe this whole approach sucks. But I think it makes sense to pick the strongest peak and extract a set of harmonics associated with that peak.

在理论上应该产生比的负荷,如果说原来的最强峰是如何的三次谐波,那么这组峰应该包含3/1 3/2 3/3 3/4 3/5 3/6 3 / 7等......虽然一些可能会丢失。

in theory that should generate a load of ratios, say if how original strongest peak was the third harmonic, then this set of peaks should contain 3/1 3/2 3/3 3/4 3/5 3/6 3/7 etc ... although some may be missing.

现实我有一种感觉它总是将是任何一个根本的还是具有最大强度的一次谐波。但我不知道我能不能靠这个...

realistically I have a feeling it's always going to be either a fundamental or the first harmonic that has the greatest strength. but I don't know if I can rely on this...

这么多的因素,它使我的头游泳。我提前为这种混乱的问题深表歉意。希望我能追授整理起来。

so many factors, it is making my head swim. I apologise in advance for such a messy question. Hopefully I can tidy it up posthumously.

推荐答案

我还改写了问题,这里给出了一个答案:<一href="http://stackoverflow.com/questions/4838357/how-to-take-in-a-set-of-numbers-like-301-102-99-202-198-103-and-throw-out-100">How采取一组数字,如{301,102,99,202,198,103},扔掉〜100?

I have rephrased the question, and provided an answer here: How to take in a set of numbers like {301,102,99,202,198,103} and throw out ~100?

我已经看了几个方法,这是相当多的简洁比什么都重要,我发现。我已经测试它,它工作得很好。

I had looked at several approaches, and this is considerably more succinct than anything else I've found. I have tested it and it works very well.

这篇关于算法来确定潜在的谐波的基本频率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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