logo
On this page

Audio 3A Processing

2026-03-05

Feature Overview

During real-time audio/video calls or live streaming, 3A processing can be performed on audio, 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): Filter collected audio data to reduce echoes in the audio.
  • AGC (Automatic Gain Control): After enabling this feature, the SDK can automatically adjust microphone volume to adapt to near and far sound pickup, maintaining stable volume.
  • ANS (Noise Suppression): Identify background noise in sound and eliminate it. After enabling this feature, human voice can be clearer. At the same time, you can enable music scenario detection to identify communication and music scenarios in real time without consumption, and further fidelity the sound quality of human voice and music in music scenarios. If users need more aggressive noise reduction strategies, they can use the Scenario-based AI Noise Reduction feature.
Warning

To use the music scenario detection capability, please contact ZEGO Technical Support for special packaging and configuration.

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 will automatically determine whether to use AEC. Once this function is called, the SDK will no longer automatically determine.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 ordinary voice chat or gaming scenarios, it is recommended to enable this feature. In other cases, it is generally not necessary to enable.
setAECModeSet echo cancellation 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 will automatically determine whether to use AGC. Once this function is called, it will no longer automatically determine.
  • In ordinary 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, it is recommended to enable automatic gain control.
enableANSTurn on/off noise suppression.Before calling this function, the SDK will automatically determine whether to use ANS. Once this function is called, it will no longer automatically determine.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.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, please ensure:

Usage Steps

Set AEC (Acoustic Echo Cancellation)

Warning

enableAEC, enableHeadphoneAEC, and setAECMode all need to be called before startPublishingStream, startPlayingStream, and startPreview interfaces to take effect.

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

  1. Call the enableAEC interface to enable echo cancellation. After this feature is enabled, the SDK will filter the collected audio data to reduce echoes in the audio.

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

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

    Enumeration ValueDescription
    AggressiveAggressive echo cancellation, may significantly affect sound quality, but echoes will be eliminated very cleanly.
    MediumModerate echo cancellation, may slightly affect sound quality a little bit, but residual echoes will be less.
    SoftComfortable echo cancellation, echo cancellation basically will not affect the sound quality of the sound, may sometimes leave a little echo, but will not affect normal listening.

Taking setting moderate echo cancellation as an example:

// Enable AEC
this.engine.enableAEC(true)

// Enable AEC when using headphones
this.engine.enableHeadphoneAEC(true)

// Set AEC mode to Medium
this.engine.setAECMode(ZegoAECMode.Medium)

Set AGC (Automatic Gain Control)

Warning

enableAGC needs to be called before startPublishingStream, startPlayingStream, and startPreview interfaces to take effect.

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

// Enable AGC
this.engine.enableAGC(true)

Set ANS (Noise Suppression)

Warning

enableANS, enableTransientANS, and setANSMode all need to be called before startPublishingStream, startPlayingStream, and startPreview interfaces to take effect.

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

  1. Call the enableANS interface to enable noise suppression. After this feature is enabled, human voice can be clearer.

  2. (Optional) Developers can call the enableTransientANS interface to set whether to enable transient noise suppression. Transient noise suppression is used to suppress transient noises such as typing on keyboards, tapping tables, etc.

  3. After enabling noise suppression, developers can call the setANSMode interface to set the noise suppression mode.

    The SDK supports the following four noise suppression modes:

    Enumeration ValueDescription
    AggressiveAggressive noise suppression, may significantly damage sound quality, but has good noise reduction effects.
    MediumModerate noise suppression, may damage some sound quality, but has good noise reduction effects.
    SoftLight noise suppression, basically will not damage sound quality, but will leave some noise.
    AIAI mode noise suppression, will cause great damage to music, can be used to process non-steady-state noise, but cannot be used for sound source processing that needs to collect background sound. For details, please refer to Scenario-based AI Noise Reduction.

Taking setting moderate noise suppression as an example:

// Enable ANS
this.engine.enableANS(true)

// Enable transient noise suppression
this.engine.enableTransientANS(true)

// Set ANS mode to ZegoANSModeMedium
this.engine.setANSMode(ZegoANSMode.Medium)
  1. (Optional) Enable music detection. Please contact ZEGO Technical Support to configure and enable the music detection feature.

Previous

Traffic Control

Next

Scenario-based AI Noise Reduction

On this page

Back to top