logo
Video Call
On this page

Audio 3A Processing

2025-03-05

Function Overview

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

  • AEC (Acoustic Echo Cancellation): Filters captured audio data to reduce echoes 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, keeping the volume stable.
  • ANS (Active Noise Suppression): Identifies and eliminates background noise in the sound. After enabling this feature, the voice can be clearer.

Download Sample Source Code

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

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

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

Parameter NameParameter DescriptionDefault ConfigurationRecommended Configuration
AECTurn on/off acoustic echo cancellation.Before this parameter is called, the SDK internally automatically determines whether to use AEC. Once this parameter is called, the SDK no longer makes automatic judgments.In general usage scenarios, it is recommended not to modify this configuration and keep the default.
AGCTurn on/off automatic gain control.Before this parameter is called, the SDK internally automatically determines whether to use AGC. Once this parameter is called, the SDK no longer makes automatic judgments.
  • 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 the original voice.
  • In education scenarios, such as large classes, small classes, and 1v1, etc., it is recommended to enable automatic gain control.
ANSTurn on/off noise suppression.Before this parameter is called, the SDK internally automatically determines whether to use ANS. Once this parameter is called, the SDK no longer makes automatic judgments.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

Call the createZegoStream interface to create a ZegoLocalStream instance object localStream, and configure 3A switches through the camera video data capture method.

When capturing source data through camera and microphone, use the "ANS", "AGC", and "AEC" parameters in the ZegoCaptureMicrophone object to set noise suppression, automatic gain, and echo cancellation switches respectively. "true" means on, "false" means off.

Warning
  • When creating a stream, you can only select one configuration mode from "camera", "screen", and "custom".
  • By default, the SDK determines whether to enable "ANS", "AGC", and "AEC" processing based on the browser's default capabilities. Unless there are special circumstances, it is recommended that developers keep the default configuration.
const zg = new ZegoExpressEngine(appID, server);
// The following configuration turns off 3A. Unless there are special circumstances, it is recommended that developers keep the default configuration
option = {
    camera: {
        video: true,
  	audio: {
            ANS: false,
            AGC: false,
            AEC: false
        }
    }
}
const localStream = await zg.createZegoStream(option)
Warning

If you need to configure 3A processing during stream publishing after creating a stream, you can use setAudioConfig to modify it.

Previous

Headphone Monitoring and Channel Settings

Next

Voice Changer/Reverb/Stereo

On this page

Back to top