[Speex-dev] 2 weeks lost in the AEC world
jesus
yodejerez at gmail.com
Thu Oct 8 03:55:01 PDT 2009
Hi,
my VoIP system uses speex with framesize = 160 samples(20 ms) at 8khz,
sending and receiving paquets of 1600 samples(200 ms).
When I receive a packet, I buffered it (I have also tried with
speex_echo_playback) before sending to the speaker.
When I capture from microphone, I fist remove DC offset (I saw in OPAL
sources) and then I call speex_echo_cancellation for every one of the 10
"minipackets" (I have also tried to pass the entire 1600 samples packet
but it produces heap corruption).
I play with a DELAY(in ms) over the playback buffer, and tried a lot of
different tail lenght.
I have not obtained any minimal result of echo cancellation.
Please, if anybody has tested AEC on a VoIP system, any suggestion will
be wellcomed.
the code seems like this:
void ComprimeSpeex::CancelarEco(short *buffer, int tam)
{
wxMutexLocker lock(mx_eco_state);
if(ecosize >= tam+DELAY*8*2) // pass delay(milliseconds) to bytes
{
short *eco = (short*)bufeco+ecosize-tam-DELAY*8; // take from
the last 10 frames - delay
// pass entire packet --> heap corruption
// speex_echo_cancellation(echo_state, (short*)buffer, eco,
(short*)salida);
// pass each 20 ms packet
for(int i=0;i<1600;i+=160)
{
speex_echo_cancellation(echo_state, (short*)buffer+i, eco+i,
(short*)salida+i);
}
// manage the buffer
ecosize -= tam;
if(ecosize > 0)
memmove(bufeco, bufeco+tam, ecosize);
// return the result buffer
memcpy(buffer, salida, tam);
}
else
ecosize = 0;
}
More information about the Speex-dev
mailing list