setAudioEffectParameters method

  1. @override
Future<void> setAudioEffectParameters(
  1. AudioEffectPreset preset,
  2. int param1,
  3. int param2
)

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

Parameter preset The options for SDK preset audio effects:

  • 3D voice effect: RoomAcoustics3DVoice
    • Call setAudioProfile and set the profile parameter to MusicStandardStereo(3) or MusicHighQualityStereo(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.
  • Pitch correction effect: PitchCorrection. To achieve better audio effect quality, Agora recommends calling setAudioProfile and setting the profile parameter to MusicHighQuality(4) or MusicHighQualityStereo(5) before setting this enumerator.

Parameter param1

  • If you set preset to RoomAcoustics3DVoice, the param1 sets the cycle period of the 3D voice effect. The value range is 1, 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 to PitchCorrection, 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 to RoomAcoustics3DVoice, you need to set param2 to 0.
  • If you set preset to PitchCorrection, 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,
  });
}