Make an audio recorder with voice activity detection

I was often asked about a question about Active Audio Record component: Can I detect the input audio level without start recording?

The answer is NO. The reason is that if the recording is not started, sound card doesn’t sample any input signal then no audio level can be returned.

So does it mean you have to record many non-sense silence data into your audio files? Surely not. :)

We have considered the scenerio from very beginning design of Active Audio Record. Silence detection (so called voice activity detection) is an important feature in the component.  You can easily make a typical audio recorder with voice activity detection by integrating Active Audio Record. The detailed steps are:

 

1 . Create an Active Audio Record object, set the appropriate device index and input source device line. (microphone or wavemix etc)

2. call SetDetectSilence(TRUE) to enable silence detection. Don’t forget to SetSilenceLevel as well. Silence definition varies with the environment you are in or the audio signal you cares about.

3. Set a timer to monitor the recording status 

4. Now start recording by calling StartRecord. Since silence detection is enabled, the initial silence audio data will not be saved into audio file.

5. In the timer callback function, you can call GetRecordTime to determine how many audio data have been saved and call GetSilenceTime to get how many silence have been detected currently. Note, this silence length is not accumulated. If some non-silence data come in, the silence length will be reset to zero. So you can use this silence length to determine whether or not stop recording or split audio tracks by silence.

 

DSCN1290.JPG