How karaoke apps make users fall in love with singing
Tags: android, mobile, programming, audio
Published: 2022-06-10 02:21:43

![shutterstock_1270055839](https://resource.zegocloud.com/content_resource/2022/06/10/shutterstock1270055839.jpg)

## The explosion of online karaoke
With the diversification of people's entertainment activities, online entertainment activities are also diversified. This year, online karaoke applications have sprung up, such as WeSing, Smule, Yokee, StarMaker, KaraDoReMi, SingIt (DingaStar), The Voice Karaoke, Many singing applications such as SingPlay have been loved by a large number of users.

As more and more companies enter, there are more and more ways to play online karaoke, from the initial local recording, to today's Lianmai duet, grabbing wheat, and round wheat singing.

So how do we make users fall in love with singing?

If you want users to fall in love with singing, you first need to make users sing well.

So how do we make our customers sing well?

## Four secrets to improve sound effects

* Voice change: Through special processing of the sound，By optimizing the sound, the singer can make the voice sound softer while maintaining his own timbre.
* 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.

<div class="mk-hint">

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.  
</div>


## Prerequisites

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

- Create a project in [ZEGOCLOUD Admin Console](https://console.zegocloud.com?_source=dev&article=13), and get the AppID of your project.
- The ZEGO Express SDK has been integrated into the project. For details, see [Integration](https://docs.zegocloud.com/article/195?_source=dev&article=13) and [Implementation](https://docs.zegocloud.com/article/10836?_source=dev&article=13).

## Voice Change

### Set Preset Voice Changer

Call the `setVoiceChangerPreset` method to use SDK preset voice changer effect.

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

![ZegoVoiceChangerPreset](https://resource.zegocloud.com/content_resource/2022/06/10/16536325394983.jpg)


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

```java
ZegoExpressEngine.getEngine().setVoiceChangerPreset(ZegoVoiceChangerPreset.MEN_TO_CHILD);
```

### Set Custom Voice Changer

If the sound changing effect preset by the SDK cannot meet the needs, the developer can call `ZegoVoiceChangerParam` Method, through the pitch parameter `pitch` to set a custom voice changer, 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 (ie no voice change).

```java
ZegoVoiceChangerParam voiceChangerParam = new ZegoVoiceChangerParam();
param.pitch = 2.0f;
ZegoExpressEngine.getEngine().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:

![ZegoReverbPreset](https://resource.zegocloud.com/content_resource/2022/06/10/16536325703843.jpg)



The following sample code takes the large room mode as an example:
```java
ZegoExpressEngine.getEngine().setReverbPreset(ZegoReverbPreset.LARGE_ROOM);
```

### Set Custom Reverb

If the SDK preset reverb type cannot meet the needs, developers can call `ZegoReverbAdvancedParam` method, to achieve the reverberation effect required by the developer through the configuration of related parameters (for detailed parameter description, please refer to the API documentation).

```java
ZegoReverbAdvancedParam reverbParam = new ZegoReverbAdvancedParam();
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.getEngine().setReverbAdvancedParam(reverbParam);
```

<div class="mk-warning">

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`. Set enumeration method to set.

</div>


## Reverberation Echo

Call the `setReverbEchoParam` method and set the relevant parameters to realize the developer The required reverberation echo effect (for detailed parameter description, please refer to the API document).

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

```java
ZegoReverbEchoParam echoParam = new ZegoReverbEchoParam();
echoParam.inGain = 0.8f;
echoParam.outGain =1.0f;
echoParam.numDelays = 7;
int[] delay ={230,460,690,920,1150,1380,1610};
echoParam.delay=delay;

float[] decay={0.41f,0.18f,0.08f,0.03f,0.009f,0.003f,0.001f};
echoParam.decay=decay;
zegoReverbEchoParamDatas.add(echoParam);
ZegoExpressEngine.getEngine().setReverbEchoParam(echoParam);
```

## 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.

```java
ZegoAudioConfig audioConfig = new ZegoAudioConfig(STANDARD_QUALITY_STEREO);
ZegoExpressEngine.getEngine().setAudioConfig(audioConfig);
```

### 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).

<div class="mk-hint">

Starting from the **2.15.0** version, the SDK supports the all-around virtual stereo. To enable it, set the `angle` parameter to `-1`.
</div>

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

```java
ZegoExpressEngine.getEngine().enableVirtualStereo(true, 90);
```

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

```java
ZegoExpressEngine.getEngine().enableVirtualStereo(true, -1);
```