简体   繁体   English

从麦克风输入获取声音幅度和频率的最佳方法是什么?

[英]What is the best way to get amplitude and frequency of sound from microphone input?

I need to analyze the sound from iPhone microphone and draw noise histogram. 我需要分析iPhone麦克风的声音并绘制噪声直方图。 What frameworks I can use for it? 我可以使用哪些框架?

The simplest way is to use AVFoundation framework. 最简单的方法是使用AVFoundation框架。 There is AVAudioRecorder class which has method "peakPowerForChannel". 有AVAudioRecorder类,它具有方法“ peakPowerForChannel”。 You can find example of usage here https://github.com/dydus0x14/isandbox/blob/master/iOS/PeakVoiceView/PeakVoiceViewDemo/ViewController.swift : I hope it will help you. 您可以在这里找到用法示例https://github.com/dydus0x14/isandbox/blob/master/iOS/PeakVoiceView/PeakVoiceViewDemo/ViewController.swift :希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM