[Speex-dev] Speex echo cancellation: hi pass filtering? low latency?

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Mon Dec 7 15:57:40 PST 2009

Jakob Leben wrote:
> I tried to use speex echo canceller for a live performance setup to
> cancell feedback. My program buffers input until collecting a speex
> frame size of samples, then calls speex_echo_cancellation passing this
> buffer as input signal and previous speex output as echo signal, then
> immediately plays current speex output.
> First thing I noticed was huge high pass filtering. Then I found out
> there is a way to tell speex echo canceller my sampling rate and that
> remedied the filtering to large extent. I think the sampling rate
> setting should be documented in the tutorial.

There's a built-in high-pass filter to remove the DC. Make sure you set
the sampling rate parameter so that you use the right high-pass.

> Is speex made with usage at sampling rate of 44.1kHz and above in mind
> anyway?

The Speex *echo canceller* (we're not talking about the codec here) is
designed to work at any rate, though it's probably been better tuned for
8 kHz.

> Is there a way to avoid this hi pass filtering while keeping smaller
> in-out latency? Frame size of 20ms recommended in the tutorial is not
> very useful for live performance. How much does speex target closed
> loop, live music scenarios?

Well, you can use frames that are less than 20 ms. Also, it's not about
live or non-live music or speech. Your application is a bit different in
that the mic and reference signals are (almost) the same.

> I tried to use some other adaptive filters (LMS and NLMS) the same way I
> am using speex, but they didn't appear to do what I need. I was
> wondering therefore, what type of adaptive filtering does speex use
> internally for echo cancellation? Does the processing consist of more
> than only what is traditionally called an adaptive filter?

The Speex AEC uses the MDF algorithm, which is both faster and better
than NLMS (and non-normalised LMS is just not usable at all).

Hope that helps.


More information about the Speex-dev mailing list