iPhone SDK 通过 iPhone 麦克风测量频率

发布于 2024-09-08 19:50:12 字数 60 浏览 1 评论 0原文

我需要一种方法从麦克风获取频率并确定平均频率。有图书馆或其他东西可以处理这个问题吗?

谢谢

I need a way to get the frequency from the microphone and determine the average frequency. Is there a library or something to handle this?

Thanks

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

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

发布评论

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

评论(3

红颜悴 2024-09-15 19:50:12

如果您的目标是 iOS 4 及更高版本,Apple 现在包含 Accelerate 框架。来自 Apple 的“新增功能”页面:

http://developer.apple。 com/technologies/iphone/whats-new.html#api

加速

Accelerate 提供了数百种针对 iPhone 和 iPod touch 进​​行优化的数学函数,包括信号处理例程、快速傅里叶变换、基本向量和矩阵运算,以及用于分解矩阵和求解线性方程组的行业标准函数。

If you're targeting iOS 4 and above, Apple now includes the Accelerate framework. From Apple's "What's new" page:

http://developer.apple.com/technologies/iphone/whats-new.html#api

Accelerate

Accelerate provides hundreds of mathematical functions optimized for iPhone and iPod touch, including signal-processing routines, fast Fourier transforms, basic vector and matrix operations, and industry-standard functions for factoring matrices and solving systems of linear equations.

穿透光 2024-09-15 19:50:12

您需要使用 FFT,因此我建议您查看此问答:

你知道一个好的、高效的FFT吗?

You'll want to use an FFT, so I'd recommend looking at this Q&A:

Do you know a good and efficient FFT?

橘虞初梦 2024-09-15 19:50:12

您可以使用 EZAudio 类来获取频率
在此处下载演示
并使用此方法获取频率

- (void) fft:(EZAudioFFT *)fft updatedWithFFTData:(float *)fftData bufferSize:(vDSP_Length)bufferSize
 {
     float maxFrequency = [fft maxFrequency];

       NSString *noteName = [EZAudioUtilities noteNameStringForFrequency:maxFrequency
                                                                includeOctave:YES];
            dispatch_async(dispatch_get_main_queue(), ^{
                [audioPlotFreq updateBuffer:fftData withBufferSize:(UInt32)bufferSize];
            NSLog(@"Frequncy : %f Highest Note : %@",maxFrequency,noteName);
      });
 } 

You can use the EZAudio Class to get the Frequency
Download the Demo Here
and use this method to get Frequency

- (void) fft:(EZAudioFFT *)fft updatedWithFFTData:(float *)fftData bufferSize:(vDSP_Length)bufferSize
 {
     float maxFrequency = [fft maxFrequency];

       NSString *noteName = [EZAudioUtilities noteNameStringForFrequency:maxFrequency
                                                                includeOctave:YES];
            dispatch_async(dispatch_get_main_queue(), ^{
                [audioPlotFreq updateBuffer:fftData withBufferSize:(UInt32)bufferSize];
            NSLog(@"Frequncy : %f Highest Note : %@",maxFrequency,noteName);
      });
 } 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文