Audio Effects

enableVoiceAITuner

Enables or disables the Voice AI Tuner.

public abstract int enableVoiceAITuner(boolean enabled, Constants.VOICE_AI_TUNER_TYPE type);

Supports enhanced audio quality and tone style adjustment.

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: Enable the Voice AI Tuner.
  • false: (Default) Disable 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.

getAudioEffectManager

Gets the IAudioEffectManager instance used to manage audio effect files.

public abstract IAudioEffectManager getAudioEffectManager();

Return Values

The IAudioEffectManager instance, if the method call succeeds.

setAdvancedAudioOptions

Sets advanced audio options.

public abstract int setAdvancedAudioOptions(AdvancedAudioOptions options);

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

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

Parameters

options
Advanced audio options. See AdvancedAudioOptions.

Return Values

  • 0: Success.
  • < 0: Failure.

setAINSMode

Enables or disables the AI noise reduction feature and sets the noise reduction mode.

public abstract int setAINSMode(boolean enabled, int mode);
You can call this method to enable the AI noise reduction feature. 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 consistent statistical characteristics and minimal amplitude fluctuation over time. Common sources include:
    • TV;
    • Air conditioners;
    • Mechanical equipment.
  • Non-stationary noise refers to noise signals with large amplitude fluctuations over time. Common sources include:
    • Thunder;
    • Explosions;
    • Cracking sounds.
Note:
  • This method depends on the AI noise suppression dynamic library libagora_ai_noise_suppression_extension.so. If the library is removed, 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 reduction:
  • true: Enable AI noise reduction.
  • false: (Default) Disable AI noise reduction.
mode
AI noise reduction mode:
  • 0: (Default) Balanced mode. Balances noise reduction performance and latency.
  • 1: Aggressive mode. Suitable for scenarios requiring strong noise reduction, such as outdoor live streaming. Offers stronger noise reduction but may affect the original audio characteristics.
  • 2: Low-latency aggressive mode. Offers about half the latency of the balanced and aggressive modes. Suitable for scenarios requiring low-latency noise reduction, such as real-time online chorus.

Return Values

  • 0: Success.
  • < 0: Failure.

setAudioEffectParameters

Sets parameters for preset audio effects provided by the SDK.

public abstract int setAudioEffectParameters(int preset, int param1, int param2);
Since
Available since v3.2.0.
Call this method to set the following parameters for the local user who sends the audio stream:
  • 3D voice effect: Sets the cycle period of the 3D voice.
  • Pitch correction effect: Sets the basic mode and tonic of pitch correction.
Agora recommends binding this method to UI elements to allow users to interactively adjust pitch correction effects.To achieve better voice effects, it is recommended to call the following APIs before calling this method:
  • Call setAudioScenario to set the audio scenario to high-quality audio, i.e., AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set profile to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Parameters

preset
Preset audio effect options provided by the SDK:
  • ROOM_ACOUSTICS_3D_VOICE: 3D voice effect.
    • Before setting this enum value, you must set profile in setAudioProfile to MUSIC_STANDARD_STEREO (3) or MUSIC_HIGH_QUALITY_STEREO (5), otherwise the setting will not take effect.
    • After enabling this effect, users must use stereo playback devices to hear the expected result.
  • PITCH_CORRECTION: Pitch correction effect.
param1
  • When preset is ROOM_ACOUSTICS_3D_VOICE, this parameter indicates the cycle period of the 3D voice effect in seconds. The range is [1,60], and the default is 10, meaning the sound circles around you every 10 seconds.
  • When preset is PITCH_CORRECTION, this parameter indicates the basic mode of pitch correction:
    • 1: (Default) Natural major.
    • 2: Natural minor.
    • 3: Japanese pentatonic scale.
param2
  • When preset is ROOM_ACOUSTICS_3D_VOICE, set param2 to 0.
  • When preset is PITCH_CORRECTION, this parameter indicates the tonic of pitch correction:
    • 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.

public abstract int setAudioEffectPreset(int preset);
Since
Available since v3.2.0.
This method does not change the gender characteristics of the original voice. After setting, all users in the channel can hear the effect. To achieve better voice effects, it is recommended to call the following methods before this:
  • Call setAudioScenario to set the audio scenario to high-quality mode, i.e., AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set the profile parameter to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

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

Parameters

