问题描述
我一直在寻找的检测盛入麦克风声音的音调不同的方法。
I have been looking at different methods of detecting the pitch of a tone sung into the microphone.
看到,因为我想找到它与特定的间距类多么紧密的共鸣,我不知道如果我可以做某种形式的基于物理学的共振算法。
Seeing as I want to find how closely it resonates with a particular pitch class, I wonder if I could do some sort of physics-based resonance algorithm.
如果你按住维持在钢琴踏板,唱一个调子进去,(如果你足够接近其现有球场的)一个音符将产生共鸣同情。
If you hold down to sustain pedal on the piano, and sing a tone into it, (and if you are close enough to one of its existing pitches) a note will resonate sympathetically.
我很想能够模拟这种行为。但如何将我去的任务是什么?谁能帮我搬这个前进?
I would love to be able to model this behaviour. But how would I go about the task? Can anyone help me move this forward?
推荐答案
一个有趣的解决方案,我发现仅仅是喂养麦克风输入到Karplus强大的算法。
One interesting solution I found is simply feeding the microphone input into a Karplus Strong algorithm.
所以Karplus强通过模拟弹拨:
So Karplus Strong simulates a plucked string by:
- 创建一个循环缓冲区(如果我们在取样44.1千赫,我们希望来模拟中间一个,即A4是440Hz的,那么我们的缓冲区大小为〜101元)
- 填充它充满了静态-1到1之间
- 走圈,每次的当前值设置为的previous 2的平均值,(和发射电流值至扬声器)
- 在一个恒定的阻尼可以加入
现在,如果我们加上麦克风流到这个过程,所以:
Now if we add the microphone stream into this process, so:
x = ( ringBuf[prev] + ring theBuf[prev2] ) * 0.5 * 0.998;
micOut[moPtr++] = x;
ringBuf[curr] = x + micIn[miPtr++];
它实际上是模仿唱歌变成吉他真的准确。如果你在得到你的语气点,它真实地哀号。
It actually simulates singing into a guitar really accurately. if you get your tone spot on, it truly wails.
但是有一个严重的问题,这种方法:考虑以100元的缓冲器产生的间距,并通过101元的缓冲区产生。没有办法以产生这两个值之间的任何间距。我们仅限于离散的工作设置间距。而这将是pretty的准确低音符(A2将有〜400缓冲区长度),更高才好更多的错误:A7将有〜12.5缓冲区长度。该错误可能是在一个半音。
But there is a severe problem with this approach: consider the pitch generated by a buffer of 100 elements, and that generated by a buffer of 101 elements. there is no way to generate any pitch in between these two values. we are limited to a discrete working set Of pitches. while this is going to be pretty accurate for low notes (A2 would have a buffer length of ~400), the higher we go the more the error: A7 would have a buffer length of ~12.5. That error is probably over a semitone.
我看不出有什么办法对付这个问题。我认为,这种方法已被删除。
I cannot see any way of countering this problem. I think the approach has to be dropped.
这篇关于共振算法来检测间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!