Jakob Leben
2009-Dec-07 15:13 UTC
[Speex-dev] Speex echo cancellation: hi pass filtering? low latency?
Hello, 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. Is speex made with usage at sampling rate of 44.1kHz and above in mind anyway? Secondly, there is still some hi pass filtering or at least coloration of sound, depending on the frame size setting. The larger the frame size the more low frequencies are passed through. Using frame size of 1024 samples at 44.1kHz sampling rate resulted in almost satisfactory output, though low frequencies were noticably attenuated even at frame size of 2048 samples or more. 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? I understand that speex is probably designed primarily for small communication devices with lower sampling rates and less demand for low latency. Nontheless, I must say that speex was one library that actually worked for me and was effective in echo/feedback cancellation! 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? Best regards, Jakob Leben -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20091207/ef58fd65/attachment.htm
Jean-Marc Valin
2009-Dec-07 23:57 UTC
[Speex-dev] Speex echo cancellation: hi pass filtering? low latency?
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. Jean-Marc