For AI agents: see the complete documentation index at /llms.txt.
Voice effects
Updated
Video SDK makes it simple for you to publish audio captured through the microphone to subscribers in a channel. In some cases, users want to modify the captured audio to add voice effects, or change the voice quality before the audio is published. Video SDK provides several options that enable you to apply voice effects. This page shows you how to implement these features in your channel.
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
setVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
setAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
setVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such assetLocalVoicePitch,setLocalVoiceEqualization, andsetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call setAudioScenario to set the audio scenario to high-quality
AUDIO_SCENARIO_GAME_STREAMING. -
Call setAudioProfile to set the audio encoding properties to high-quality encoding:
- For mono transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY. - For stereo transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO
- For mono transmission, set the profile to
// Create the RtcEngine object
mRtcEngine = RtcEngine.create(config);
// Set the audio scenario
mRtcEngine.setAudioScenario(Constants.AudioScenario.getValue(Constants.AudioScenario.GAME_STREAMING));
// Set the audio encoding properties
mRtcEngine.setAudioProfile(Constants.AudioProfile.getValue(Constants.AudioProfile.MUSIC_HIGH_QUALITY_STEREO));// Create the RtcEngine object
mRtcEngine = RtcEngine.create(config)
// Set the audio scenario
mRtcEngine.setAudioScenario(Constants.AudioScenario.getValue(Constants.AudioScenario.GAME_STREAMING))
// Set the audio encoding properties
mRtcEngine.setAudioProfile(Constants.AudioProfile.getValue(Constants.AudioProfile.MUSIC_HIGH_QUALITY_STEREO))Voice beautifiers
Call setVoiceBeautifierPreset to set music style, space shaping, electronic music, and other effects.
- Chat voice beautifier
// Set the vocal effect to magnetic (for male voices)
mRtcEngine.setVoiceBeautifierPreset(Constants.CHAT_BEAUTIFIER_MAGNETIC);
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF);// Set the vocal effect to magnetic (for male voices)
mRtcEngine.setVoiceBeautifierPreset(Constants.CHAT_BEAUTIFIER_MAGNETIC)
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF)- Singing voice beautifier
// Example 1: Set male voice effect
// Set the singing voice preset to beautify the male voice and add a small room reverberation effect
mRtcEngine.setVoiceBeautifierPreset(Constants.SINGING_BEAUTIFIER);
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF);
// Example 2: Set female voice effect
// Call the setVoiceBeautifierParameters method to beautify the female voice and add hall reverberation effect
mRtcEngine.setVoiceBeautifierParameters(Constants.SINGING_BEAUTIFIER, 2, 3);
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF);// Example 1: Set male voice effect
// Set the singing voice preset to beautify the male voice and add a small room reverberation effect
mRtcEngine.setVoiceBeautifierPreset(Constants.SINGING_BEAUTIFIER)
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF)
// Example 2: Set female voice effect
// Call the setVoiceBeautifierParameters method to beautify the female voice and add hall reverberation effect
mRtcEngine.setVoiceBeautifierParameters(Constants.SINGING_BEAUTIFIER, 2, 3)
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF)- Tone change
// Set the timbre to thick
mRtcEngine.setVoiceBeautifierPreset(Constants.TIMBRE_TRANSFORMATION_VIGOROUS);
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF);// Set the timbre to thick
mRtcEngine.setVoiceBeautifierPreset(Constants.TIMBRE_TRANSFORMATION_VIGOROUS)
// Turn off the effect
mRtcEngine.setVoiceBeautifierPreset(Constants.VOICE_BEAUTIFIER_OFF)Sound effects
Call setAudioEffectPreset to set music style, space shaping, electronic music and other effects.
- Music Style
// Set the style to pop
mRtcEngine.setAudioEffectPreset(Constants.STYLE_TRANSFORMATION_POPULAR);
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF);// Set the style to pop
mRtcEngine.setAudioEffectPreset(Constants.STYLE_TRANSFORMATION_POPULAR)
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF)- Space shaping
// Set the space shaping effect to KTV
mRtcEngine.setAudioEffectPreset(Constants.ROOM_ACOUSTICS_KTV);
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF);// Set the space shaping effect to KTV
mRtcEngine.setAudioEffectPreset(Constants.ROOM_ACOUSTICS_KTV)
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF)- Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect
// The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio
mRtcEngine.setAudioEffectPreset(Constants.PITCH_CORRECTION);
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF);
// Example 2: Adjust the basic mode and tonic pitch to achieve the electronic music sound effect
// Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D
mRtcEngine.setAudioEffectParameters(Constants.PITCH_CORRECTION, 2, 6);
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF);// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect
// The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio
mRtcEngine.setAudioEffectPreset(Constants.PITCH_CORRECTION)
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF)
// Example 2: Adjust the basic mode and tonic pitch to achieve the electronic music sound effect
// Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D
mRtcEngine.setAudioEffectParameters(Constants.PITCH_CORRECTION, 2, 6)
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF)Voice change effects
To implement basic voice-changing effects, call the setAudioEffectPreset method. For advanced voice-changing effects, use the setVoiceConversionPreset method.
- Basic voice changer
// Set the voice change effect to a more neutral voice
mRtcEngine.setVoiceConversionPreset(Constants.VOICE_CHANGER_NEUTRAL);
// Turn off the effect
mRtcEngine.setVoiceConversionPreset(Constants.VOICE_CONVERSION_OFF);// Set the voice change effect to a more neutral voice
mRtcEngine.setVoiceConversionPreset(Constants.VOICE_CHANGER_NEUTRAL)
// Turn off the effect
mRtcEngine.setVoiceConversionPreset(Constants.VOICE_CONVERSION_OFF)- Advanced voice changer
// Set the vocal effect to 'Hulk'
mRtcEngine.setAudioEffectPreset(Constants.VOICE_CHANGER_EFFECT_HULK);
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF);// Set the vocal effect to 'Hulk'
mRtcEngine.setAudioEffectPreset(Constants.VOICE_CHANGER_EFFECT_HULK)
// Turn off the effect
mRtcEngine.setAudioEffectPreset(Constants.AUDIO_EFFECT_OFF)Custom audio effects
Call setLocalVoicePitch, setLocalVoiceEqualization, and setLocalVoiceReverb to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
double pitch = 0.5;
mRtcEngine.setLocalVoicePitch(pitch);
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(0), -15);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(1), 3);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(2), -9);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(3), -8);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(4), -6);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(5), -4);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(6), -3);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(7), -2);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(8), -1);
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(9), 1);
// Original voice intensity or dry signal, value range [-20,10], unit is dB
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(0), 10);
// Early reflection signal intensity or wet signal, value range [-20,10], unit is dB
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(1), 7);
// The room size for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(2), 6);
// Initial delay length of wet signal, value range: [0,200], unit: ms
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(3), 124);
// The continuous strength of reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(4), 78);// Set the pitch for the local voice
val pitch = 0.5
mRtcEngine.setLocalVoicePitch(pitch)
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(0), -15)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(1), 3)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(2), -9)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(3), -8)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(4), -6)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(5), -4)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(6), -3)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(7), -2)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(8), -1)
mRtcEngine.setLocalVoiceEqualization(Constants.AUDIO_EQUALIZATION_BAND_FREQUENCY.fromInt(9), 1)
// Original voice intensity or dry signal, value range [-20,10], unit is dB
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(0), 10)
// Early reflection signal intensity or wet signal, value range [-20,10], unit is dB
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(1), 7)
// The room size for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(2), 6)
// Initial delay length of wet signal, value range: [0,200], unit: ms
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(3), 124)
// The continuous strength of reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
mRtcEngine.setLocalVoiceReverb(Constants.AUDIO_REVERB_TYPE.fromInt(4), 78)Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
setVoiceBeautifierPreset,setAudioEffectPreset,setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. For more details, see API reference.
Sample project
Agora provides an open source Voice effects project on GitHub for your reference. Download or view the source code for a more detailed example.
API reference
Audio scenario and audio profile
Preset voice effects
Custom voice effects
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
setVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
setAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
setVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such assetLocalVoicePitch,setLocalVoiceEqualization, andsetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call
setAudioScenarioto set the audio scenario to the high-quality scenarioAgoraAudioScenarioGameStreaming. -
Call
setAudioProfileto set the audio encoding properties to high-quality encoding: -
For mono transmission, set the profile to
AgoraAudioProfileMusicHighQuality. -
For stereo transmission, set the profile to
AgoraAudioProfileMusicHighQualityStereo.
// Create RtcEngine object
let agoraKit = AgoraRtcEngineKit.sharedEngine(with: config, delegate: self)
// Set audio scene
agoraKit.setAudioScenario(.gameStreaming)
// Set audio encoding properties
agoraKit.setAudioProfile(.musicHighQaulityStereo)Voice beautifiers
Call setVoiceBeautifierPreset to set music style, space shaping, electronic music and other effects.
-
Chat voice beautifier
// Set the voice effect to magnetic (for male voices) agoraKit.setVoiceBeautifierPreset(.chatBeautifierMagnetic) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff) -
Singing voice beautifier
// Example 1: Set male voice effect // Set to singing beauty voice preset, which can beautify male voices and add small room reverberation effect agoraKit.setVoiceBeautifierPreset(.singingBeautifier) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff) // Example 2: Set female voice effects // Call the setVoiceBeautifierParameters method to beautify female voices and add hall reverberation effect agoraKit.setVoiceBeautifierParameters(.singingBeautifier, 2, 3) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff)
-
Tone change
// Set the timbre to thick agoraKit.setVoiceBeautifierPreset(.timbreTransformationVigorous) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff)
Sound effects
Call the setAudioEffectPreset method to set music style, space shaping, electronic music, and other effects.
-
Music Style
// Set the style to pop agoraKit.setAudioEffectPreset(.styleTransformationPopular) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff) -
Space shaping
// Set the space shaping effect to KTV agoraKit.setAudioEffectPreset(.roomAcousticKTV) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff) -
Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect // The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio agoraKit.setAudioEffectPreset(.pitchCorrection) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff) // Example 2: Adjust the basic mode and tonic pitch to achieve the electronic sound effect // Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D agoraKit.setAudioEffectParameters(.pitchCorrection, 2, 6); // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff)
Voice changer effects
To implement basic voice-changing effects, call the setAudioEffectPreset method. For advanced voice-changing effects, use the setVoiceConversionPreset method.
-
Basic voice changer
// The default voice change effect is a more neutral voice agoraKit.setVoiceConversionPreset(.voiceChangerNeutral) // Turn off the effect agoraKit.setVoiceConversionPreset(.voiceConversionOff) -
Advanced voice changer
// Set the voice changer effect to Hulk agoraKit.setAudioEffectPreset(.voiceChangerEffectHulk) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff)
Custom audio effects
Call setLocalVoicePitch, setLocalVoiceEqualizationOf, and setLocalVoiceReverbOf to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
agoraKit.setLocalVoicePitch(1)
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
agoraKit.setLocalVoiceEqualizationOf(.band31, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band62, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band125, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band250, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band500, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band1K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band2K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band4K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band8K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band16K, withGain: 0)
// Original voice intensity, or dry signal, value range [-20,10], unit is dB
agoraKit.setLocalVoiceReverbOf(.dryLevel, withValue: -1)
// Early reflection signal strength, or wet signal, value range [-20,10], unit is dB
agoraKit.setLocalVoiceReverbOf(.wetLevel, withValue: -7)
// The size of the room for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
agoraKit.setLocalVoiceReverbOf(.roomSize, withValue: 57)
// Initial delay length of wet signal, value range: [0,200], unit: ms
agoraKit.setLocalVoiceReverbOf(.wetDelay, withValue: 135)
// The strength of the reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
agoraKit.setLocalVoiceReverbOf(.strength, withValue: 45)Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
setVoiceBeautifierPreset,setAudioEffectPreset,setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. For more details, see API reference.
Sample project
Agora provides an open source VoiceChanger project on GitHub for your reference. Download or view the source code for a more detailed example.
API reference
Audio scenario and audio profile
Preset voice effects
The enumerations in setVoiceBeautifierPreset, setAudioEffectPreset, setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. Refer to the API reference for details.
Custom voice effects
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
setVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
setAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
setVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such assetLocalVoicePitch,setLocalVoiceEqualization, andsetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call
setAudioScenarioto set the audio scenario to the high-quality scenarioAgoraAudioScenarioGameStreaming. -
Call
setAudioProfileto set the audio encoding properties to high-quality encoding: -
For mono transmission, set the profile to
AgoraAudioProfileMusicHighQuality. -
For stereo transmission, set the profile to
AgoraAudioProfileMusicHighQualityStereo.
// Create RtcEngine object
let agoraKit = AgoraRtcEngineKit.sharedEngine(with: config, delegate: self)
// Set audio scene
agoraKit.setAudioScenario(.gameStreaming)
// Set audio encoding properties
agoraKit.setAudioProfile(.musicHighQaulityStereo)Voice beautifiers
Call setVoiceBeautifierPreset to set music style, space shaping, electronic music and other effects.
-
Chat voice beautifier
// Set the voice effect to magnetic (for male voices) agoraKit.setVoiceBeautifierPreset(.chatBeautifierMagnetic) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff) -
Singing voice beautifier
// Example 1: Set male voice effect // Set to singing beauty voice preset, which can beautify male voices and add small room reverberation effect agoraKit.setVoiceBeautifierPreset(.singingBeautifier) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff) // Example 2: Set female voice effects // Call the setVoiceBeautifierParameters method to beautify female voices and add hall reverberation effect agoraKit.setVoiceBeautifierParameters(.singingBeautifier, 2, 3) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff)
-
Tone change
// Set the timbre to thick agoraKit.setVoiceBeautifierPreset(.timbreTransformationVigorous) // Turn off the effect agoraKit.setVoiceBeautifierPreset(.voiceBeautifierOff)
Sound effects
Call the setAudioEffectPreset method to set music style, space shaping, electronic music, and other effects.
-
Music Style
// Set the style to pop agoraKit.setAudioEffectPreset(.styleTransformationPopular) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff) -
Space shaping
// Set the space shaping effect to KTV agoraKit.setAudioEffectPreset(.roomAcousticKTV) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff) -
Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect // The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio agoraKit.setAudioEffectPreset(.pitchCorrection) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff) // Example 2: Adjust the basic mode and tonic pitch to achieve the electronic sound effect // Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D agoraKit.setAudioEffectParameters(.pitchCorrection, 2, 6); // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff)
Voice changer effects
To implement basic voice-changing effects, call the setAudioEffectPreset method. For advanced voice-changing effects, use the setVoiceConversionPreset method.
-
Basic voice changer
// The default voice change effect is a more neutral voice agoraKit.setVoiceConversionPreset(.voiceChangerNeutral) // Turn off the effect agoraKit.setVoiceConversionPreset(.voiceConversionOff) -
Advanced voice changer
// Set the voice changer effect to Hulk agoraKit.setAudioEffectPreset(.voiceChangerEffectHulk) // Turn off the effect agoraKit.setAudioEffectPreset(.audioEffectOff)
Custom audio effects
Call setLocalVoicePitch, setLocalVoiceEqualizationOf, and setLocalVoiceReverbOf to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
agoraKit.setLocalVoicePitch(1)
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
agoraKit.setLocalVoiceEqualizationOf(.band31, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band62, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band125, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band250, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band500, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band1K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band2K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band4K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band8K, withGain: 0)
agoraKit.setLocalVoiceEqualizationOf(.band16K, withGain: 0)
// Original voice intensity, or dry signal, value range [-20,10], unit is dB
agoraKit.setLocalVoiceReverbOf(.dryLevel, withValue: -1)
// Early reflection signal strength, or wet signal, value range [-20,10], unit is dB
agoraKit.setLocalVoiceReverbOf(.wetLevel, withValue: -7)
// The size of the room for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
agoraKit.setLocalVoiceReverbOf(.roomSize, withValue: 57)
// Initial delay length of wet signal, value range: [0,200], unit: ms
agoraKit.setLocalVoiceReverbOf(.wetDelay, withValue: 135)
// The strength of the reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
agoraKit.setLocalVoiceReverbOf(.strength, withValue: 45)Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
setVoiceBeautifierPreset,setAudioEffectPreset,setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. For more details, see API reference.
Sample project
Agora provides an open source VoiceChanger project on GitHub for your reference. Download or view the source code for a more detailed example.
API reference
Audio scenario and audio profile
Preset voice effects
The enumerations in setVoiceBeautifierPreset, setAudioEffectPreset, setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. Refer to the API reference for details.
Custom voice effects
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
setVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
setAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
setVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such assetLocalVoicePitch,setLocalVoiceEqualization, andsetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call
setAudioScenarioto set the audio scenario to high-qualityAUDIO_SCENARIO_GAME_STREAMING. -
Call
setAudioProfileto set the audio encoding properties to high-quality encoding: -
For mono transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY. -
For stereo transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO.
// Create RtcEngine object
m_rtcEngine = createAgoraRtcEngine();
// Set the audio scenario
m_rtcEngine->setAudioScenario(AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO);
// Set audio encoding properties
m_rtcEngine->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO);Voice beautifiers
Call setVoiceBeautifierPreset to set music style, space shaping, electronic music and other effects.
-
Chat voice beautifier
// Set the vocal effect to magnetic (for male voices) m_rtcEngine->setVoiceBeautifierPreset(CHAT_BEAUTIFIER_MAGNETIC); // Turn off the effect m_rtcEngine->setVoiceBeautifierPreset(VOICE_BEAUTIFIER_OFF); -
Singing voice beautifier
// Example 1: Set male voice effect // Set the singing voice preset to beautify the male voice and add a small room reverberation effect m_rtcEngine->setVoiceBeautifierPreset(SINGING_BEAUTIFIER); // Turn off the effect m_rtcEngine->setVoiceBeautifierPreset(VOICE_BEAUTIFIER_OFF); // Example 2: Set female voice effect // Call the setVoiceBeautifierParameters method to beautify female voice and add hall reverberation effect m_rtcEngine->setVoiceBeautifierParameters(SINGING_BEAUTIFIER, 2, 3); // Turn off the effect m_rtcEngine->setVoiceBeautifierPreset(VOICE_BEAUTIFIER_OFF);
-
Tone change
// Set the timbre to thick m_rtcEngine->setVoiceBeautifierPreset(TIMBRE_TRANSFORMATION_VIGOROUS); // Turn off the effect m_rtcEngine->setVoiceBeautifierPreset(VOICE_BEAUTIFIER_OFF);
Sound effects
Call setAudioEffectPreset to set music style, space shaping, electronic music and other effects.
-
Music Style
// Set the music style to pop m_rtcEngine->setAudioEffectPreset(STYLE_TRANSFORMATION_POPULAR); // Turn off the effect m_rtcEngine->setAudioEffectPreset(AUDIO_EFFECT_OFF); -
Space shaping
// Set the space shaping effect to the effect in KTV m_rtcEngine->setAudioEffectPreset(ROOM_ACOUSTICS_KTV); // Turn off the effect m_rtcEngine->setAudioEffectPreset(AUDIO_EFFECT_OFF); -
Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect // The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio m_rtcEngine->setAudioEffectPreset(PITCH_CORRECTION); // Turn off the effect m_rtcEngine->setAudioEffectPreset(AUDIO_EFFECT_OFF); // Example 2: Adjust the basic mode and tonic pitch to achieve the electronic music sound effect // Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D m_rtcEngine->setAudioEffectParameters(PITCH_CORRECTION, 2, 6); // Turn off the effect m_rtcEngine->setAudioEffectPreset(AUDIO_EFFECT_OFF);
Voice change effects
To implement basic voice-changing effects, call the setAudioEffectPreset method. For advanced voice-changing effects, use the setVoiceConversionPreset method.
-
Basic voice changer
// Set the voice changer to a more neutral sound m_rtcEngine->setVoiceConversionPreset(VOICE_CHANGER_NEUTRAL); // Turn off the effect m_rtcEngine->setVoiceConversionPreset(VOICE_CONVERSION_OFF); -
Advanced voice changer
// Set the vocal effect to 'Hulk' m_rtcEngine->setAudioEffectPreset(VOICE_CHANGER_EFFECT_HULK); // Turn off the effect m_rtcEngine->setAudioEffectPreset(AUDIO_EFFECT_OFF);
Custom audio effects
Call setLocalVoicePitch, setLocalVoiceEqualization, and setLocalVoiceReverb to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
m_rtcEngine->setLocalVoicePitch(0.5);
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_31, -15);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_62, 3);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_125, -9);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_250, -8);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_500, -6);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_1K, -4);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_2K, -3);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_4K, -2);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_8K, -1);
m_rtcEngine->setLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_16K, 1);
// Original voice intensity, or dry signal, value range [-20,10], unit is dB
m_rtcEngine->setLocalVoiceReverb(AUDIO_REVERB_DRY_LEVEL, 10);
// Early reflection signal intensity, or wet signal, value range [-20,10], unit is dB
m_rtcEngine->setLocalVoiceReverb(AUDIO_REVERB_WET_LEVEL, 7);
// The room size for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
m_rtcEngine->setLocalVoiceReverb(AUDIO_REVERB_ROOM_SIZE, 6);
// Initial delay length of wet signal, value range: [0,200], unit: ms
m_rtcEngine->setLocalVoiceReverb(AUDIO_REVERB_WET_DELAY, 124);
// The strength of the reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
m_rtcEngine->setLocalVoiceReverb(AUDIO_REVERB_STRENGTH, 78);Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
setVoiceBeautifierPreset,setAudioEffectPreset,setVoiceConversionPreset, and other voice methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. Refer to the API reference for details.
Sample project
Agora provides an open source BeautyAudio project on GitHub for your reference. Download or view the source code for a more detailed example.
API reference
Audio scenario and audio profile
Preset voice effects
Custom voice effects
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
setVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
setAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
setVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such assetLocalVoicePitch,setLocalVoiceEqualization, andsetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call setAudioScenario to set the audio scenario to high-quality
AudioScenarioGameStreaming. -
Call setAudioProfile to set the audio encoding properties to high-quality encoding:
- For mono transmission, set the profile to
AudioProfileMusicHighQuality. - For stereo transmission, set the profile to
AudioProfileMusicHighQualityStereo
- For mono transmission, set the profile to
// Create a RtcEngine object
rtcEngine = createAgoraRtcEngine();
// Set the audio scene audio scene settings
rtcEngine.setAudioScenario(AudioScenarioType.AudioScenarioGameStreaming);
// Set audio encoding properties
rtcEngine.setAudioProfile(AudioProfileType.AudioProfileMusicHighQualityStereo);Voice beautifiers
Call setVoiceBeautifierPreset to set music style, space shaping, electronic music, and other effects.
-
Chat voice beautifier
// Set the vocal effect to magnetic (for male voices) rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.ChatBeautifierMagnetic); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff); -
Singing voice beautifier
// Example 1: Set male voice effect // Set the singing voice preset to beautify the male voice and add a small room reverberation effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.SingingBeautifier); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff); // Example 2: Set female voice effect // Call the setVoiceBeautifierParameters method to beautify the female voice and add hall reverberation effect rtcEngine.setVoiceBeautifierParameters(VoiceBeautifierPreset.SingingBeautifier, 2, 3); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff);
-
Tone change
// Set the timbre to be thick rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.TimbreTransformationVigorous); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff);
Sound Effects
Call setAudioEffectPreset to set music style, space shaping, electronic music and other effects.
-
Music Style
// Set the style to pop rtcEngine.setAudioEffectPreset(AudioEffectPreset.StyleTransformationPopular); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); -
Space shaping
// Set the space shaping effect to KTV rtcEngine.setAudioEffectPreset(AudioEffectPreset.RoomAcousticsKtv); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); -
Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect // The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio rtcEngine.setAudioEffectPreset(AudioEffectPreset.PitchCorrection); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); // Example 2: Adjust the basic mode and tonic pitch to achieve the electronic music sound effect // Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D rtcEngine.setAudioEffectParameters(AudioEffectPreset.PitchCorrection, 2, 6); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff);
Voice change effects
To implement basic voice-changing effects, call the setAudioEffectPreset method. For advanced voice-changing effects, use the setVoiceConversionPreset method.
-
Basic voice changer
// Set the voice change effect to a more neutral voice rtcEngine.setVoiceConversionPreset(VoiceConversionPreset.VoiceChangerNeutral); // Turn off the effect rtcEngine.setVoiceConversionPreset(VoiceConversionPreset.VoiceConversionOff); -
Advanced voice changer
// Set the vocal effect to 'Hulk' rtcEngine.setAudioEffectPreset(AudioEffectPreset.VoiceChangerEffectHulk); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff);
Custom audio effects
Call setLocalVoicePitch, setLocalVoiceEqualization, and setLocalVoiceReverb to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
rtcEngine.setLocalVoicePitch(0.5);
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand31, -15);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand62, 3);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand125, -9);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand250, -8);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand500, -6);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand1k, -4);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand2k, -3);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand4k, -2);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand8k, -1);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand16k, 1);
// Original voice intensity or dry signal, value range [-20,10], unit is dB
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbDryLevel, 10);
// Early reflection signal intensity or wet signal, value range [-20,10], unit is dB
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbWetLevel, 7);
// The room size for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbRoomSize, 6);
// Initial delay length of wet signal, value range: [0,200], unit: ms
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbWetDelay, 124);
// The continuous strength of reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbStrength, 78);Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
setVoiceBeautifierPreset,setAudioEffectPreset,setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. For more details, see API reference.
Sample project
Agora provides an open source Voice effects project on GitHub for your reference. Download or view the source code for a more detailed example.
API reference
Audio scenario and audio profile
Preset voice effects
Custom voice effects
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
setVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
setAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
setVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such assetLocalVoicePitch,setLocalVoiceEqualization, andsetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call setAudioScenario to set the audio scenario to high-quality
AudioScenarioGameStreaming. -
Call setAudioProfile to set the audio encoding properties to high-quality encoding:
- For mono transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY. - For stereo transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO
- For mono transmission, set the profile to
// Create a RtcEngine object
rtcEngine = createAgoraRtcEngine();
// Set the audio scenario
rtcEngine.setAudioScenario(AudioScenarioType.AudioScenarioGameStreaming);
// Set audio encoding properties
rtcEngine.setAudioProfile(AudioProfileType.AudioProfileMusicHighQualityStereo);Voice beautifiers
Call setVoiceBeautifierPreset to set music style, space shaping, electronic music, and other effects.
-
Chat voice beautifier
// Set the vocal effect to magnetic (for male voices) rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.ChatBeautifierMagnetic); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff); -
Singing voice beautifier
// Example 1: Set male voice effect // Set the singing voice preset to beautify the male voice and add a small room reverberation effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.SingingBeautifier); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff); // Example 2: Set female voice effect // Call the setVoiceBeautifierParameters method to beautify the female voice and add hall reverberation effect rtcEngine.setVoiceBeautifierParameters(VoiceBeautifierPreset.SingingBeautifier, 2, 3); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff);
-
Tone change
// Set the timbre to thick rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.TimbreTransformationVigorous); // Turn off the effect rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff);
Sound Effects
Call setAudioEffectPreset to set music style, space shaping, electronic music and other effects.
-
Music Style
// Set the style to pop rtcEngine.setAudioEffectPreset(AudioEffectPreset.StyleTransformationPopular); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); -
Space shaping
// Set the space shaping effect to KTV rtcEngine.setAudioEffectPreset(AudioEffectPreset.RoomAcousticsKtv); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); -
Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect // The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio rtcEngine.setAudioEffectPreset(AudioEffectPreset.PitchCorrection); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); // Example 2: Adjust the basic mode and tonic pitch to achieve the electronic music sound effect // Call setAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D rtcEngine.setAudioEffectParameters(AudioEffectPreset.PitchCorrection, 2, 6); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff);
Voice change effects
To implement basic voice-changing effects, call the setAudioEffectPreset method. For advanced voice-changing effects, use the setVoiceConversionPreset method.
-
Basic voice changer
// Set the voice changer to a more neutral voice rtcEngine.setVoiceConversionPreset(VoiceConversionPreset.VoiceChangerNeutral); // Turn off the effect rtcEngine.setVoiceConversionPreset(VoiceConversionPreset.VoiceConversionOff); -
Advanced voice changer
// Set the vocal effect to 'Hulk' rtcEngine.setAudioEffectPreset(AudioEffectPreset.VoiceChangerEffectHulk); // Turn off the effect rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff);
Custom audio effects
Call setLocalVoicePitch, setLocalVoiceEqualization, and setLocalVoiceReverb to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
rtcEngine.setLocalVoicePitch(0.5);
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand31, -15);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand62, 3);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand125, -9);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand250, -8);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand500, -6);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand1k, -4);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand2k, -3);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand4k, -2);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand8k, -1);
rtcEngine.setLocalVoiceEqualization(AudioEqualizationBandFrequency.AudioEqualizationBand16k, 1);
// Original voice intensity or dry signal, value range [-20,10], unit is dB
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbDryLevel, 10);
// Early reflection signal intensity or wet signal, value range [-20,10], unit is dB
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbWetLevel, 7);
// The room size for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbRoomSize, 6);
// Initial delay length of wet signal, value range: [0,200], unit: ms
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbWetDelay, 124);
// The continuous strength of reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
rtcEngine.setLocalVoiceReverb(AudioReverbType.AudioReverbStrength, 78);Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
setVoiceBeautifierPreset,setAudioEffectPreset,setVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. For more details, see API reference.
Sample project
Agora provides an open source Voice effects project on GitHub for your reference. Download or view the source code for a more detailed example.
API reference
Audio scenario and audio profile
Preset voice effects
Custom voice effects
Understand the tech
Voice effects are gaining popularity in social interaction and entertainment use-cases. To help you quickly integrate voice effects into your project, Video SDK provides pre-configured effects. Choose from the following effects:
-
Voice beautifiers
- Voice beautifier for Chat: Beautify the voice in chat use-cases according to the characteristics of male and female voices without changing the original voice recognition.
- Singing beautifier: Beautify the singing voice according to male and female voice characteristics while retaining the original character of the singing voice.
- Timbre shift: Fine-tune the timbre of a vocal in a specific direction.
-
Sound effects
- Style sound effects: For songs of a specific style, make the singing and accompaniment more compatible.
- Spatial shaping: Create a spatial atmosphere through spatial reverberation effects. Make the vocals seem to come from a specific source.
- Electronic sound effects: Adjust the pitch of the vocals to perfectly match the key and pitch of the accompaniment for an electronic sound effect.
-
Voice changer
- Basic voice changing: Make the voice more neutral, sweet, or stable while retain a certain degree of voice recognition.
- Advanced voice changing: Dramatically change the human voice to realize voices of uncle, girl, Hulk, etc.
-
Custom audio effects If the preset effects don't meet your needs, manually adjust the voice pitch, equalization, and reverberation to achieve a customized effect.
Try the Online Demo to experience different voice effects.
Prerequisites
Before proceeding with the code examples on this page, make sure you have completed the SDK quickstart guide.
Implement voice effects
This section shows how to use different sound beautifiers to enhance your audio experience.
Use the following methods to set the desired vocal effects:
- Call the
SetVoiceBeautifierPresetmethod to apply effects such as chatting bel canto, singing bel canto, and timbre change. - Utilize the
SetAudioEffectPresetmethod to configure sound effects, genre sound effects, space shaping, and other effects. - Apply the
SetVoiceConversionPresetmethod to entirely transform the original voice. If the preset effects don't meet your requirements, customize vocal effects using methods such asSetLocalVoicePitch,SetLocalVoiceEqualization, andSetLocalVoiceReverb.
Choose the one that best fits your requirements. To implement various voice effects in your project, take the following steps:
Set audio scenario and audio profile
For optimal audio quality, take the following steps:
-
Call SetAudioScenario to set the audio scenario to high-quality
AUDIO_SCENARIO_GAME_STREAMING. -
Call SetAudioProfile to set the audio encoding properties to high-quality encoding:
- For mono transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY. - For stereo transmission, set the profile to
AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO
- For mono transmission, set the profile to
Set the audio scene and encoding properties after calling CreateAgoraRtcEngine to create the IRtcEngine object.
// Set the audio scenario
RtcEngine.SetAudioScenario(AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_GAME_STREAMING);
// Set the audio encoding properties
RtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_HIGH_QUALITY);
Voice beautifiers
Call SetVoiceBeautifierPreset to set music style, space shaping, electronic music, and other effects.
-
Chat voice beautifier
// Set the vocal effect to magnetic (for male voices) RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.CHAT_BEAUTIFIER_MAGNETIC); // Turn off the effect RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.VOICE_BEAUTIFIER_OFF); -
Singing voice beautifier
// Example 1: Set male voice effect // Set the singing voice preset to beautify the male voice and add a small room reverberation effect RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.SINGING_BEAUTIFIER); // Turn off the effect RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.VOICE_BEAUTIFIER_OFF); // Example 2: Set female voice effect // Call the SetVoiceBeautifierParameters method to beautify the female voice and add hall reverberation effect RtcEngine.SetVoiceBeautifierParameters(VOICE_BEAUTIFIER_PRESET.SINGING_BEAUTIFIER, 2, 3); // Turn off the effect RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.VOICE_BEAUTIFIER_OFF);
-
Tone change
// Set the timbre to thick RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.TIMBRE_TRANSFORMATION_VIGOROUS); // Turn off the effect RtcEngine.SetVoiceBeautifierPreset(VOICE_BEAUTIFIER_PRESET.VOICE_BEAUTIFIER_OFF);
Sound effects
Call SetAudioEffectPreset to set music style, space shaping, electronic music and other effects.
-
Music Style
// Set the style to pop RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.STYLE_TRANSFORMATION_POPULAR); // Turn off the effect RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.AUDIO_EFFECT_OFF); -
Space shaping
// Set the space shaping effect to KTV RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.ROOM_ACOUSTICS_KTV); // Turn off the effect RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.AUDIO_EFFECT_OFF); -
Electronic sound effects
// Example 1: Use the preset pitch adjustment method to achieve the electronic music sound effect // The preset is based on the natural major key with the tonic pitch of C, and corrects the actual pitch of the audio RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.PITCH_CORRECTION); // Turn off the effect RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.AUDIO_EFFECT_OFF); // Example 2: Adjust the basic mode and tonic pitch to achieve the electronic music sound effect // Call SetAudioEffectParameters to adjust the basic mode of the tone to the natural minor key and the tonic pitch to D RtcEngine.SetAudioEffectParameters(AUDIO_EFFECT_PRESET.PITCH_CORRECTION, 2, 6); // Turn off the effect RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.AUDIO_EFFECT_OFF);
Voice change effects
To implement basic voice-changing effects, call the SetAudioEffectPreset method. For advanced voice-changing effects, use the SetVoiceConversionPreset method.
-
Basic voice changer
// Set the voice changer to a more neutral voice RtcEngine.SetVoiceConversionPreset(VOICE_CONVERSION_PRESET.VOICE_CHANGER_NEUTRAL); // Turn off the effect RtcEngine.SetVoiceConversionPreset(VOICE_CONVERSION_PRESET.VOICE_CONVERSION_OFF); -
Advanced voice changer
// Set the vocal effect to 'Hulk' RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.VOICE_CHANGER_EFFECT_HULK); // Turn off the effect RtcEngine.SetAudioEffectPreset(AUDIO_EFFECT_PRESET.AUDIO_EFFECT_OFF);
Custom audio effects
Call SetLocalVoicePitch, SetLocalVoiceEqualization, and SetLocalVoiceReverb to fine-tune vocal output parameters, including pitch, equalization, and reverberation effects. The following example shows you how to transform a human voice into the voice of the Hulk by manually setting parameter values:
RtcEngine.SetLocalVoicePitch(0.5);
// Set the center frequency of the local voice equalization band
// The first parameter is the spectrum sub-band index, the value range is [0,9], representing 10 frequency bands, and the corresponding center frequencies are [31,62,125,250,500,1000,2000,4000,8000,16000] Hz
// The second parameter is the gain value of each frequency interval, the value range is [-15,15], the unit is dB, the default value is 0
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_31, -15);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_62, 3);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_125, -9);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_250, -8);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_500, -6);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_1K, -4);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_2K, -3);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_4K, -2);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_8K, -1);
RtcEngine.SetLocalVoiceEqualization(AUDIO_EQUALIZATION_BAND_FREQUENCY.AUDIO_EQUALIZATION_BAND_16K, 1);
// Original voice intensity or dry signal, value range [-20,10], unit is dB
RtcEngine.SetLocalVoiceReverb(AUDIO_REVERB_TYPE.AUDIO_REVERB_DRY_LEVEL, 10);
// Early reflection signal intensity or wet signal, value range [-20,10], unit is dB
RtcEngine.SetLocalVoiceReverb(AUDIO_REVERB_TYPE.AUDIO_REVERB_WET_LEVEL, 7);
// The room size for the required reverberation effect. Generally, the larger the room, the stronger the reverberation effect. Value range: [0,100]
RtcEngine.SetLocalVoiceReverb(AUDIO_REVERB_TYPE.AUDIO_REVERB_ROOM_SIZE, 6);
// Initial delay length of wet signal, value range: [0,200], unit: ms
RtcEngine.SetLocalVoiceReverb(AUDIO_REVERB_TYPE.AUDIO_REVERB_WET_DELAY, 124);
// The continuous strength of reverberation effect, value range: [0,100], the larger the value, the stronger the reverberation effect
RtcEngine.SetLocalVoiceReverb(AUDIO_REVERB_TYPE.AUDIO_REVERB_STRENGTH, 78);Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Development considerations
-
Only one vocal effect can be set at a time. If multiple effects are set, the last one overwrites the previous one.
-
The enumerations in
SetVoiceBeautifierPreset,SetAudioEffectPreset,SetVoiceConversionPreset, and other preset methods are optimized for different genders and should be used appropriately. Using these presets on vocals of the opposite gender may cause distortion. For more details, see API reference.
Sample project
Agora provides an open source Voice effects project on GitHub for your reference. Download or view the source code for a more detailed example.
