setLocalVoiceFormant

Set the formant ratio to change the timbre of human voice.

abstract setLocalVoiceFormant(formantRatio: number): number;

Formant ratio affects the timbre of voice. The smaller the value, the deeper the sound will be, and the larger, the sharper. After you set the formant ratio, all users in the channel can hear the changed voice. If you want to change the timbre and pitch of voice at the same time, Agora recommends using this method together with setLocalVoicePitch.

Applicable scenarios

You can call this method to set the formant ratio of local audio to change the timbre of human voice.

Call timing

This method can be called either before or after joining the channel.

Restrictions

None.

Parameters

formantRatio
The formant ratio. The value range is [-1.0, 1.0]. The default value is 0.0, which means do not change the timbre of the voice.
Note: Agora recommends setting this value within the range of [-0.4, 0.6]. Otherwise, the voice may be seriously distorted.

Returns

  • 0: Success.
  • < 0: Failure.