Hi Jesus!
I had a similar expecience when trying to get AEC to work. It was quite
frustrating not knowing what the problem was. I had to do a lot of
experimentation to try and figure it out. I was getting no cancellation even
though the code seemed to be correct.
I was using windows multimedia winmm.dll (aka. wave audio) for recording and
playback. What I didn't know was that playback and recording was not
synchronized, even though I was doing full duplex on the same audio
interface with the same settings. If remember correctly I measured the clock
skew to about 3 ms per second. That makes echo cancellation impossible.
After switching to DirectSound I was able to get synchronized full duplex
recroding and playback.
Another observation I made was that the echo delay matters. I mean the delay
between committing the samples to the AEC and the AEC seeing the actual echo
in the recording. Obviously tail length is part of this and maybe it will
converge eventually even for long echo delays if the tail is long enough(?).
That is not what I observed however.
To compensate for this I buffer the echo/playback audio, for a time that
corresponds to the sum of the delays of the audio interface for
playback+recording, before commiting to the AEC tail. In other words the AEC
sees less delay between the signal in the tail and the signal in the
recording. This way I can use a shorter tail length also.
I will just end by adding that the Speex AEC perfoms very well when you get
it working.
Hope you can solve your problems.
//Greger
2009/10/8 jesus <yodejerez at gmail.com>
> 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;
> }
>
>
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.xiph.org/pipermail/speex-dev/attachments/20091013/dacdd19d/attachment.htm