setAudioEffectParameters method
Sets parameters for SDK preset audio effects.
Call this method to set the following parameters for the local user who sends an audio stream:
- 3D voice effect: Sets the cycle period of the 3D voice effect.
- Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. Different songs have different modes and tonic pitches. Agora recommends bounding this method with interface elements to enable users to adjust the pitch correction interactively.
After setting parameters, all users in the channel can hear the relevant effect.
Note
- You can call this method either before or after joining a channel.
- To achieve better audio effect quality, Agora recommends calling RtcEngine.setAudioProfile and setting the
scenario
parameter toGameStreaming(3)
before calling this method. - Do not set the profile parameter of
setAudioProfile
toSpeechStandard(1)
; otherwise, this method call fails. - This method works best with the human voice. Agora does not recommend using this method for audio containing music.
- After calling this method, Agora recommends not calling the following methods, because they can override
setAudioEffectParameters
:
Parameter preset
The options for SDK preset audio effects:
- 3D voice effect:
RoomAcoustics3DVoice
- Call
setAudioProfile
and set theprofile
parameter toMusicStandardStereo(3)
orMusicHighQualityStereo(5)
before setting this enumerator; otherwise, the enumerator setting does not take effect. - If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear the anticipated voice effect.
- Call
- Pitch correction effect:
PitchCorrection
. To achieve better audio effect quality, Agora recommends callingsetAudioProfile
and setting theprofile
parameter toMusicHighQuality(4)
orMusicHighQualityStereo(5)
before setting this enumerator.
Parameter param1
- If you set
preset
toRoomAcoustics3DVoice
, theparam1
sets the cycle period of the 3D voice effect. The value range is1, 60
and the unit is a second. The default value is 10 seconds, indicating that the voice moves around you every 10 seconds. - If you set
preset
toPitchCorrection
,param1
sets the basic mode of the pitch correction effect:- 1: (Default) Natural major scale.
- 2: Natural minor scale.
- 3: Japanese pentatonic scale.
Parameter param2
- If you set
preset
toRoomAcoustics3DVoice
, you need to setparam2
to 0. - If you set
preset
toPitchCorrection
,param2
sets the tonic pitch of the pitch correction effect:- 1: A
- 2: A#
- 3: B
- 4: (Default) C
- 5: C#
- 6: D
- 7: D#
- 8: E
- 9: F
- 10: F#
- 11: G
- 12: G#
Implementation
@override
Future<void> setAudioEffectParameters(
AudioEffectPreset preset, int param1, int param2) {
return _invokeMethod('setAudioEffectParameters', {
'preset': AudioEffectPresetConverter(preset).value(),
'param1': param1,
'param2': param2
});
}