logo
Video Call
On this page

Audio 3A Processing

2025-03-05

Feature Overview

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

  • AEC (Acoustic Echo Cancellation): Filter the captured 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 keep the volume stable.
  • 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 scenario detection to identify communication and music scenarios in real time without consumption, and further improve the fidelity of human voice and music sound quality in music scenarios. 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 the music scenario detection capability, please contact ZEGOCLOUD Technical Support for special packaging and configuration.

Example Source Code Download

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

For related source code, please check the files in the "/ZegoExpressExample/AdvancedAudioProcessing/src/main/java/im/zego/advancedaudioprocessing/audio3a" 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 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 acoustic echo cancellation when using headphones.Not 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 it.
setAECModeSet acoustic echo cancellation mode.ZegoAECMode.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, the SDK 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.ZegoANSMode.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)

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

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

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

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

    Enumeration ValueDescription
    ZegoAECMode.AGGRESSIVEAggressive echo cancellation, which may obviously affect sound quality, but echo will be eliminated very cleanly.
    ZegoAECMode.MEDIUMModerate echo cancellation, which may slightly affect sound quality a little bit, but residual echo will be less.
    ZegoAECMode.SOFTComfortable echo cancellation, which basically will not affect the sound 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 on the basis of effectively eliminating echo. If you need to use the AI echo cancellation feature, please contact ZEGOCLOUD Technical Support for special packaging first.

Taking setting moderate echo cancellation as an example:

// Enable AEC
engine.enableAEC(true);
// Enable AEC when using headphones
engine.enableHeadphoneAEC(true);
// Set AEC mode to ZegoAECMode.MEDIUM
engine.setAECMode(ZegoAECMode.MEDIUM);

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 keep the volume stable.

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

  3. After enabling noise suppression, developers can call the setANSMode interface to set the noise suppression mode. The default value is "ZegoANSMode.MEDIUM". The SDK supports the following noise suppression modes:

    Enumeration ValueDescription
    ZegoANSMode.AGGRESSIVEAggressive noise suppression, which may obviously damage sound quality, but has a very good noise suppression effect.
    ZegoANSMode.MEDIUM(Default value) Moderate noise suppression, which may damage some sound quality, but has a good noise suppression effect.
    ZegoANSMode.SOFTLight noise suppression, which 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. On the basis of eliminating steady-state noise, it effectively eliminates transient noise, such as keyboards, coughing, wind, car horns, etc. 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 ZegoANSMode.SOFT
engine.setANSMode(ZegoANSMode.SOFT);

Previous

Headphone Monitor and Audio Channel Settings

Next

Voice Changer/Reverb/Stereo

On this page

Back to top