# Speex echo cancellation takes a long time (~20s) to converge

I have been experimenting with Speex's echo canceller during the past few days.

I got the echo canceller to work, however, it takes a long time until it actually begins filtering out the echo. It seems like the adaptive filter takes a long time (~20s) to converge for some reason, after which it works quite well. I'm using a tail length of 100ms, but I tried changing that to shorter (and longer) - doesn't help.

Therefore I was thinking maybe I should save a working echo state to file, and read that everytime I start the app, instead of initialising an empty one every time. Does anyone have any experience with that? Speex has no built-in functionality to do that so I'm wondering whether this is even the right approach?

• how do you parameterice the echo canceller? Which frame_length, which filter_length value do you choose? – Marcus Müller Jan 13 '17 at 17:45
• As far as I can tell, the SpeexEchoState used with every single call from the echo cancelling API is exactly the state you'd want to save/restore, so uh, I'd say, yes, Speex does have a way of getting/setting echo cancellation state. Of course, it doesn't do IO for that – not its job, kind of. – Marcus Müller Jan 13 '17 at 17:47
• Then on secon thought, SpeexEchoState_ is pretty opaque, and contains pointer types. You might need to look into storing/restoring the right things only. – Marcus Müller Jan 13 '17 at 17:54
• hey @MarcusMüller, frame length is my buffer size, so 512 samples, and filter length is 100ms (samplerate/10). Sampling rate is 44100. I agree that speex shouldn't provide us the serialization/deserialization functions, but if this is a common thing to do then I would have expected to see some functions that would allow us to set the impulse response. – nevos Jan 13 '17 at 18:02
• Something similar to the SPEEX_ECHO_SET_SAMPLING_RATE macro but for the impulse response.. – nevos Jan 13 '17 at 18:04