How do I change the voice during my response in "Actions on Google"? Is there an SSML code to temporarily change the voice, for example, from male to female, while reading a quotation?
Asked
Active
Viewed 2,150 times
4
-
Yes. You got the option to change the voice with SSML. Have you saw this: https://developers.google.com/actions/reference/ssml you – Ido Green Jul 31 '17 at 16:52
-
Thanks, @IdoGreen. I see the SSML reference, but there is nothing there explaining how to change the voice. – Glen Little Jul 31 '17 at 18:42
-
You can't change the voice at the moment, however you can use SSML to have more customizable (=audio) response. I hope it helps. – Ido Green Aug 01 '17 at 23:09
3 Answers
6
You actually can change the voice bye adding a voice tag inside the speak tag. You can try something like this:
<speak><voice gender="female">Hello I'm Mary</voice><break time="2s"/><voice gender="male">Hey I'm John</voice><speak>

Nazeem
- 468
- 2
- 9
-
I've now found that it doesn't seem to have an impact in the Simulator, but does in Google Assistant. – Glen Little Aug 17 '17 at 22:47
-
1To update/expand: it appears `
`, ` – SamVK Jan 12 '19 at 05:16`, ` `, and ` ` are all the voices currently supported (though this still doesn't appear to be officially documented anywhere.)
0
You can't change the voice at the moment, however you can use Speech Synthesis Markup Language (SSML), to have more customizable (=audio) response.
For more on how to use SSML with Action On Google: https://medium.com/google-developers/ssml-for-actions-on-google-946117f97fd1
I hope it helps.

Ido Green
- 2,795
- 1
- 17
- 26
0
Best Solution for that.
const request = {
// The text to synthesize
input: {
ssml:`<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/10/synthesis
http://www.w3.org/TR/speech-synthesis11/synthesis.xsd"
xml:lang="en-US">
<voice gender="female" languages="en-US" required="languages gender variant">It Maria and this is my female voice,</voice>
<!-- processor-specific voice selection -->
<voice name="Mike" required="name">Its Mike and its my male voice</voice>
</speak>`
},
// The language code and SSML Voice Gender
voice: { languageCode: 'en-US', ssmlGender: 'NEUTRAL' },
// The audio encoding type
audioConfig: { audioEncoding: 'MP3' },
};
That's work for me like a charm

Hassan Ali
- 54
- 6