开发者

microphone input listening on iOS, AVAudioRecorder or something else?

开发者 https://www.devze.com 2023-02-01 12:29 出处:网络
I\'m wondering if there is a way to \"listen\" without recording and display the microphone\'s input levels?

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

精彩评论

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

关注公众号