SynthesisInput synthesisInput = SynthesisInput.newBuilder()
.setText(textToSpeechRequest.getMessage())
.build();
AudioConfig audioConfig = AudioConfig.newBuilder()
.setAudioEncoding(AudioEncoding.LINEAR16)
.build();
VoiceSelectionParams voiceSelectionParams = VoiceSelectionParams.newBuilder()
.setLanguageCode("ko-KR")
.setSsmlGender(SsmlVoiceGender.MALE)
// .setName("ko-KR-Standard-A")
.build();
SynthesizeSpeechRequest synthesizeSpeechRequest = SynthesizeSpeechRequest.newBuilder()
.setInput(synthesisInput)
.setAudioConfig(audioConfig)
.setVoice(voiceSelectionParams)
.build();
SynthesizeSpeechResponse speechResponse = textToSpeechClient.synthesizeSpeech(synthesizeSpeechRequest);
This is my tts code. Currently, I have two problems that I can't solve.
problem 1
problem 2
You should set the voice name to "ko-KR-Neural2-C" since you are using the Korean (South Korea) language in MALE. You can view this documentation for reference.
According to the comments above,
If you don't set the name, it says you will choose language_code and gender, but does this function not work?
I understood this when I set the gender to MALE and Language_code to ko,
Automatically select the voice name as ko-KR-Neural2-C.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |