AurioTouch 和用于乐器调音器的 FFT

发布于 2024-10-30 07:58:18 字数 284 浏览 4 评论 0原文

我正在尝试编写一个简单的调谐器(不,不是为了制作另一个调谐器应用程序),并且正在查看 AurioTouch 示例源(有人尝试评论此代码吗??)。

我担心的是,在查看频域图时,aurioTouch 似乎实际上工作得不太好。我在乐器上演奏单个音符,但没有看到一组有序的、小的频率,其中一个弦峰值位于音符的适当频率处。

有没有人足够使用 aurioTouch 来了解底层代码是否有效或者它是否只是一个粗略的示例?

我的其他选择是使用 FFTW 或 KISS FFT。有人有这方面的经验吗?

谢谢。

I'm trying to write a simple tuner (no, not to make yet another tuner app), and am looking at the AurioTouch sample source (has anyone tried to comment this code??).

My worry is that aurioTouch doesn't seem to actually work very well when looking at the frequency domain graph. I play a single note on an instrument and I don't see a nicely ordered, small, set of frequencies with one string peak at the appropriate frequency of the note.

Has anyone used aurioTouch enough to know whether the underlying code is functional or whether it is just a crude sample?

Other options I have are to use FFTW or KISS FFT. Anyone have any experience with those?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

奢华的一滴泪 2024-11-06 07:58:18

你期待的是错误的事情!

不是图书馆的错

无论图书馆是否正确生成它,您都在寻找一种在现实生活中的声音中很少存在的模式。只有电子生成的完美正弦波才会在频率中引起均匀的中途离散出现“尖峰”。图形。如果您不相信它,请尝试在 winamp 或媒体播放器中启动“频谱分析仪”可视化。这并不是PC的错。

真正的声波是复杂的动物

在你的脑海中想象锯齿波或方波。那些急剧的转变——波上的角点或点,对于 FFT 甚至是真正的傅里叶来说,看起来就像大量的高次谐波。如果您曾经在示波器上见过真正的“方波/锯齿波”,甚至是由应该产生正弦波的仪器产生的“正弦波”,请看一下所有尖锐的角落和缝隙一个音符(如果你没有瞄准镜,就大胆地放大波浪 - 放大得越多,你看到的音符就越高)。是的,这些偏差都算作频率。

有时在频谱分析中很难区分一个音符和整个管弦乐队。

但我听到的是单音!

那么耳朵是如何做到这一点的呢?它考虑整个波形。然后你的下脑向你的上脑谎报输入内容:一个音符,而不是一堆泛音。

你无法完全做到这一点,但你可以通过“训练”来近似它。

近似:构建一些智能

在乐器上演奏音符并“保存”频率图。对多个频率范围内的音符执行此操作,或者更好的是对所有音符执行此操作。

然后通过将该乐器保存的图表乘以 2^(1/12)(或 1/24 表示 1/4 步长等)来插入音符以填补空白(按 1/2 或 1/4 步长)。

弄清楚如何将它们存储在可快速搜索的数据结构(例如 BST 或 trie)中。只是它必须返回“这个分数有多接近”。它还必须通过频率比例来识别匹配,以防它的数量不同。

使用智能

下次您要从该乐器中查找音符时,只需获取“听到的”频率图并在该数据结构中找到它即可。您可以录制多种产生不同波形的乐器并搜索它们。如果有背景声音或多个音符,请选择最接近的匹配。然后,如果您想识别其他音符,请从采样的音符中“减去”找到的频率模式,然后冲洗,重复泡沫。

它不会通过你的声音起作用......

如果你曾经尝试通过对着吉他调音器唱歌来调整自己,你就会知道调音器并不那么聪明。当然,有些乐器(尤其是声音)确实在音高上浮动并产生不断变化的波形(即使没有人唱歌)。

你想实现什么目标?

您不必完全喜欢“简单”的调音器应用程序,但如果您不只是制作另一个调音器应用程序,我猜您实际上想识别音符(例如,也许您想从收音机里的歌曲;-)

祝你好运。我希望你找到一个可以完成所有这些垃圾的库,而不必自己动手。

编辑2017

请注意此网页:http://www.feilding。网/sfuad/musi3012-01/html/lectures/015_instruments_II.htm
页面下方有各种风琴管的频谱分析。有很多很多的暗示。如果您首先用它们“训练”您的应用程序,那么通过足够的工作,这些是可以检测到的(就像告诉孩子,“这就是单簧管的声音......”)

You're expecting the wrong thing!!

Not the library's fault

