Babelfish
Babelfish

Reputation: 135

How to use the voice element with different voices in ssml?

I try to generate audio file with the Google Text-To-Speech API. Because I need different voices in my dialogs, I try to use the voice element of ssml:

<speak>
<voice languages="en-US" gender="female" name="en-US-Wavenet-F">Have you got a girlfriend?</voice>
<voice languages="en-GB" gender="male" name="en-GB-Wavenet-B">Yes, I have.</voice>
</speak>

But it doesn’t work and only the gender attribute will be recognized – but only with the default voice and not the selected Wavenet voice.

My question - Is there a way to use different Wavenet voices in one ssml file or can I only define the voice globally for the whole file?

Upvotes: 1

Views: 1194

Answers (2)

Jaroslav
Jaroslav

Reputation: 742

Interesting thing that you can't change voice gender using tag in Cloud Text To Speech, tested with "Convert your text to speech right now" emulator here, but with TTS emulator in Google Actions you can do that, but both references for SSML the same 1, 2.

I created a Feature Request to have "voice options" on public issue tracker, you can star it in order to get notified when it gets updated. Please, bear in mind that we don't have an ETA for it.

Upvotes: 1

jfix
jfix

Reputation: 561

I've been facing the same question, and unfortunately, according to the documentation, the voice element doesn't seem to be supported at this time:

Note that not all of the elements and options described in the W3 SSML specification are currently supported by Cloud Text-to-Speech. This page details which elements and options are available for your application. The W3 reference links provided below may be helpful for additional context and examples.

I guess your best bet is to create several files and then concatenate them, that's at least what I am going to do.

Upvotes: 1

Related Questions