[Speex-dev] svn AGC

Alfredo Moreira alfredo.moreira at neolinks.com
Thu Feb 15 08:28:35 PST 2007

Hi Jean Marc,

I've tested the new AGC, and I don't known if it's on purpose, but the 
value passed to SPEEX_PREPROCESS_SET_AGC_DECREMENT has to be negative 
for working correctly...
and obviouly if you pass a positive value, no decrement adjustement is 
I think this value should be absolute positive and you should take care 
at the internals of speex that
"max_decrease_step" should be between 0 and 1.
what i've done is changing the formula :
   st->max_decrease_step = exp(0.11513f * 
(*(spx_int32_t*)ptr)*st->frame_size / st->sampling_rate);
into :
   spx_int32 stepDB = (*(spx_int32_t*)ptr);
   if(stepDB<0) stepDB = 0;
   st->max_decrease_step = exp(-0.11513f *stepDB*st->frame_size / 

Tell me if it does make sense for you,

Jean-Marc Valin a écrit :

>>I found that the AGC API and algorithm has changed in svn head trunk.
>>Is it safe to use it? Or is it for testing purpose only?
>I think the new AGC code is much better than the previous one, but
>because I changed it a lot, I recommend doing some testing before doing
>anything serious with it.
>>You also said that VAD in svn is broken in a previous post, is it
>>related to the AGC change?
>>or can we mix the old VAD algorithm with the new AGC safely?
>The old (preprocessor) VAD has always been a combination of kludges,
>which I had to remove when improving the noise suppression recently. I
>still haven't figured out a good algorithm to re-write it. I'm open to
>suggestions on how to write a good VAD that can make decisions without
>having any more lookahead than the current frame.
>	Jean-Marc

More information about the Speex-dev mailing list