确定接收到的音频麦克风输入的频率
为了通过互联网搜索,我有足够的代码来记录音频麦克风输入。使用苹果示例代码中的“在这里说话”示例代码。我想要的是,我想在我的应用程序中显示(UILabel)中的频率。我有一个 ipod touch 第三代,我使用耳机麦克风录制音频。无论我通过麦克风收到什么输入,我都想在 UILabel 中显示其频率范围(hz)。我还下载了 aurio touch 代码,但都给出了一些查找频率的提示。没有人给出任何示例代码来在 auriotouch 中使用 fft 确定频率。我是 iphone 应用程序开发的新手。这是我的第一项任务,所以我想做好它。所以请指导我一种正确的方法来做到这一点。而且我也不了解数字信号处理。(我有一个双频,是否只能使用正弦波的绘制区域来确定频率,或者我们自己计算)。
对于长时间冲浪,我还有一个示例名称 SCListener ,在 github 中有源代码。当我下载并运行代码时,它显示平均功率、峰值功率和标签中显示的频率值。这是在我的代码中使用的正确示例吗?我不知道输出应该是赫兹还是千赫。
如何检查标签上显示的记录频率是否正确?
请帮助我........ 预先感谢...抱歉我的英语不好。
For searching over internet , i have enough code to record audio mic input.Using Speak here sample code from apple sample code.What i want is ,i want to display a Frequency in (UILabel) in my application. I have an ipod touch 3rd generation ,i record audio using Headphone mic.Whatever i received input over mic , i want to display its frequency range(hz) in UILabel. I also downloaded the code aurio touch but all give some tips to find frequency.No one gave any sample code to determine frequency using fft in auriotouch.I am new to iphone app development.This is my first task,so i want done it good.So plz guide me a right way to do this.And i am also didnt know about digital signal processing.(I have one doube , is it only possible to determine frequency using drawed area of sine wave or we calculate over own).
For long surfing i have got one more sample name SCListener , there is source in github.When i download and run the code it displayed averagePower,peakPower,and frequency values displayed in label.Is this correct example to use in my code ?And also i didnt know the output should be in hz or khz.
How to check the recorded frequency displayed in label should be correct ?
Plz plz help me ........
Thanks in advance..Sorry for my bad english.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用傅里叶变换。我知道最好的图书馆是 FFTW。
请记住,您不会获得单一频率;而是会获得单一频率。您将得到所有这些的混合,最高可达sample_rate/2。您需要一些算法来选择正确的尖峰。
在进一步深入之前,您可能需要退一步阅读奈奎斯特理论和信号处理(特别是 FFT),否则您会犯很多错误。
You need to use a Fourier transform. The best library I am aware is FFTW.
Remember, you're not going to get a single frequency; you'll get a mix of all of them up to sample_rate/2. You need some algorithm to pick the correct spike.
You may want to take a step back and read about Nyquist theory and signal processing (specifically FFT) before you go much further otherwise you're going to make a lot of mistakes.
检查频率标签是否显示正确值的一种方法是使用某种校准信号发生器进行测试。
您也许能够找到可以以已知频率播放正弦波的 Mac 或 PC 音频合成/生成器程序。尝试一下,并使用 iPod Touch 或 iOS 模拟器检查应用程序显示的结果。 (不要不要使用音乐声音来测试,它可能会产生一堆与识别的音调非常不同的频率。)
如果您有音频输入到 FFT 工作,并且正在测量某个频率如果正弦波比任何其他频谱内容响亮得多,您可以尝试确定幅度最大的 FFT bin(结果索引)。频率的非常近似估计为:
估计误差将与 (sample_rate / fft_length_in_samples) 成正比。
One way to check that your frequency label is displaying the correct value is to test it using some sort of calibrated signal generator.
You might be able to find a Mac or PC audio synthesis/generator program that can play a sine wave at a known frequency. Try it, and check the results displayed by your app using your iPod Touch or the iOS Simulator. (Do not use a musical sound to test, and it may produce a bunch of frequencies very different from the recognized pitch.)
If you have audio input to an FFT working, and are measuring the frequency of a sine wave much louder than any other spectral content, you can try determining the FFT bin (result index) with the largest magnitude. A very approximate estimate of the frequency will be:
The estimate error will be proportional to (sample_rate / fft_length_in_samples).