开发者

microphone input listening on iOS, AVAudioRecorder or something else?

I'm wondering if there is a way to "listen" without recording and display the microphone's input levels?

Apples SpeakHere sample does the record and playback, and am wondering if there could a be a lighter version of just "listening" 开发者_如何学JAVAwithout actually recording and saving a file.


I use AudioQueues for this purpose. In your callback, get the input level like so:

AudioQueueLevelMeterState meter[NUM_INPUT_CHANNELS];
UInt32 dataSize = sizeof(meter);
AudioQueueGetProperty(aqInput, kAudioQueueProperty_CurrentLevelMeterDB, meter, &dataSize);
// input 'level' is in meter.mAveragePower

And simply don't write the audio into a file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