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.
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;
- TV;
- Air conditioners;
- Mechanical equipment, etc.
- Thunder;
- Explosions;
- Cracking sounds, etc.
- 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;
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.
- Call setAudioScenario to set the audio scenario to high-quality audio, that is,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand setprofiletoAUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) orAUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
- Do not set the
profileinsetAudioProfiletoAUDIO_PROFILE_SPEECH_STANDARD(1) orAUDIO_PROFILE_IOT(6), or this method will not take effect. - This method works best for voice processing and is not recommended for audio that contains music.
- After calling setAudioEffectParameters, do not call the following methods, or the settings will be overridden:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.dll. If the library is deleted, this feature cannot be enabled.
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
profileinsetAudioProfiletoAUDIO_PROFILE_MUSIC_STANDARD_STEREO(3) orAUDIO_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.
- Before setting this value, set the
PITCH_CORRECTION(10): Pitch correction effect.
- param1
-
- When
presetisROOM_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
presetisPITCH_CORRECTION, sets the pitch correction mode:1: (Default) Natural major scale.2: Natural minor scale.3: Japanese pentatonic scale.
- When
- param2
-
- When
presetisROOM_ACOUSTICS_3D_VOICE, setparam2to0. - When
presetisPITCH_CORRECTION, sets the tonic: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.
virtual int setAudioEffectPreset(AUDIO_EFFECT_PRESET preset) = 0;
- Call setAudioScenario to set the audio scenario to high-quality audio, that is,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand set theprofileparameter toAUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) orAUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
- Do not set the
profileparameter insetAudioProfiletoAUDIO_PROFILE_SPEECH_STANDARD(1) orAUDIO_PROFILE_IOT(6), or this method will not take effect. - If you call setAudioEffectPreset with a value other than
ROOM_ACOUSTICS_3D_VOICEorPITCH_CORRECTION, do not call setAudioEffectParameters, or the settings in setAudioEffectPreset will be overridden. - After calling setAudioEffectPreset, Agora does not recommend calling the following methods, or the settings will be overridden:
- This method depends on the audio beautifier dynamic library libagora_audio_beauty_extension.dll. If the library is deleted, this feature cannot be enabled properly.
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 setAudioScenario and set the audio scenario to
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand set theprofileparameter toAUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) orAUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
- Do not set the
profileparameter insetAudioProfiletoAUDIO_PROFILE_SPEECH_STANDARD(1) orAUDIO_PROFILE_IOT(6), otherwise this method will not take effect. - This method works best for vocal processing and is not recommended for audio data that contains music.
- After calling setVoiceBeautifierParameters, avoid calling the following methods as they will override the effect:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.dll. 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 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.
- Do not set the
profileparameter insetAudioProfiletoAUDIO_PROFILE_SPEECH_STANDARD(1) orAUDIO_PROFILE_IOT(6), otherwise this method will not take effect. - This method works best for voice processing and is not recommended for audio data that includes music.
- After calling setVoiceBeautifierPreset, it is not recommended to call the following methods, as they will override the effect set by setVoiceBeautifierPreset:
- This method depends on the voice beautifier dynamic library libagora_audio_beauty_extension.dll. If the library is deleted, this feature cannot be enabled properly.
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 setAudioScenario to set the audio scenario to high-quality audio, that is,
AUDIO_SCENARIO_GAME_STREAMING(3). - Call
setAudioProfileand set theprofileparameter toAUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) orAUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
- Do not set the
profileparameter insetAudioProfiletoAUDIO_PROFILE_SPEECH_STANDARD(1) orAUDIO_PROFILE_IOT(6), or this method will not take effect. - This method works best for voice processing and is not recommended for audio that contains music.
- After calling setVoiceConversionPreset, do not call the following methods, or the settings will be overridden:
- This method depends on the voice conversion dynamic library libagora_audio_beauty_extension.dll. If the library is deleted, this feature cannot be enabled properly.
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.