AEC (Acoustic Echo Cancellation)

Supported ICs

Overview

Acoustic echo cancellation is one of the AFE’s functions, to cancel the sound played by the device itself picked up by the microphone known as echo.

AEC should be enabled in products supporting wake-up interruption, dialogue interruption, and similar functionalities.

Algorithm Description

The AEC in AIVoice consists of two submodules: Linear Echo Cancellation (AEC) and Residual Echo Suppression (RES) :

  • AEC (Echo Cancellation)

    • Module Description: The core module of AEC, responsible for linear echo cancellation.

    • Enable Condition: When the device is equipped with speaker and there are echo scenes, the AEC module should be enabled.

    • Spectrum when AEC module is off and on:

      ../../../_images/afe_aec_spectrogram.png
  • RES (Residual Echo Suppression)

    • Module Description: Nonlinear processing submodule of AEC for further suppressing the residual echo. When this module is enabled, echo suppression is enhanced, but speech distortion also increases.

    • Enable Condition: Varies depending on the AFE mode. RES module cannot be enabled individually when AEC is disabled.

      • Speech recognition: When the speaker plays with strong nonlinearity and high echo residue, the RES module can be enabled.

      • Voice communication: Except for special requirements, the RES module needs to be enabled to ensure call clarity.

    • Spectrum when RES module is off and on:

      ../../../_images/afe_aec_res_spectrogram.png

Configurations

The complete AFE configuration file is located at ${aivoice_lib_dir}/include/aivoice_afe_config.h. The AEC-related configurations include:

int ref_num;                            // reference channel number, must be 0 or 1. AEC will be disabled if ref_num=0.

afe_mode_e afe_mode;                    // AFE mode, for ASR or voice communication.
bool enable_aec;                        // AEC(Acoustic Echo Cancellation) module switch

// AEC module parameter
afe_aec_mode_e aec_mode;                // AEC mode, signal process or NN method. NN method is not supported in current version.
int aec_enable_threshold;               // ref signal amplitude threshold for AEC, the value should be in [0, 100].
                                        // larger value means the minimum echo to be cancelled will be larger.
bool enable_res;                        // AEC residual echo suppression module switch
afe_aec_filter_tap_e aec_cost;          // higher cost means longer filter length and more echo reduction
afe_aec_res_aggressive_mode_e res_aggressive_mode;  // higher mode means more residual echo suppression but more distortion

Note

If AEC is not required, Set related parameters as follows: enable_aec = false, ref_num = 0.