<div>Hi Jesus!<br></div><div><br></div><div>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.</div>
<div><br></div><div>I was using windows multimedia winmm.dll (aka. wave audio) for recording and playback. What I didn&#39;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.</div>
<div>After switching to DirectSound I was able to get synchronized full duplex recroding and playback.</div><div><br></div><div>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.</div>
<div><br></div><div>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. </div>
<div><br></div><div>I will just end by adding that the Speex AEC perfoms very well when you get it working.</div><div>Hope you can solve your problems. </div><div class="gmail_quote"><br></div><div class="gmail_quote">//Greger</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">2009/10/8 jesus <span dir="ltr">&lt;<a href="mailto:yodejerez@gmail.com">yodejerez@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
my VoIP system uses speex with framesize = 160 samples(20 ms) at 8khz,<br>
sending and receiving paquets of 1600 samples(200 ms).<br>
<br>
When I receive a packet, I buffered it (I have also tried with<br>
speex_echo_playback) before sending to the speaker.<br>
<br>
When I capture from microphone, I fist remove DC offset (I saw in OPAL<br>
sources) and then I call speex_echo_cancellation for every one of the 10<br>
&quot;minipackets&quot; (I have also tried to pass the entire 1600 samples packet<br>
but it produces heap corruption).<br>
I play with a DELAY(in ms) over the playback buffer, and tried a lot of<br>
different tail lenght.<br>
<br>
I have not obtained any minimal result of echo cancellation.<br>
<br>
Please, if anybody has tested AEC on a VoIP system, any suggestion will<br>
be wellcomed.<br>
<br>
<br>
the code seems like this:<br>
<br>
void ComprimeSpeex::CancelarEco(short *buffer, int tam)<br>
{<br>
    wxMutexLocker lock(mx_eco_state);<br>
<br>
    if(ecosize &gt;= tam+DELAY*8*2) // pass delay(milliseconds) to bytes<br>
    {<br>
        short *eco = (short*)bufeco+ecosize-tam-DELAY*8; // take from<br>
the last 10 frames - delay<br>
<br>
// pass entire packet --&gt; heap corruption<br>
//        speex_echo_cancellation(echo_state, (short*)buffer, eco,<br>
(short*)salida);<br>
<br>
// pass each 20 ms packet<br>
        for(int i=0;i&lt;1600;i+=160)<br>
        {<br>
            speex_echo_cancellation(echo_state, (short*)buffer+i, eco+i,<br>
(short*)salida+i);<br>
        }<br>
<br>
        // manage the buffer<br>
        ecosize -= tam;<br>
        if(ecosize &gt; 0)<br>
            memmove(bufeco, bufeco+tam, ecosize);<br>
        // return the result buffer<br>
        memcpy(buffer, salida, tam);<br>
    }<br>
    else<br>
        ecosize = 0;<br>
}<br>
<br>
<br>
<br>
_______________________________________________<br>
Speex-dev mailing list<br>
<a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>
<a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>
</blockquote></div><br><br>