[Speex-dev] echo cancellation

hs who_ami at o2.pl
Tue Oct 11 00:59:23 PDT 2005


I want to use speex for echo cancellation in my program, but I have bad  
I will explain what my program does. it is a client-server application.
I run a server in room A and a client in room B. the client sends some  
voice to the server and the server plays it on loudspeakers. I run another  
server in room B and connects to it from room A using the same application  
that runs server in room A. the client from room A records from microphone  
and sends the recorded voice to server in room B. the server in room B  
plays it on loudspeakers. in room A there is also another source of voice.  
so in room B I am listening everything that can be heared in room A. I  
hope this is clear.
the problem is that I don't want to hear in room B the voice that was  
played on loudspeakers by the server in room A. so I am using AEC on the  
client in room A on the voice that is recorded from microphone before  
sending to the client using the voice that was played on the loudspeakers  
as echo signal. I am using portaudio with directsound on windows xp and  
speex for AEC. portaudio has one callback function that is used for  
microphone and loudspeakers signals so they are in sync quite good. the  
bit rate I am using is 8000Hz, buffer length is 256 samples and filter  
length is 800 samples.
speex initialization:
st = speex_echo_state_init (NN, 800);
den = speex_preprocess_state_init (NN, 8000);

echo cancellation:
speex_echo_cancel (st, ptr, echo1[0], e_buf, noise);
speex_preprocess (den, e_buf, noise);

where ptr is a buffer that was recorded from microphone, echo1[0] is a  
buffer that was played on loudspeakers. the delay between ptr and echo1 is  
2 buffers (512 samples).
with this configuration I can still hear the echo signal (althought the  
signal is a little more silent. when using the delay 3 buffers the echo is  
still not cancelled and after few seconds I don't hear anything.
Can anyone help me with getting good results in echo cancellation?

thanks in advance for any suggestions

More information about the Speex-dev mailing list