-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updates * review updates * review update --------- Co-authored-by: saudsami <[email protected]>
- Loading branch information
1 parent
67a4d7e
commit 5b83aad
Showing
17 changed files
with
658 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 155 additions & 2 deletions
157
shared/video-sdk/develop/voice-effects/project-implementation/electron.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,157 @@ | ||
|
||
<PlatformWrapper platform="electron"> | ||
Voice effects for Electron is coming soon. | ||
|
||
### Set audio scenario and audio profile | ||
|
||
For optimal audio quality, take the following steps: | ||
|
||
- Call <Link to="{{Global.API_REF_ELECTRON_ROOT}}/class_irtcengine.html#api_irtcengine_setaudioscenario">setAudioScenario</Link> to set the audio scenario to high-quality `AudioScenarioGameStreaming`. | ||
- Call <Link to="{{Global.API_REF_ELECTRON_ROOT}}/class_irtcengine.html#api_irtcengine_setaudioprofile">setAudioProfile</Link> 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` | ||
|
||
```javascript | ||
// 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 | ||
|
||
```javascript | ||
// Set the vocal effect to magnetic (for male voices) | ||
rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.ChatBeautifierMagnetic); | ||
|
||
// Turn off the effect | ||
rtcEngine.setVoiceBeautifierPreset(VoiceBeautifierPreset.VoiceBeautifierOff); | ||
``` | ||
|
||
- Singing voice beautifier | ||
|
||
```javascript | ||
// 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 | ||
|
||
```javascript | ||
// 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 | ||
|
||
```javascript | ||
// Set the style to pop | ||
rtcEngine.setAudioEffectPreset(AudioEffectPreset.StyleTransformationPopular); | ||
// Turn off the effect | ||
rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); | ||
``` | ||
|
||
* Space shaping | ||
|
||
```javascript | ||
// Set the space shaping effect to KTV | ||
rtcEngine.setAudioEffectPreset(AudioEffectPreset.RoomAcousticsKtv); | ||
// Turn off the effect | ||
rtcEngine.setAudioEffectPreset(AudioEffectPreset.AudioEffectOff); | ||
``` | ||
|
||
* Electronic sound effects | ||
|
||
```javascript | ||
// 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 | ||
|
||
```javascript | ||
// 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 | ||
|
||
```javascript | ||
// 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: | ||
|
||
```javascript | ||
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); | ||
``` | ||
</PlatformWrapper> |
Oops, something went wrong.