Skip to main content

You are viewing Agora Docs forBetaproducts and features. Switch to Docs

Android
iOS
macOS
Web
Windows
Electron
Flutter
React Native
React JS
Unity
Unreal Engine
Unreal (Blueprint)

Achieve high audio quality

Some scenarios, such as karaoke sessions, podcasts, and performance-based chats, require a high-quality audio experience. This page shows you how to achieve clear high-definition audio, without noise or interference in your app.

General settings

To improve the audio quality experience, consider the following:

Set audio encoding properties

Call setAudioProfile [2/2] to set the profile to MUSIC_HIGH_QUALITY_STEREO (5). It uses a 48 ​​kHz sampling rate, music encoding, two channels, and the maximum encoding rate is 128 Kbps.


_1
setAudioProfile(Constants.MUSIC_HIGH_QUALITY_STEREO)

Set audio scenario

Call setAudioScenario to set the audio scenario to high-quality AUDIO_SCENARIO_GAME_STREAMING (3).


_1
setAudioScenario(Constants.AUDIO_SCENARIO_GAME_STREAMING)

Sound card settings

This section only applies to users using sound cards.

Disable 3A

Video SDK turns on 3A by default. In audio processing, 3A stands for Acoustic Echo Cancellation (AEC), Active Noise Suppression (ANS), and Automatic Gain Control (AGC). Sound card devices usually provide some built-in audio processing, such as echo and noise cancellation. Currently, if 3A is enabled in the application layer, it may cause over-processing of the audio signal and interference between different algorithms may impact sound quality. Best practice is that users with sound cards disable the 3A function by calling setParameters.


_3
setParameters("{\"che.audio.aec.enable\":false}") // Turn off echo cancellation
_3
setParameters("{\"che.audio.ans.enable\":false}") // Turn off noise reduction
_3
setParameters("{\"che.audio.agc.enable\":false}") // Turn off gain control

Turn on stereo capture

Call setAdvancedAudioOptions to set the number of audio pre-processing channels to AGORA_AUDIO_STEREO_PROCESSING (2), that is, use two channels to collect and send stereo sound.


_3
AdvancedAudioOptions options;
_3
options.audioProcessingChannels = 2;
_3
m_lpAgoraEngine->setAdvancedAudioOptions(options);

vundefined