Search code examples
iphoneaudio-recordingavaudiorecorder

How to dectect silence in AVAudioRecorder?


I use AVAudioRecorder for voice recording. Currently I use averagePowerForChannel and peakPowerForChannel to show a dynamic meter.

How can I detect silence (no body speaks for 1 second) and so I can stop the recording?


Solution

  • Well, if you are already showing a meter then surely you already have the answer?

    You could simply sum the last n readings where n is the number of readings you take per second and then if the value is less than some threshold you set, you can declare it silence.