[Speex-dev] [patch] speex AEC state save & restore

Simon Morlat simon.morlat at linphone.org
Mon Apr 4 03:58:35 PDT 2011


Hi,

I implemented a small patch that allows the internal convergence state
of the echo canceller to be saved in a file for later use, especially
after a process restart or machine reboot. This enables immediate echo
cancellation the second time the AEC is run.

Of course this works only if the acoustic environment of the device
doesn't change and if the soundcard latency is constant.

To use this feature, proceeed as this:
 - use speex_echo_ctl() with SPEEX_ECHO_GET_BLOB to obtain a
SpeexEchoStateBlob, at the end of an audio session, when the echo
canceller is supposed to be converged.
 - save the blob to a disk file for example, using
speex_echo_state_blob_get_data() and speex_echo_state_blob_get_size() to
retrieve the actual data

To restore the state later, after a reboot or a process restart, do the
following:
 - read the data from the file where you previously save the blob's
contents
 - instanciate a blob object from this data using
speex_echo_state_blob_new_from_memory()
 - assign the blob to the echo canceller using speex_echo_ctl() with
SPEEX_ECHO_SET_BLOB, before the echo canceller starts processing data.

The way it works is that is saves the foreground weights of the echo
canceller filter. When restored, it is also restored in the background
filter. Some sanity checks on the configuration parameters ( frame size,
filter length, channels) are performed to verify that the restoration is
applicable to the current echo state object.
I wonder if there are parameters other than weights that should be saved
too. Feel free to comment, adapt, apply or reject.

On a side comment, I would like to congratulate the author(s) of the
Speex Echo Canceller, because it really works very well compared to
competition and provide good cancellation even in difficult situations.
The performance of the non-linear echo suppression with the
speex_preprocess() api is really amazing.

Best regards,

Simon

 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: echo_save_restore.patch
Type: text/x-patch
Size: 5906 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20110404/18b1954d/attachment.bin 


More information about the Speex-dev mailing list