logo
Video Call
On this page

Audio 3A Processing

2026-03-05

Feature Introduction

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

  • AEC (Echo Cancellation): Filter the collected audio data to reduce echo in the audio.
  • AGC (Automatic Gain Control): After enabling this feature, the SDK can automatically adjust the microphone volume to adapt to near and far sound pickup and maintain stable volume.
  • ANS (Noise Suppression): Identify background noise in the sound and eliminate it. After enabling this feature, the human voice can be clearer. At the same time, you can enable music scene detection to identify communication and music scenes in real time without consumption, and further improve the fidelity of human voice and music sound quality in music scenes. If users need a more aggressive noise suppression strategy, they can use the Scenario-based AI Noise Suppression feature.
Warning

If you need to use music scene detection capabilities, please contact ZEGO technical support for special packaging and configuration.

Sample Source Code Download

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

For related source code, please check the files in the "/ZegoExpressExample/Examples/AdvancedAudioProcessing/AECANSAGC" 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 echo cancellation.Before calling this function, the SDK internally automatically determines whether AEC needs to be used. Once this function is called, the SDK no longer automatically determines.In general usage scenarios, it is recommended not to modify this configuration and keep the default.
enableHeadphoneAECWhether to enable echo cancellation when using headphones.Enabled.In normal voice chat or gaming sessions, it is recommended to enable this feature. In other cases, it is generally not necessary to enable it.
setAECModeSet echo cancellation mode.ZegoAECModeAggressive (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 AGC needs to be used. Once this function is called, the SDK no longer automatically determines.
  • 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 human voice.
  • In education scenarios, such as large classes, small classes, and 1v1, etc., it is recommended to enable automatic gain control.
enableANSTurn on/off noise suppression.Before calling this function, the SDK internally automatically determines whether ANS needs to be used. Once this function is called, the SDK no longer automatically determines.In general usage scenarios, it is recommended not to modify this configuration and keep the default.
enableTransientANSTurn on/off transient noise suppression.When this function is not called, 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 audio noise suppression mode.ZegoANSModeMedium (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, please ensure:

Usage Steps

Set AEC (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 feature, the SDK will filter the collected 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:

    EnumerationDescription
    ZegoAECModeAggressiveAggressive echo cancellation, may significantly affect sound quality, but echo will be eliminated very cleanly.
    ZegoAECModeMediumModerate echo cancellation, may slightly affect sound quality a little bit, but residual echo will be less.
    ZegoAECModeSoftComfortable echo cancellation, echo cancellation basically will not affect the sound quality of the sound, may sometimes leave a little residual echo, but will not affect normal listening.
Warning

Express SDK supports AI echo cancellation, which further improves the fidelity of human voice on the basis of effectively eliminating echo. If you need to use AI echo cancellation feature, please contact ZEGO technical support for special packaging first.

Taking setting moderate echo cancellation as an example:

// Enable AEC
[[ZegoExpressEngine sharedEngine] enableAEC:YES];
// Enable AEC when using headphones
[[ZegoExpressEngine sharedEngine] enableHeadphoneAEC:YES];
// Set AEC mode to ZegoAECModeMedium
[[ZegoExpressEngine sharedEngine] setAECMode:ZegoAECModeMedium];

Set AGC (Automatic Gain Control)

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

// Enable AGC
[[ZegoExpressEngine sharedEngine] enableAGC:YES];

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 feature, the human 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 noises such as typing on keyboards and tapping tables.

  3. After enabling noise suppression, developers can set the noise suppression mode by calling the setANSMode interface. The default value is "ZegoANSModeMedium".

    The SDK supports the following noise suppression modes:

    EnumerationDescription
    ZegoANSModeAggressiveAggressive noise suppression, may significantly damage sound quality, but has very good noise suppression effect.
    ZegoANSModeMediumModerate noise suppression, may damage some sound quality, but has good noise suppression effect.
    ZegoANSModeSoftLight noise suppression, basically will not damage sound quality, but will leave some noise.
    Warning

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

  4. (Optional) Enable music detection. Please contact ZEGO technical support to configure and enable the music detection feature.

Taking setting moderate noise suppression as an example:

// Enable ANS
[[ZegoExpressEngine sharedEngine] enableANS:YES];
// Enable transient noise suppression
[[ZegoExpressEngine sharedEngine] enableTransientANS:YES];
// Set ANS mode to ZegoANSModeMedium
[[ZegoExpressEngine sharedEngine] setANSMode:ZegoANSModeMedium];
2025-03-05

Previous

Headphone Monitor and Channel Settings

Next

Voice Changer/Reverb/Stereo

On this page

Back to top