I have to detect speech intervals in large pre-recorded files in my project. I think, there won't be so much noise in the background (audio will be recordered in the room or even in the studio), but it still can be.

So, what are good VAD algorithms that I can use (algorithms, not libraries)?

  • $\begingroup$ If you found an answer helpful, you're generally encourages to accept it. $\endgroup$
    – Phonon
    May 23, 2014 at 2:56

1 Answer 1


Depending on the actual recordings, the algorithm complexity could range from dead easy to really complex...

I'll take the studio recording case first, so I can assume : - (Almost) no noise coming from outside (cars, trucks, bus...) - Nobody slamming the door in the middle of the recording - Voice samples are recorded at optimal level independently of who is speaking (some ppl speak very low, others loud and clear)

If that's the case, then you could implement the logic of what sound engineers call a noise gate : below a certain audio power threshold, it's silence, otherwise it's not. You'd have to calculate mean power over a very small window and check it against the threshold. Probably take safety margins around "speeched" areas so you don't cut the start/end of the words.

Determining the correct threshold is a manual process involving trials and errors.

Noise gates sometimes use 2 different thresholds : one to determine speech has started and another to determine speech has stopped. The second one being lower than the first one so it doesn't stop in the middle of a word.

Determining threshold(s) for different files recorded at different levels (because of different speakers) might become tricky. One way to help is to first normalize the volumes : i.e. check for the max value and apply gain in order to bring this value to the max authorized one in the range you're working with (might be -1.0 to 1.0 or 0.0 to 1.0 or signed/unsigned integer values).

Another thing to define is the minimum length of "speeched" areas and the minimum length of silent areas.

If there's a bit more background noise (and I assume the noise volume doesn't change too much over time), you could use the property of white noise when calculating autocorrelation factors : it's mean value goes close to zero

Here is an example of "brute force" autocorrelation

int n = vocalSample.length;
for (int j = 0; j < n; j++) {
    for (int i = 0; i < n; i++) {
        correllation[j] += vocalSample[i] * vocalSample[(n + i - j) % n];

then calculate mean value of the array.

Do this for very small arrays (e.g. 1ms at 22KHz -> 22 values), otherwise it will take ages.

I actually used this technique with some success on Ted talks to remove silence in order to perform speaker identification.

If you have hours and hours of recording, you might consider multithreading your calculations :-) In my calculations (remove noise, normalize, extract vocal print), I crunched 10Gb in about 8 minutes using 8 worker threads.

State-of-the-art vad is something beyond what could be explained here, here is a link to an extremely interesting IEEE article on the subject : http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6403507&punumber%3D97


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.