preset
Preset audio effects:
  • AUDIO_EFFECT_OFF (0): Disable audio effect and use original voice.
  • ROOM_ACOUSTICS_KTV (1): Typical reverb style of KTV.
  • ROOM_ACOUSTICS_VOCAL_CONCERT (2): Typical reverb style of a concert hall.
  • ROOM_ACOUSTICS_STUDIO (3): Typical reverb style of a recording studio.
  • ROOM_ACOUSTICS_PHONOGRAPH (4): Typical reverb style of a vintage phonograph.
  • ROOM_ACOUSTICS_VIRTUAL_STEREO (5): Virtual stereo effect that renders mono audio into stereo. Requires setAudioProfile with profile set to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5), otherwise invalid.
  • ROOM_ACOUSTICS_SPACIAL (6): More spatial audio effect.
  • ROOM_ACOUSTICS_ETHEREAL (7): More ethereal audio effect.
  • ROOM_ACOUSTICS_VIRTUAL_SURROUND_SOUND (8): Virtual surround sound effect. SDK generates simulated surround sound field based on stereo channel. Requires stereo playback device to hear expected effect.
  • ROOM_ACOUSTICS_CHORUS (9): Chorus effect, suitable for chorus scenes, enhances vocal layering and spatial sense.
  • ROOM_ACOUSTICS_3D_VOICE (10): 3D voice effect, makes the voice move around the user, default cycle is 10 seconds. Requires setAudioProfile with profile set to MUSIC_STANDARD_STEREO (3) or MUSIC_HIGH_QUALITY_STEREO (5), otherwise invalid. Requires stereo playback device.
  • VOICE_CHANGER_EFFECT_UNCLE (11): Uncle voice effect, recommended for male voice.
  • VOICE_CHANGER_EFFECT_OLDMAN (12): Old man voice effect, recommended for male voice.
  • VOICE_CHANGER_EFFECT_BOY (13): Boy voice effect, recommended for male voice.
  • VOICE_CHANGER_EFFECT_SISTER (14): Young female voice effect, recommended for female voice.
  • VOICE_CHANGER_EFFECT_GIRL (15): Girl voice effect, recommended for female voice.
  • VOICE_CHANGER_EFFECT_PIGKING (16): Pig King voice effect, bear-like roar.
  • VOICE_CHANGER_EFFECT_HULK (17): Hulk voice effect.
  • STYLE_TRANSFORMATION_RNB (18): R&B music style reverb. Requires setAudioProfile with profile set to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5), otherwise invalid.
  • STYLE_TRANSFORMATION_POPULAR (19): Pop music style reverb. Requires setAudioProfile with profile set to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5), otherwise invalid.
  • PITCH_CORRECTION (20): Pitch correction effect, adjusts pitch based on natural C major scale. After setting, you can call setAudioEffectParameters to adjust tuning mode and tonic.

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoiceEqualization

Sets the local voice equalization effect.

public abstract int setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain);

Timing

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

Parameters

bandFrequency
Band index, range is 0 to 9, corresponding to the center frequency bands of 10 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. Range is -15 to 15, default is 0.

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoiceFormant

Sets the formant ratio to change the vocal timbre.

public abstract int setLocalVoiceFormant(double formantRatio);

The formant ratio affects the timbre of the voice. The smaller the value, the deeper the voice; the larger the value, the sharper the voice. If you want 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. Value range is [-1.0, 1.0]. (Default is 0.0)
Note: It is recommended to set this value within the range [-0.4, 0.6], otherwise the sound may be severely distorted.

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoicePitch

Sets the pitch of the local voice.

public abstract int setLocalVoicePitch(double pitch);

Timing

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

Parameters

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

Return Values

  • 0: Success.
  • < 0: Failure.

setLocalVoiceReverb

Sets the reverb effect of the local voice.

public abstract int setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE reverbKey, int value);

You can use the easier method setAudioEffectPreset to achieve preset reverb effects such as Pop, R&B, and KTV.

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

Parameters

reverbKey
Reverb key. See AUDIO_REVERB_TYPE.
value
Value of the reverb key.

Return Values

  • 0: Success.
  • < 0: Failure.

setVoiceBeautifierParameters

Sets parameters for preset voice beautifier effects.

