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.
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);
- 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.
- 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.
- 3D voice effect: Sets the cycle period of the 3D voice.
- Pitch correction effect: Sets the basic mode and tonic of pitch correction.
- Call setAudioScenario to set the audio scenario to high-quality audio, i.e.,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand setprofiletoMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5).
- You can call this method before or after joining a channel.
- Do not set
profileinsetAudioProfiletoSPEECH_STANDARD(1), otherwise this method will not take effect. - This method works best for voice processing and is not recommended for audio data containing music.
- After calling setAudioEffectParameters, it is not recommended to call the following methods, otherwise the effects set by this method will be overridden:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.so. If the library is deleted, the feature cannot be enabled properly.
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
profileinsetAudioProfiletoMUSIC_STANDARD_STEREO(3) orMUSIC_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.
- Before setting this enum value, you must set
PITCH_CORRECTION: Pitch correction effect.
- param1
-
- When
presetisROOM_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
presetisPITCH_CORRECTION, this parameter indicates the basic mode of pitch correction:1: (Default) Natural major.2: Natural minor.3: Japanese pentatonic scale.
- When
- param2
-
- When
presetisROOM_ACOUSTICS_3D_VOICE, setparam2to0. - When
presetisPITCH_CORRECTION, this parameter indicates the tonic of pitch correction:1: A2: A#3: B4: (Default) C5: C#6: D7: D#8: E9: F10: F#11: G12: G#
- When
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.
- Call setAudioScenario to set the audio scenario to high-quality mode, i.e.,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand set theprofileparameter toMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5).
- Do not set the
profileparameter insetAudioProfiletoSPEECH_STANDARD(1), otherwise this method will not take effect. - If the enum value set by setAudioEffectPreset is not
ROOM_ACOUSTICS_3D_VOICEorPITCH_CORRECTION, do not call setAudioEffectParameters, otherwise it will override the settings of setAudioEffectPreset. - After calling setAudioEffectPreset, it is not recommended to call the following methods, otherwise the effect set by setAudioEffectPreset will be overridden:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.so. If this library is deleted, the feature cannot be enabled properly.
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. RequiressetAudioProfilewithprofileset toMUSIC_HIGH_QUALITY(4) orMUSIC_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. RequiressetAudioProfilewithprofileset toMUSIC_STANDARD_STEREO(3) orMUSIC_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. RequiressetAudioProfilewithprofileset toMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5), otherwise invalid.STYLE_TRANSFORMATION_POPULAR(19): Pop music style reverb. RequiressetAudioProfilewithprofileset toMUSIC_HIGH_QUALITY(4) orMUSIC_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.
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.
- Call setAudioScenario to set the audio scenario to high-quality audio, i.e.,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand set theprofileparameter toMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5).
- You can call this method before or after joining a channel.
- Do not set the
profileparameter insetAudioProfiletoSPEECH_STANDARD(1), otherwise this method will not take effect. - This method works best for voice processing and is not recommended for audio data containing music.
- After calling setVoiceBeautifierParameters, it is not recommended to call the following methods, otherwise the effects set by this method will be overridden:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.so. If the library is deleted, the feature cannot be enabled properly.
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.
- Call setAudioScenario to set the audio scenario to high-quality audio, i.e.,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfile, and setprofiletoMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5).
- Do not set
profiletoSPEECH_STANDARD(1) insetAudioProfile, otherwise this method will not take effect. - This method works best for voice processing and is not recommended for audio that contains music.
- After calling setVoiceBeautifierPreset, Agora does not recommend calling the following methods, as they will override the effects set by this method:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.so. If the library is deleted, the feature will not work properly.
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
setAudioProfilebefore this method, settingprofiletoMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5), andscenariotoAUDIO_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.
- For better sound quality, Agora recommends calling
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.
- Call setAudioScenario to set the audio scenario to high-quality audio, i.e.,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand set theprofileparameter toMUSIC_HIGH_QUALITY(4) orMUSIC_HIGH_QUALITY_STEREO(5).
- Do not set the
profileparameter insetAudioProfiletoSPEECH_STANDARD(1), otherwise this method will not take effect. - This method works best for voice processing. Agora does not recommend using it for audio data that includes music.
- After calling setVoiceConversionPreset, Agora does not recommend calling the following methods, as they will override the effect set by setVoiceConversionPreset:
- This method depends on the audio beautifier dynamic library libagora_audio_beauty_extension.so. If the library is deleted, this feature cannot be enabled.
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.