Ravi
Ravi

Reputation: 35549

Change google assistant voice programmatically

For most languages, the Google Assistant allows developers to choose from 4 type of voice as of now, 2 from female and 2 from male, for most languages.

I want to know the way to change it dynamically through node/java library.

I have tried with actions-on-google-nodejs but did not find anything in it.

I know we can change it either from google assistant application or from deployment setting, but do we have any way to change it dynamically?

Upvotes: 1

Views: 374

Answers (1)

Prisoner
Prisoner

Reputation: 50701

Yes. Although not documented (except in StackOverflow currently) you can use the <voice> SSML tag to change which type is used. You can further adjust the pitch to create additional variants.

You can send SSML back using the actions-on-google-nodejs library by either including a string with valid SSML or by explicitly creating a SimpleResponse and setting the ssml property.

The multivocal library includes the ability to pre-define voices as combinations of the voice and prosody tags and will let you easily define which voice is to be used for each response.

Upvotes: 2

Related Questions