[Speex-dev] Fw: Voice Activation Level (speex

Tom Grandgent tgrand at canvaslink.com
Fri Aug 29 15:41:59 PDT 2008


I'm still here. :-)  Here's the function:

// Returns the average power level in the given signal
float getPower(signed short int *signal, int numSamples)
    int i;
    float amp;
    float powerSum = 0.0f;

    for (i = 0; i < numSamples; i++)
        amp = (float) abs(signal[i]);
        powerSum += amp * amp;

    return powerSum / (32768.0f * 32768.0f * (float) numSamples);

Note that you should determine an activation threshold experimentally 
and consider offering UI to adjust it, if possible.


manisha.tidke at aftek.com wrote:
> Hi
> I am facing the same problem as the speex VAD detecting background
> noises(far away speech data ) also and passing it ahead as voice. Can you
> please tell me where/how to use the calcPower or getPower function
> described by Tom?
> Thnks
> Regards
> Manisha

More information about the Speex-dev mailing list