feat support google custom voice

This commit is contained in:
Hoan Luu Huu
2023-10-30 01:55:50 +00:00
parent 7cae19a4e5
commit a3aa1169b8
+2 -1
View File
@@ -257,9 +257,10 @@ const synthGoogle = async(logger, {credentials, stats, language, voice, gender,
const client = new ttsGoogle.TextToSpeechClient(credentials);
const opts = {
voice: {
...(typeof voice === 'string' && {name: voice, ssmlGender: gender || 'SSML_VOICE_GENDER_UNSPECIFIED'}),
...(typeof voice === 'string' && {name: voice}),
...(typeof voice === 'object' && {custom_voice: voice}),
languageCode: language,
ssmlGender: gender || 'SSML_VOICE_GENDER_UNSPECIFIED'
},
audioConfig: {audioEncoding: 'MP3'}
};