tencent cloud

All product documents
Game Multimedia Engine
Voice Changing
Last updated: 2024-01-18 14:22:54
Voice Changing
Last updated: 2024-01-18 14:22:54
This document describes how to integrate with and debug GME APIs for voice changing effects.

Overview





Prerequisites

You have activated the voice chat service. For more information, see Activating Services.
You have activated the speech-to-text service. For more information, see Activating Services.
You have integrated the GME SDK, including core APIs and voice chat APIs. For more information, see Quick Integration of Native SDK, Quick Integration of SDK for Unity, and Quick Integration of SDK for Unreal Engine.
You have integrated the libgmesoundtouch library file of the GME SDK. Ensure that the project's library files include libgmesoundtouch. For more information, see SDK Version Upgrade Guide.

Integrating Real-Time Voice Changing

Voice changing API

After successful room entry and mic enablement, call the SetVoiceType API to set the voice changing effect. If the API returns 0, the call is successful, and the local sound heard by users in the room has the voice changing effect. To test the effect, use the in-ear monitoring feature (API: EnableLoopBack).

Function prototype

Android
iOS
Unity
C++
public static class ITMG_VoiceType {
public static final int ITMG_VOICE_TYPE_ORIGINAL_SOUND = 0;
public static final int ITMG_VOICE_TYPE_LOLITA = 1;
public static final int ITMG_VOICE_TYPE_UNCLE = 2;
public static final int ITMG_VOICE_TYPE_INTANGIBLE = 3;
public static final int ITMG_VOICE_TYPE_DEAD_FATBOY = 4;
public static final int ITMG_VOICE_TYPE_HEAVY_MENTAL = 5;
public static final int ITMG_VOICE_TYPE_DIALECT = 6;
public static final int ITMG_VOICE_TYPE_INFLUENZA = 7;
public static final int ITMG_VOICE_TYPE_CAGED_ANIMAL = 8;
public static final int ITMG_VOICE_TYPE_HEAVY_MACHINE = 9;
public static final int ITMG_VOICE_TYPE_STRONG_CURRENT = 10;
public static final int ITMG_VOICE_TYPE_KINDER_GARTEN = 11;
public static final int ITMG_VOICE_TYPE_HUANG = 12;
};
public abstract int SetVoiceType(int type);

-(QAVResult)SetVoiceType:(ITMG_VOICE_TYPE) type

public abstract class ITMGAudioEffectCtrl{
public static int VOICE_TYPE_ORIGINAL_SOUND = 0;
public static int VOICE_TYPE_LOLITA = 1;
public static int VOICE_TYPE_UNCLE = 2;
public static int VOICE_TYPE_INTANGIBLE = 3;
public static int VOICE_TYPE_DEAD_FATBOY = 4;
public static int VOICE_TYPE_HEAVY_MENTAL = 5;
public static int VOICE_TYPE_DIALECT = 6;
public static int VOICE_TYPE_INFLUENZA = 7;
public static int VOICE_TYPE_CAGED_ANIMAL = 8;
public static int VOICE_TYPE_HEAVY_MACHINE = 9;
public static int VOICE_TYPE_STRONG_CURRENT = 10;
public static int VOICE_TYPE_KINDER_GARTEN = 11;
public static int VOICE_TYPE_HUANG = 12;
public abstract int SetVoiceType(int voiceType);
}

class ITMGAudioEffectCtrl {
public:
virtual ~ITMGAudioEffectCtrl(){};
virtual int SetVoiceType(ITMG_VOICE_TYPE voiceType) = 0;
}

Parameter
Type
Description
type
int
Indicates the type of local voice changing effect.
Type parameter
Value
Description
ITMG_VOICE_TYPE_ORIGINAL_SOUND
0
Original
ITMG_VOICE_TYPE_LOLITA
1
Lolita
ITMG_VOICE_TYPE_UNCLE
2
Uncle
ITMG_VOICE_TYPE_INTANGIBLE
3
Ethereal
ITMG_VOICE_TYPE_DEAD_FATBOY
4
Fatty
ITMG_VOICE_TYPE_HEAVY_MENTA
5
Heavy metal
ITMG_VOICE_TYPE_DIALECT
6
Foreign
ITMG_VOICE_TYPE_INFLUENZA
7
Catching cold
ITMG_VOICE_TYPE_CAGED_ANIMAL
8
Animal
ITMG_VOICE_TYPE_HEAVY_MACHINE
9
Machine
ITMG_VOICE_TYPE_STRONG_CURRENT
10
Strong current
ITMG_VOICE_TYPE_KINDER_GARTEN
11
Kid
ITMG_VOICE_TYPE_HUANG
12
Urchin

Sample code

ITMGContextGetInstance()->GetAudioEffectCtrl()->setVoiceType(0);

Integrating Voice Changing for Voice Message

Process




Voice changing doesn't affect the original voice message, as the voice changing effect will be reflected only during playback.

Voice message playback

Add voice changing parameters when calling the voice message playback API.
Android
iOS
Unity
C++
public abstract int PlayRecordedFile(String filePath,int voicetype);

-(int)PlayRecordedFile:(NSString*)filePath VoiceType:(ITMG_VOICE_TYPE) type

ITMGPTT PlayRecordedFile(string filePath,int voiceType);

public abstract int PlayRecordedFile(string filePath,int voiceType);

Parameter
Type
Description
filePath
string
Local audio file path
voicetype
int
Voice changer type

Error codes

Error Code Value
Cause
Suggested Solution
20485
Playback is not started.
Ensure the existence of the file and the validity of the file path.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon