Improve sound quality by using the AEC module in speex

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.