Whether the library produces it properly or not, you're looking for a pattern that rarely actually exists in real-life sounds. Only a perfect sine wave, electronically generated, will cause an even partway discrete appearing 'spike' in the freq. graph. If you don't believe it try firing up a 'spectrum analyzer' visualization in winamp or media player. It's not so much the PC's fault.

Real sound waves are complicated animals

Picture a sawtooth or sqaure wave in your mind's eye. those sharp turnaround - corners or points on the wave, look like tons of higher harmonics to the FFT or even a real fourier. And if you've ever seen a real 'sqaure wave/sawtooth' on a scope, or even a 'sine wave' produced by an instrument that is supposed to produce a sinewave, take a look at all the sharp nooks and crannies in just ONE note (if you don't have a scope just zoom way in on the wave in audacity - the more you zoom, the higher notes you're looking at). Yep, those deviations all count as frequencies.

It's hard to tell the difference between one note and a whole orchestra sometimes in a spectrum analysis.

But I hear single notes!

So how does the ear do it? It considers the entire waveform. Then your lower brain lies to your upper brain about what the input is: one note, not a mess of overtones.

You can't do it as fully, but you can approximate it via 'training.'

Approximation: building some smarts

PLAY the note on the instrument and 'save' the frequency graph. Do this for notes in several frequency ranges, or better yet all notes.

Then interpolate the notes to fill in gaps (by 1/2 or 1/4 steps) by multiplying the saved graphs for that instrument by 2^(1/12) (or 1/24 for 1/4 steps, etc).

Figure out how to store them in a quickly-searchable data structure like a BST or trie. Only it would have to return a 'how close is this' score. It would have to identify the match via proportions of frequencies as well, in case it came in different volumes.

Using the smarts

Next time you're looking for a note from that instrument, just take the 'heard' freq graph and find it in that data structure. You can record several instruments that make different waveforms and search for them too. If there are background sounds or multiple notes, take the closest match. Then if you want to identify other notes, 'subtract' the found frequency pattern from the sampled one, and rinse, lather repeat.

It won't work by your voice...

If you ever tried to tune yourself by singing into a guitar tuner, you'll know that tuners arent that clever. Of course some instruments (voice esp) really float around the pitch and generate an ever-evolving waveform (even without somebody singing).

What are you trying to accomplish?

You would not have to totally get this fancy for a 'simple' tuner app, but if you're not making just another tuner app them I'm guessing you actually want to identify notes (e.g., maybe you want to autogenerate midi files from songs on the radio ;-)

Good luck. I hope you find a library that does all this junk instead of having to roll your own.

Edit 2017

Note this webpage: http://www.feilding.net/sfuad/musi3012-01/html/lectures/015_instruments_II.htm
Well down the page, there are spectrum analyses of various organ pipes. There are many, many overtones. These are possible to detect - with enough work - if you 'train' your app with them first (just like telling a kid, 'this is what a clarinet sounds like...')

下雨或天晴 2024-11-06 07:58:18

aurioTouch 看起来很奇怪,因为频率轴是线性刻度的。当 x 轴不是对数刻度(传统上为 log2)时,很难解释 FFT 输出。

如果您无法使用 aurioTouch 的整数 FFT,请查看我的库:
http://github.com/alexbw/iPhoneFFT

它使用双精度,支持多窗口类型,并实现 Welch 方法(随着时间的推移,该方法应该为您提供更稳定的光谱)。

@zaph,FFT 确实计算了真正的离散傅里叶变换。它只是一种利用数字信号按位表示的有效算法。

aurioTouch looks weird because the frequency axis is on a linear scale. It's very difficult to interpret FFT output when the x-axis is anything other than a logarithmic scale (traditionally log2).

If you can't use aurioTouch's integer-FFT, check out my library:
http://github.com/alexbw/iPhoneFFT

It uses double-precision, has support for multiple window types, and implements Welch's method (which should give you more stable spectra when viewed over time).

@zaph, the FFT does compute a true Discrete Fourier Transform. It is simply an efficient algorithm that takes advantage of the bit-wise representation of digital signals.

踏月而来 2024-11-06 07:58:18

FFT 使用频率仓,仓频率宽度基于 FFT 参数。要找到频率,您需要以至少两倍于样本中最高频率的速率记录它。然后找出循环之间的时间。如果它不是纯频率,这当然会更困难。

FFTs use frequency bins and the bin frequency width is based on the FFT parameters. To find a frequency you will need to record it sampled at a rate at least twice the highest frequency present in the sample. Then find the time between the cycles. If it is not a pure frequency this will of course be harder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文