[pulseaudio-discuss] module-echo-cancel

Arun Raghavan arun.raghavan at collabora.co.uk
Thu May 26 11:25:16 PDT 2011


On Thu, 2011-05-26 at 10:07 -0700, Baek Chang wrote:
> I'm trying to use the echo cancellation module on my embedded platform
> but it seems to be taking all the cpu usage and renders audio useless.
> 
> 
> I'm continually seeing these messages:
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.

This particular message is surprising. Was there a lot of feedback when
you saw this? It's also possible that your clock is drifting a lot and
is thus causing the echo canceller to give up. What hardware are you
trying this on?

> D: module-echo-cancel.c: diff -269 (43555 - 88163 + 44155) 0 0 9600
> 184
> E: module-echo-cancel.c: Playback after capture (-269), drop sink 84
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> D: module-echo-cancel.c: diff 475 (42663 - 87687 + 45315) 0 0 9600 184
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> D: module-echo-cancel.c: diff 168 (39254 - 87687 + 48410) 0 0 9600 191
> D: module-echo-cancel.c: diff -411 (38089 - 87687 + 49002) 0 0 9600
> 185
> E: module-echo-cancel.c: Playback after capture (-411), drop sink 112
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> D: module-echo-cancel.c: diff 1491 (41407 - 87052 + 46961) 0 0 9600
> 175
> E: module-echo-cancel.c: playback too far ahead (1491), drop source
> 260
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> warning: The echo canceller started acting funny and got slapped
> (reset). It swears it will behave now.
> D: module-echo-cancel.c: diff -1166 (44921 - 88526 + 42252) 0 0 9600
> 187
> E: module-echo-cancel.c: Playback after capture (-1166), drop sink 244
> 
> 
> cpu is at 90-100% at the highest cpu scaling.
> 
> 
> I was loading the module like so in my .pa conf file:
> 
> 
> load-module module-echo-cancel source_name=echosource
> source_master=pcm_input sink_name=echosink sink_master=pcm_output
> rate=44100 channels=2

Do you really need to work with 44.1 kHz stereo streams? Your voip stack
is probably working with 8 or 16 kHz audio and running in single channel
mode would probably not make a difference either. It will, however, make
a huge difference with respect to your CPU consumption.

I pushed some more preprocessing code to module-echo-cancel yesterday,
but there's a bit of a bug which I should be pushing a fix for by
tomorrow. Once that's done, you can try it out by passing agc=1 /
denoise=1 / echo_suppress=1. We're still looking at various potential
improvements to get AEC working better, and I'll try to post a status in
the coming weeks as things start to improve.

You may also want to play with aec_method=adrian, which is an alternate
canceller. It seems to learn faster than speex, but leaves a larger echo
residue compared to once speex has had sufficient time to learn.

Cheers,
Arun





More information about the pulseaudio-discuss mailing list