Audio Effects

enableVoiceAITuner

Enables or disables the Voice AI Tuner.

virtual int enableVoiceAITuner(bool enabled, VOICE_AI_TUNER_TYPE type) = 0;

Scenario

Social entertainment scenarios with high audio quality requirements, such as online karaoke, online podcasts, and showroom live streaming.

Timing

You can call this method before or after joining a channel.

Parameters

enabled
Whether to enable the Voice AI Tuner:
  • true: Enables the Voice AI Tuner.
  • false: (Default) Disables the Voice AI Tuner.
type
The audio effect type of the Voice AI Tuner. See VOICE_AI_TUNER_TYPE.

Return Values

  • 0: Success.
  • < 0: Failure.

setAdvancedAudioOptions

Sets advanced audio options.

virtual int setAdvancedAudioOptions(AdvancedAudioOptions& options, int sourceType = 0) = 0;

If you have advanced audio processing needs, such as capturing and sending stereo audio, you can call this method to set advanced audio options.

Note: Call this method after calling joinChannel, enableAudio, and enableLocalAudio.

Parameters

options
Advanced audio options. See AdvancedAudioOptions.
sourceType
Type of the audio source.

Return Values

  • 0: Success.
  • < 0: Failure.

setAINSMode

Enables or disables AI noise suppression and sets the suppression mode.

virtual int setAINSMode(bool enabled,  AUDIO_AINS_MODE mode) = 0;
You can call this method to enable AI noise suppression. Once enabled, the SDK automatically detects and reduces both stationary and non-stationary noise in the audio while preserving voice quality. Stationary noise refers to noise signals with constant average statistical characteristics and minimal amplitude fluctuation over time. Common sources include:
  • TV;
  • Air conditioners;
  • Mechanical equipment, etc.
Non-stationary noise refers to noise signals with large amplitude fluctuations over time. Common sources include:
  • Thunder;
  • Explosions;
  • Cracking sounds, etc.
Note:
  • This method depends on the AI noise suppression dynamic library libagora_ai_noise_suppression_extension.dll. If the library is deleted, the feature cannot be enabled.
  • Agora does not recommend enabling this feature on devices running Android 6.0 or lower.

Scenario

In scenarios such as co-hosting, online education, and video conferencing, this feature can detect and reduce background noise to improve the experience.

Timing

You can call this method before or after joining a channel.

Parameters

enabled
Whether to enable AI noise suppression:
  • true: Enable AI noise suppression.
  • false: (Default) Disable AI noise suppression.
mode
AI noise suppression mode. See AUDIO_AINS_MODE.

Return Values

  • 0: Success.
  • < 0: Failure.

setAudioEffectParameters

Sets parameters for the SDK's preset audio effects.

virtual int setAudioEffectParameters(AUDIO_EFFECT_PRESET preset, int param1, int param2) = 0;
Call this method to set the following parameters for the local user who sends the audio stream:
  • ROOM_ACOUSTICS_3D_VOICE: Sets the cycle period for the voice to move around the user.
  • PITCH_CORRECTION: Sets the pitch correction mode and tonic.
