Talk to us
Talk to us
menu

How to Implement Audio 3A Processing

How to Implement Audio 3A Processing

Introduction

To promote audio quality and user experience, ZEGOCLOUD provides audio 3A processing technologies, including AEC, AGC, and ANS.

  • AEC (Acoustic Echo Cancellation): A method of removing the echo from the audio signal captured by the microphone. After this feature is enabled, the SDK will filter the collected audio data to remove the echo.
  • AGC (Automatic Gain Control): A feature that automatically adjusts the receiver’s audio gain (volume). After this feature is enabled, the sound will be amplified, but the sound quality will be affected to some extent.
  • ANS (Automatic Noise Suppression): A set of audio technologies that actively cancel the ambient noise. Enabling this feature will make your voice clearer.

Prerequisites

Before you begin, make sure you complete the following steps:

  • Create a project in ZEGOCLOUD Admin Console, and get the AppID of your project.
  • The ZEGO Express SDK has been integrated into the project.

Set up audio 3A processing

Set up the AEC (Acoustic Echo Cancellation)

To implement the AEC feature, do the following:

To enable the AEC feature, call the enableAEC method.

Optional: To enable the AEC feature for the headphones scenario, call the enableHeadphoneAEC method.

To set the AEC mode, call the setAECMode mode.

The following sample code is used for setting the AEC to the medium mode (ZegoAECMode.MEDIUM):

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

Set up the AGC (Automatic Gain Control)

To enable the AGC, call the enableAGC method. After this function is turned on, the SDK can automatically adjust the Microphone Volume to adapt to near and far sound pickups and keep the Volume stable.

// Enable the AGC feature.
engine.enableAGC(true);

Set up the ANS (Automatic Noise Suppression)

To implement the ANS feature, do the following:

To enable the ANS feature, call the enableANS method.

Optional: To control or cancel the transient noise, call the enableTransientANS method. This feature can be used to suppress the noise of typing keyboard, table, etc.

To set or adjust the ANS mode, call the setANSMode method. The SDK uses medium mode (ZegoANSMode.MEDIUM) by default.

The following sample code is used for setting the ANS to the soft mode (ZegoANSMode.SOFT):

// Enable the ANS feature.
engine.enableANS(true);
// Enable the transient ANS feature to control the transient noise.
engine.enableTransientANS(true);
// Set the ANS to soft mode (ZegoANSMode.SOFT).
engine.setANSMode(ZegoANSMode.SOFT);

Recommended configurations for 3A

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

MethodDescriptionDefault configRecommended config
enableAECEnable/Disable the AEC feature.TrueWe recommend you use the default settings for general scenarios.
enableHeadphoneAECEnable the AEC for the headphone scenario.FalseWe recommend you enable this for chatting or playing games in groups.
setAECModeSet the AEC mode.ZegoAECMode.AGGRESSIVE (Aggressive mode)We recommend you use the default settings for general scenarios.
enableAGCEnable/Disable the AGC feature.TrueIn the chatting scenario, use the default settings. In the music radio scenario, disable the AGC feature to keep original sound. In the educational scenarios, such as large classes, small classes, and 1v1 classes, enable the AGC feature.
enableANSEnable/Disable the ANS feature.TrueWe recommend you use the default settings for general scenarios.
setANSModeSet the ANS mode.ZegoANSMode.MEDIUM (Medium mode)We recommend you use the default settings for general scenarios.

Let’s Build APP Together

Start building with real-time video, voice & chat SDK for apps today!

Talk to us

Take your apps to the next level with our voice, video and chat APIs

Free Trial
  • 10,000 minutes for free
  • 4,000+ corporate clients
  • 3 Billion daily call minutes

Stay updated with us by signing up for our newsletter!

Don't miss out on important news and updates from ZEGOCLOUD!

* You may unsubscribe at any time using the unsubscribe link in the digest email. See our privacy policy for more information.