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
scenarioparameter toGameStreaming(3)before calling this method. - Do not set the profile parameter of
setAudioProfiletoSpeechStandard(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
setAudioProfileand set theprofileparameter 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 callingsetAudioProfileand setting theprofileparameter toMusicHighQuality(4)orMusicHighQualityStereo(5)before setting this enumerator.
Parameter param1
- If you set
presettoRoomAcoustics3DVoice, theparam1sets the cycle period of the 3D voice effect. The value range is1, 60and the unit is a second. The default value is 10 seconds, indicating that the voice moves around you every 10 seconds. - If you set
presettoPitchCorrection,param1sets 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
presettoRoomAcoustics3DVoice, you need to setparam2to 0. - If you set
presettoPitchCorrection,param2sets 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
});
}