Documentation
Low_Latency_Live Live Streaming
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Live Streaming
  • Upgrade the livestream
  • Advanced features
  • Enhance the livestream
  • Beautify & Change the voice

Beautify & Change the voice

Last updated:2023-04-09 15:53

Introduction

  • Voice change: By changing the user's pitch, the output sound is sensory different from the original sound, and various effects such as changing male voice to female voice are realized.
  • Reverberation: Through special processing of the sound, the reverberation effect of different environments is created, making the sound appear as if it is in a concert hall, a cathedral, etc.
  • Reverberation echo: Through special processing of the sound, it can be matched with voice change and reverberation to achieve a variety of custom sound effects, such as ethereal and robot sounds.
  • Virtual stereo: Through the deep use of dual-channel technology, each position and angle of the sound source is virtualized to achieve stereo sound, 3D surround sound, and sound discrimination.

In the live broadcast, chat room, and karaoke room scenes, in order to increase the fun and interactivity, players can change the voice to make things funny, reverberate the atmosphere, and use stereo to make the sound more three-dimensional. ZegoExpress SDK provides a variety of preset voice change, reverberation, reverberation echo, and stereo effects. Developers can flexibly set the sound they want. If you need to listen to it, you can enable ear return for testing.

The function is only effective for the sound collected by the SDK. The developer can dynamically adjust the voice change, reverberation, reverberation echo, and virtual stereo during a call or live broadcast.

Prerequisites

Before proceeding with voice change/reverb/stereo, please make sure:

  • A project has been created in ZEGOCLOUD Console and applied for a valid AppID and AppSign. For details, please refer to Console - How to view project information .
  • ZEGO Express SDK has been integrated into the project to implement basic real-time audio and video functions. For details, please refer to Integrate the SDK and Implement a basic video call.

Voice Change

Set Preset Voice Changer

Call setVoiceChangerPreset method to use SDK preset voice changer effect.

ZegoVoiceChangerPreset preset voice changing effects are as follows, developers can choose according to their needs:

Type Description Voice Change Type
None No voice change. -
MenToChild Male voice becomes a child voice. Voice Change
MenToWomen Male voice to female voice. Voice Change
WomenToChild Female voice becomes child voice. Voice Change
WomenToMen Female voice to male voice. Voice Change
Foreigner Foreigner sound effects. Voice Change
OptimusPrime Optimus prime sound. Voice Change
Android Robot sound effects. Voice Change
Ethereal Ethereal sound effects. Timbre Change
MaleMagnetic Magnetic male. Room Bel Canto
FemaleFresh Fresh female. Room Bel Canto

The following sample code takes a male voice to a child voice as an example:

[[ZegoExpressEngine sharedEngine] setVoiceChangerPreset:ZegoVoiceChangerPresetMenToChild];

Set Custom Voice Changer

If the sound changing effect preset by the SDK cannot meet the demand, the developer can call the ZegoVoiceChangerParam method to pass the pitch parameter "pitch" sets custom voice change, the value range of this parameter is [-8.0, 8.0], the larger the value, the sharper the sound, the default value is "0.0" (that is, no voice change).

ZegoVoiceChangerParam *param = [[ZegoVoiceChangerParam alloc] init];
param.pitch = 2.0;
[[ZegoExpressEngine sharedEngine] setVoiceChangerParam:param];

Reverberation

Set Preset Reverb

Call setReverbPreset to set reverberation through preset enumeration.

ZegoReverbPreset preset reverb effects are as follows, developers can choose according to their needs:

Type Description Reverb Type
None None -
SoftRoom Small room Space Shaping
LargeRoom Large room Space Shaping
ConcerHall Concert hall Space Shaping
Valley Valley Space Shaping
RecordingStudio Recording studio Space Shaping
Basement Basement Space Shaping
KTV KTV Space Shaping
VocalConcert Concert Space Shaping
Popular Popular Genre
Rock Rock Genre

The following sample code takes the large room mode as an example:

[[ZegoExpressEngine sharedEngine] setReverbPreset:ZegoReverbPresetLargeRoom];

Set Custom Reverb

If the SDK preset reverb type cannot meet the requirements, the developer can call the ZegoReverbAdvancedParam method, and match the relevant parameters Settings to achieve the reverberation effect required by the developer (for detailed parameter descriptions, please refer to the API documentation).

ZegoReverbAdvancedParam *reverbParam = [[ZegoReverbAdvancedParam alloc] init];
reverbParam.damping = 50.0; // Reverberation damping
reverbParam.reverberance = 50.0; // Reverberation
reverbParam.roomSize = 50.0; // room size
reverbParam.wetOnly = false;
reverbParam.wetGain = 5.0;
reverbParam.dryGain = 5.0;
reverbParam.toneLow = 80.0;
reverbParam.toneHigh = 80.0;
reverbParam.preDelay = 20.0;
reverbParam.stereoWidth = 0.0;

[[ZegoExpressEngine sharedEngine] setReverbAdvancedParam:reverbParam];

After setting the custom reverb parameters, the preset reverb effect set when reverb is enabled will be invalid. If you want to use the SDK preset parameters again, you can use setReverbPreset method to set.

Reverberation Echo

Call the setReverbEchoParam method to achieve the reverberation required by the developer through the configuration of related parameters Echo effect (please refer to API documentation for detailed parameter description).

The following sample code takes the ethereal effect as an example:

ZegoReverbEchoParam *echoParamEthereal = [[ZegoReverbEchoParam alloc] init];
echoParamEthereal.inGain = 0.8;
echoParamEthereal.outGain = 1.0;
echoParamEthereal.numDelays = 7;
echoParamEthereal.delay = @[@230, @460, @690, @920, @1150, @1380, @1610];
echoParamEthereal.decay = @[@0.41f, @0.18f, @0.08f, @0.03f, @0.009f, @0.003f, @0.001f];
[[ZegoExpressEngine sharedEngine] setReverbEchoParam:echoParamEthereal];

Virtual Stereo

Set the Number of Streaming Audio Channels

If you need to turn on the virtual stereo function, you must first call the setAudioConfig method to set before pushing the stream The audio encoding channel is Stereo dual channel (default is Mono).

The example here uses the preset enumeration structure ZegoAudioConfig to be set to dual-channel.

ZegoAudioConfig *config = [ZegoAudioConfig configWithPreset:ZegoAudioConfigPresetStandardQualityStereo];

[[ZegoExpressEngine sharedEngine] setAudioConfig:config];

Set Virtual Stereo Parameters

After setting the audio encoding channel to dual channel, call the enableVirtualStereo method, turn on the virtual stereo through the enable parameter, and set the sound source angle of the virtual stereo through the angle parameter to have the stereo effect. The angle range is 0 to 360, and generally can be set to 90 degrees (that is, straight ahead).

Starting from the 2.15.0 version, the SDK supports the all-around virtual stereo. To enable it, set the angle parameter to -1.

The following shows how to turn on the virtual stereo and set the angle to 90 degrees:

[[ZegoExpressEngine sharedEngine] enableVirtualStereo:YES angle:90];

The following shows how to enable the all-around virtual stereo:

[[ZegoExpressEngine sharedEngine] enableVirtualStereo:YES angle:-1];
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code