public abstract int setVoiceBeautifierParameters(int preset, int param1, int param2);
Since
Available since v3.3.0.
To achieve better voice effects, it is recommended to call the following APIs before calling this method:
  • Call setAudioScenario to set the audio scenario to high-quality audio, i.e., AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set the profile parameter to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Parameters

preset
Preset audio effect option:
  • SINGING_BEAUTIFIER: Singing beautifier effect.
param1
Gender characteristic option for singing voice:
  • 1: Male voice.
  • 2: Female voice.
param2
Reverb effect option for singing voice:
  • 1: Small room reverb.
  • 2: Large room reverb.
  • 3: Hall reverb.

Return Values

  • 0: Success.
  • < 0: Failure.

setVoiceBeautifierPreset

Sets the preset voice beautifier effect.

public abstract int setVoiceBeautifierPreset(int preset);
Since
Added since v3.2.0.
You can set different voice beautifier effects for different scenarios. To achieve better voice effects, Agora recommends calling the following APIs before this method:
  • Call setAudioScenario to set the audio scenario to high-quality audio, i.e., AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile, and set profile to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

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

Parameters

preset
Preset voice beautifier options:
  • VOICE_BEAUTIFIER_OFF: Disables the voice beautifier and uses the original voice.
  • CHAT_BEAUTIFIER_MAGNETIC: A more magnetic voice (male only).
  • CHAT_BEAUTIFIER_FRESH: A fresher voice (female only).
  • CHAT_BEAUTIFIER_VITALITY: A more energetic voice (female only).
  • SINGING_BEAUTIFIER: Singing beautifier effect.
    • Calling setVoiceBeautifierPreset with this option beautifies male voices and adds a reverb effect similar to singing in a small room. Recommended for male voices only, otherwise distortion may occur.
    • Calling setVoiceBeautifierParameters with this option beautifies both male and female voices and adds a reverb effect.
  • TIMBRE_TRANSFORMATION_VIGOROUS: A more powerful voice.
  • TIMBRE_TRANSFORMATION_DEEP: A deeper voice.
  • TIMBRE_TRANSFORMATION_MELLOW: A softer voice.
  • TIMBRE_TRANSFORMATION_FALSETTO: Falsetto.
  • TIMBRE_TRANSFORMATION_FULL: A fuller voice.
  • TIMBRE_TRANSFORMATION_CLEAR: A clearer voice.
  • TIMBRE_TRANSFORMATION_RESOUNDING: A louder voice.
  • TIMBRE_TRANSFORMATION_RINGING: A more penetrating voice.
  • ULTRA_HIGH_QUALITY_VOICE: Ultra high-quality voice that makes audio clearer and restores more details.
    • For better sound quality, Agora recommends calling setAudioProfile before this method, setting profile to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5), and scenario to AUDIO_SCENARIO_GAME_STREAMING (3).
    • If your audio capture device already restores audio details well, Agora does not recommend enabling ultra high-quality voice, as the SDK may over-enhance details, resulting in unexpected audio effects.

Return Values

  • 0: Success.
  • < 0: Failure.

setVoiceConversionPreset

Sets the SDK's preset voice conversion effects.

public abstract int setVoiceConversionPreset(int preset);
Since
Available since v3.3.1.
You can call this method to set a preset voice conversion effect for the local user who is publishing the audio stream. Once set, all users in the channel can hear the effect. You can set different voice conversion effects for different scenarios. To achieve better audio effects, it is recommended to call the following APIs before this method:
  • Call setAudioScenario to set the audio scenario to high-quality audio, i.e., AUDIO_SCENARIO_GAME_STREAMING (3).
  • Call setAudioProfile and set the profile parameter to MUSIC_HIGH_QUALITY (4) or MUSIC_HIGH_QUALITY_STEREO (5).
Note:

Timing

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

Parameters

preset
Options for the SDK's preset voice conversion effects:
  • VOICE_CONVERSION_OFF: Disable voice conversion and use the original voice.
  • VOICE_CHANGER_NEUTRAL: Neutral voice. Recommended for female voices to avoid distortion.
  • VOICE_CHANGER_SWEET: Sweet voice. Recommended for female voices to avoid distortion.
  • VOICE_CHANGER_SOLID: Deep voice. Recommended for male voices to avoid distortion.
  • VOICE_CHANGER_BASS: Bass voice. Recommended for male voices to avoid distortion.

Return Values

  • 0: Success.
  • < 0: Failure.