This project has moved. For the latest updates, please go here.

Voice Activated Switch

Jan 17, 2013 at 7:37 AM

Hi Everyone,

I have to implement a sound recorder, that activates with sound and deactivates with silence. It is known as voice activated switch.

Is there anyone that has implemented this kind of algorithm before?

I have finished normal sound recording function, and for this time I have to implement this.

I have used NAudio library for all sound operations.

I will specify the level of sound that will be accepted and the software will wait for this level for start recording, then after if the level decreases below that level, apllication should save this part as a .wav file, and again starts to wait for the next sound, and it will continue like this.

If someone can help me, I will be appreciated.


Jan 21, 2013 at 6:11 AM

You start recording and every time you receive a buffer of audio, you examine the samples to find the maximum value (using BitConverter.ToInt16 to get sample values if it is 16 bit, and Math.Abs to get the absolute value of those samples). If the maximum value goes above a pre-decided value, then you go into "record" mode, and write the buffer to disk. If the maximum sample is below the threshold you go out of record mode and stop writing to disk. You may want to wait for a certain number of buffers of silence in a row before you stop recording depending on your needs.