Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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" without actually recording and saving a file.

like image 762
Bryan Avatar asked Oct 14 '22 19:10

Bryan


1 Answers

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.

like image 83
Art Gillespie Avatar answered Oct 18 '22 02:10

Art Gillespie