In the latest version of speex (www.speex.org), the echo elimination module is integrated, and echo elimination has always been a major problem to be solved in VoIP.
Many of my friends told me that the efficiency of the speex AEC module is not good. Let's take a look at the API call method of the speex AEC.
/*
* Create an AEC object
*/
Speexechostate * echo_state = speex_echo_state_init (frame_size, filter_length );
The value of frame_size is preferably the size of an encoded frame. In low bandwidth conditions, the latency is generally 20 ms, while the size is 160.
Filter_length, preferably 1/3 of the room internal reflection time
For example, the reflection latency of a room is 300 ms.
The filter_length should be 100 ms (this length is also called tail length ).
The filter_length setting is critical.
/*
* Execute AEC
*/
Speex_echo_cancel (echo_state, input_frame, echo_frame, output_frame, residue );
Where:
Input_frame: The sound captured by the sound card.
Echo_frame: The sound played by the speaker. This sound must be offset from input_frame.
Output_frame is the output sound after processing
Residue is an optional parameter. If this parameter is not used, you can set it to null or use Preprocessor to control it.
The key to the problem is to process the relationship between input and echo,
That is to say, the latency between the captured signal and the playback signal must be small enough to improve the efficiency.
Writetosndcard (echo_frame, frame_size)
Readfromsndcard (input_frame, frame_size)
Speex_echo_cancel (echo_state, input_frame, echo_frame, output_frame, residue)
If you want to reduce the echo in the signal as much as possible, you can set the residue parameter to the noise parameter.
I believe that in most cases, the audio quality is reduced because the synchronization problem between sound capture and sound playback is not well handled.
/*
* Destruction and resetting
*/
Speex_echo_state_destroy (echo_state );
Speex_echo_state_reset (echo_state );
I will not repeat it!
Note:
It is said that in the latest version 1.2beta of speex, speex provides selectable and simplified APIs to improve synchronization during echo execution.
I willArticleIn the discussion.