logo
Video Call
On this page

Audio 3A Processing

2025-03-05

Introduction

During real-time video calls or live streaming, audio can undergo 3A processing, mainly including AEC (Acoustic Echo Cancellation), AGC (Automatic Gain Control), and ANS (Active Noise Suppression), to improve call or live streaming quality and user experience.

  • AEC (Acoustic Echo Cancellation): Filters captured audio data to reduce echo in the audio.
  • AGC (Automatic Gain Control): After enabling this function, the SDK can automatically adjust the microphone volume to adapt to near and far sound pickup and maintain stable volume.
  • ANS (Active Noise Suppression): Identifies and eliminates background noise in the sound. After enabling this function, the voice can be clearer. You can also enable music scenario detection to identify communication and music scenarios in real time without consumption, further preserving the fidelity of human voice and music audio quality in music scenarios. If users need a more aggressive noise suppression strategy, you can use the Scenario-Based AI Noise Suppression feature.
Warning

If you need to use music scenario detection capability, please contact ZEGOCLOUD Technical Support for special packaging and configuration.

Download Sample Source Code

Please refer to Download Sample Source Code to obtain the source code.

For related source code, please check the files in the "/ZegoExpressExample/Examples/AdvancedAudioProcessing/AEC_ANS_AGC" directory.

The default configuration and recommended configuration for audio 3A processing in the SDK are as follows:

Interface NameInterface DescriptionDefault ConfigurationRecommended Configuration
enableAECTurn on/off acoustic echo cancellation.Before calling this function, the SDK internally automatically determines whether to use AEC. Once this function is called, the SDK no longer makes automatic determination.In general usage scenarios, it is recommended not to modify this configuration and keep the default.
setAECModeSet the acoustic echo cancellation mode.ZEGO_AEC_MODE_AGGRESSIVE (Aggressive echo cancellation).In general usage scenarios, it is recommended not to modify this configuration and keep the default.
enableAGCTurn on/off automatic gain control.Before calling this function, the SDK internally automatically determines whether to use AGC. Once this function is called, the SDK no longer makes automatic determination.
  • In normal voice chat scenarios, it is recommended to use the default configuration.
  • In music radio scenarios, it is recommended not to enable automatic gain control to restore the human voice.
  • In education scenarios, such as large classes, small classes, and 1v1, it is recommended to enable automatic gain control.
enableANSTurn on/off noise suppression.Before calling this function, the SDK internally automatically determines whether to use ANS. Once this function is called, the SDK no longer makes automatic determination.In general usage scenarios, it is recommended not to modify this configuration and keep the default.
enableTransientANSTurn on/off transient noise suppression.Before calling this function, transient noise suppression is not enabled by default.In general usage scenarios, it is recommended not to modify this configuration and keep the default.
setANSModeSet the audio noise suppression mode.ZEGO_ANS_MODE_MEDIUM (Moderate noise suppression).In general usage scenarios, it is recommended not to modify this configuration and keep the default.

Prerequisites

Before using audio 3A processing, ensure that:

Usage Steps

Set AEC (Acoustic Echo Cancellation)

Developers can complete echo cancellation related settings according to the following steps:

  1. Call the enableAEC interface to enable echo cancellation. After enabling this function, the SDK will filter the captured audio data to reduce echo in the audio.

  2. (Optional) Developers can set whether to enable echo cancellation when using headphones by calling the enableHeadphoneAEC interface.

  3. After enabling echo cancellation, developers can set the echo cancellation mode by calling the setAECMode interface. The SDK supports the following three echo cancellation modes:

    Enumeration ValueDescription
    ZEGO_AEC_MODE_AGGRESSIVEAggressive echo cancellation, which may significantly affect audio quality, but echo will be eliminated very cleanly.
    ZEGO_AEC_MODE_MEDIUMModerate echo cancellation, which may slightly affect audio quality a little bit, but residual echo will be less.
    ZEGO_AEC_MODE_SOFTComfortable echo cancellation, where echo cancellation basically does not affect the audio quality of the sound. There may sometimes be a little residual echo, but it will not affect normal listening.
Warning

Express SDK supports AI echo cancellation, which further improves the fidelity of human voice while effectively eliminating echo. If you need to use AI echo cancellation, please contact ZEGOCLOUD Technical Support for special packaging first.

Taking setting moderate echo cancellation as an example:

// Enable AEC
engine->enableAEC(true);
// Set AEC mode to ZEGO_AEC_MODE_MEDIUM
engine->setAECMode(ZEGO_AEC_MODE_MEDIUM);

Set AGC (Automatic Gain Control)

Call the enableAGC interface to enable automatic gain control. After enabling this function, the SDK can automatically adjust the microphone volume to adapt to near and far sound pickup and maintain stable volume.

// Enable AGC
engine->enableAGC(true);

Set ANS (Noise Suppression)

Developers can complete noise suppression related settings according to the following steps:

  1. Call the enableANS interface to enable noise suppression. After enabling this function, the voice can be clearer.

  2. (Optional) Developers can set whether to enable transient noise suppression by calling the enableTransientANS interface. Transient noise suppression is used to suppress transient noise such as keyboard typing and table tapping.

  3. After enabling noise suppression, developers can set the noise suppression mode by calling the setANSMode interface. The default value is "ZEGO_ANS_MODE_MEDIUM". The SDK supports the following three noise suppression modes:

    Enumeration ValueDescription
    ZEGO_ANS_MODE_AGGRESSIVEAggressive noise suppression, which may significantly damage audio quality, but has good noise suppression effects.
    ZEGO_ANS_MODE_MEDIUM(Default value) Moderate noise suppression, which may damage some audio quality, but has good noise suppression effects.
    ZEGO_ANS_MODE_SOFTLight noise suppression, which basically does not damage audio quality, but will leave some noise.
    Warning

    Express SDK supports AI mode noise suppression, providing three modes: lightweight mode, balanced mode, and low-latency mode. It effectively eliminates transient noise such as keyboards, coughing, wind, car horns, etc., while eliminating steady-state noise. For details, please refer to Scenario-Based AI Noise Suppression.

  4. (Optional) Enable music detection. Please contact ZEGOCLOUD Technical Support to configure and enable the music detection feature.

Taking setting light noise suppression as an example:

// Enable ANS
engine->enableANS(true);
// Enable transient noise suppression
engine->enableTransientANS(true);
// Set ANS mode to ZEGO_ANS_MODE_SOFT
engine->setANSMode(ZEGO_ANS_MODE_SOFT);

Previous

Ear Monitor and Channel Settings

Next

Voice Changer/Reverb/Stereo

On this page

Back to top