[Speex-dev] Echo Cancellation Problem -- with sound sample

Eddy eddyc98 at yahoo.com
Sat Sep 22 03:07:12 PDT 2007

Hello all,

I am trying out the echo cancellation of Speex (1.2beta2) on Windows XP. I use the Windows Media API (i.e. waveInOpen, waveOutOpen etc) for playback and capture, but I cannot make echo cancellation works in my use case. Here is a description of what I tried: (the sound is in 8kHz and 16 bits per sample, the frame size is 240, tail_length is long enough to cover the far end to near end delay)

Experiment 1:

A sine wave is generated in my test program (each frame has a random frequency). And the echo cancellation function is called:

speex_echo_cancellation(echo_state, input_frame, echo_frame, output_frame);

where input_frame has a delay of 4560 samples compared to echo_frame (i.e. 570 ms delay). I output the output_frame to Windows Media API and playback in my speaker. The echo cancellation performs quite well (around 10% noise/echo left).

Experiment 2:

A sine wave is generated in my test program (each frame has a random frequency). But different from Experiment 1, I have the sine wave playback in my speaker and then feedback to my microphone (by placing the microphone nearby the speaker). echo_frame is the sine wave, and input_frame is the distorted sound after going through my speaker and microphone.

This time, the echo cancellation is just like it does not exist. The output from speex_echo_cancellation is "similar" to input_frame ("similar" in term of what I hear).

I have adjusted the delay between echo_frame and input_frame so that the delay is small. Below is the output from echo_diagnostic.m:

octave-2.9.13.exe:61> echo_diagnostic('aec_rec2.sw', 'aec_play2.sw', 'aec_diagnostic.sw', 1024);
Far end to near end delay is 203 samples
Delay looks OK.
Drift estimate is 0.000000% (0 samples)
A drift of a few (+-10) samples is normal.

I do not have any clue to fix this problem now. I am sitting in front of my computer for 2 days, trying out different things, but still cannot make obvious improvement on echo cancellation. Is there anyone who have experience on this? Is there anything I can try? Since I do not know how echo cancellation in Speex works internally, I afraid there are some assumptions that I missed out.

I have a zip file ( http://idlechain.php0h.com/sound_sw.zip ) containing ace_rec2.sw and aec_play2.sw in Experiment 2. Possibly it helps finding out the problem.


      Yahoo! 全新升級網上相簿,讓你由相片中分享生活點滴,請前往http://hk.photos.yahoo.com 了解更多!

More information about the Speex-dev mailing list