Different songs may require different modes and tonics. Agora recommends binding this method to UI elements for users to interactively adjust pitch correction.To achieve better voice effects, Agora recommends calling the following methods before this one:
  • Call setAudioScenario to set the audio scenario to high-quality audio, that is, AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set profile to AUDIO_PROFILE_MUSIC_HIGH_QUALITY (4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

You can call this method before or after joining a channel.

Parameters

preset
SDK preset audio effect options:
  • ROOM_ACOUSTICS_3D_VOICE (3): 3D voice effect.
    • Before setting this value, set the profile in setAudioProfile to AUDIO_PROFILE_MUSIC_STANDARD_STEREO (3) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO (5), or it will not take effect.
    • After enabling, users must use stereo playback devices to hear the expected effect.
  • PITCH_CORRECTION (10): Pitch correction effect.
param1
  • When preset is ROOM_ACOUSTICS_3D_VOICE, sets the cycle period of the 3D voice effect in seconds. Range: [1, 60], default is 10, meaning the voice moves around you every 10 seconds.
  • When preset is PITCH_CORRECTION, sets the pitch correction mode:
    • 1: (Default) Natural major scale.
    • 2: Natural minor scale.
    • 3: Japanese pentatonic scale.
param2
  • When preset is ROOM_ACOUSTICS_3D_VOICE, set param2 to 0.
  • When preset is PITCH_CORRECTION, sets the tonic:
    • 1: A
    • 2: A#
    • 3: B
    • 4: (Default) C
    • 5: C#
    • 6: D
    • 7: D#
    • 8: E
    • 9: F
    • 10: F#
    • 11: G
    • 12: G#

Return Values

  • 0: Success.
  • < 0: Failure.

setAudioEffectPreset

Sets the SDK's preset audio effects.

virtual int setAudioEffectPreset(AUDIO_EFFECT_PRESET preset) = 0;
Call this method to set the SDK's preset audio effects for the local user who sends the audio stream. This effect does not change the gender characteristics of the original voice. Once set, all users in the channel hear the effect. To achieve better audio effects, Agora recommends calling the following methods before this one:
  • Call setAudioScenario to set the audio scenario to high-quality audio, that is, AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY (4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

You can call this method before or after joining a channel.

Parameters

preset
SDK preset audio effect options. See AUDIO_EFFECT_PRESET.

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoiceEqualization

Sets the equalization effect of the local voice.

virtual int setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain) = 0;

Timing

You can call this method before or after joining a channel.

Parameters

bandFrequency
Band index, ranging from 0 to 9, corresponding to 10 center frequency bands for voice effects: 31, 62, 125, 250, 500, 1k, 2k, 4k, 8k, and 16k Hz. See AUDIO_EQUALIZATION_BAND_FREQUENCY.
bandGain
Gain value for each band in dB. The range is -15 to 15. Default is 0.

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoiceFormant

Sets the formant ratio to change the voice timbre.

virtual int setLocalVoiceFormant(double formantRatio) = 0;

The formant ratio affects the timbre of the voice. A smaller value results in a deeper voice; a larger value results in a sharper voice. To change both timbre and pitch, it is recommended to use setLocalVoiceFormant and setLocalVoicePitch together.

Scenario

You can call this method to set the formant ratio of the local audio to change the voice timbre.

Timing

You can call this method before or after joining a channel.

Parameters

formantRatio
Formant ratio. The range is [-1.0, 1.0]. Default is 0.0, which means no change to timbre.
Note: It is recommended to set this value within the range [-0.4, 0.6], otherwise the voice may be seriously distorted.

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoicePitch

Sets the pitch of the local voice.

virtual int setLocalVoicePitch(double pitch) = 0;

Timing

You can call this method before or after joining a channel.

Parameters

pitch
Pitch of the local voice. The range is [0.5, 2.0]. The smaller the value, the lower the pitch. (Default is 1.0, which means no change to the pitch.)

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoiceReverb

Sets the reverb effect of the local voice.

virtual int setLocalVoiceReverb(AUDIO_REVERB_TYPE reverbKey, int value) = 0;

You can also use the more user-friendly method setAudioEffectPreset to directly apply preset reverb effects such as Pop, R&B, and KTV.

Timing

You can call this method before or after joining a channel.

Parameters

reverbKey
Reverb key. See AUDIO_REVERB_TYPE.
value
Value corresponding to the reverb key.

Return Values

  • 0: Success.
  • < 0: Failure.

setVoiceBeautifierParameters

Sets parameters for preset voice beautifier effects.

virtual int setVoiceBeautifierParameters(VOICE_BEAUTIFIER_PRESET preset, int param1, int param2) = 0;
Call this method to set the gender characteristics and reverb effect of the singing beautifier for the local user's audio stream. Once set, all users in the channel can hear the effect. To achieve better vocal effects, it is recommended to call the following APIs before this method:
  • Call setAudioScenario and set the audio scenario to AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY (4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

You can call this method either before or after joining a channel.

Parameters

preset
Preset effect options:
  • SINGING_BEAUTIFIER: Singing beautifier effect.
param1
Gender characteristic options for the singing voice:
  • 1: Male voice.
  • 2: Female voice.
param2
Reverb effect options for the singing voice:
  • 1: Reverb effect similar to singing in a small room.
  • 2: Reverb effect similar to singing in a large room.
  • 3: Reverb effect similar to singing in a hall.

Return Values

  • 0: Success.
  • < 0: Failure.

setVoiceBeautifierPreset

Sets the preset voice beautifier effect.

virtual int setVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET preset) = 0;

Call this method to set a preset voice beautifier effect for the local user who sends the audio stream. You can choose different effects for different scenarios. After setting, all users in the channel can hear the effect.

Note:

Timing

You can call this method before or after joining a channel.

Parameters

preset
Preset voice beautifier option. See VOICE_BEAUTIFIER_PRESET.

Return Values

  • 0: Success.
  • < 0: Failure.

setVoiceConversionPreset

Sets the preset voice conversion effects.

virtual int setVoiceConversionPreset(VOICE_CONVERSION_PRESET preset) = 0;
Call this method to set a preset voice conversion effect for the local user who sends the audio stream. Once set, all users in the channel hear the effect. You can set different voice effects for users based on different scenarios. To achieve better voice effects, Agora recommends calling the following methods before this one:
  • Call setAudioScenario to set the audio scenario to high-quality audio, that is, AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY (4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

You can call this method before or after joining a channel.

Parameters

preset
Preset voice conversion effect options. See VOICE_CONVERSION_PRESET.

Return Values

  • 0: Success.
  • < 0: Failure.