Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to have change female to male voice during the conversation in DialogFlow (Api.ai)

We a building a chatbot app for Google Home using Api.ai (Dialogflow now) which has both male and female historical figures. We are using Actions on google. Google lets you default to a male or female voice when deploying the app. Is there a way to switch between male to female voice dynamically, for example, using code in webhook?

like image 648
Mian Ahmad Avatar asked Nov 15 '17 11:11

Mian Ahmad


People also ask

What is the difference between Dialogflow and Dialogflow CX?

The Dialogflow Essentials (ES) Edition is a pay-as-you-go edition that provides the standard ES agent type. The Essentials Edition offers production-ready quotas and support from Google Cloud support. The Dialogflow Customer Experience (CX) Edition is a pay-as-you-go edition that provides the advanced CX agent type.

What is CX in Dialogflow?

A Dialogflow CX agent is a virtual agent that handles concurrent conversations with your end-users. It is a natural language understanding module that understands the nuances of human language.

What is action and parameter in Dialogflow?

Dialogflow sends an API interaction response for each step of slot filling. For each of these slot filling responses, the intent and action will be the same, and the parameters collected so far will be provided. When building an agent, you provide prompts that the agent will use to get parameter data from the end-user.

How does Dialogflow NLU work?

Dialogflow uses a state-based data model which allows developers to reuse different components including intents, entities, and webhooks. It also enables developers to define transitions, data conditions for different flows, and also handle deviations from the main topic or simultaneous questions effortlessly.


1 Answers

Maybe. Although SSML supports a <voice> tag, the documentation for Actions does not list it as supported. However, as you noted, there appears to be some support. The gender and variant attributes seem to work, at least for en-US. The languages attribute doesn't seem to be. So something like this might work:

<speech>
    <voice gender="male" variant="1">male</voice>
    <voice gender="male" variant="2">male</voice>
    <voice gender="female" variant="1">female</voice>
    <voice gender="female" variant="2">female</voice>
</speech>

However what is documented as working is to adjust the pitch of the default voice (whichever one you pick) using the <prosody> SSML tag. Here is an example you can use to see how it sounds if you vary the pitch:

<speech>
    test
    <prosody pitch="-1st">test</prosody>
    <prosody pitch="-2st">test</prosody>
    <prosody pitch="-3st">test</prosody>
    <prosody pitch="-4st">test</prosody>
    <prosody pitch="-5st">test</prosody>
    <prosody pitch="-6st">test</prosody>
    <prosody pitch="-7st">test</prosody>
    <prosody pitch="-8st">test</prosody>
    <prosody pitch="-9st">test</prosody>
    <prosody pitch="+1st">test</prosody>
    <prosody pitch="+2st">test</prosody>
    <prosody pitch="+3st">test</prosody>
    <prosody pitch="+4st">test</prosody>
    <prosody pitch="+5st">test</prosody>
    <prosody pitch="+6st">test</prosody>
    <prosody pitch="+7st">test</prosody>
    <prosody pitch="+8st">test</prosody>
    <prosody pitch="+9st">test</prosody>
</speech>

You can also combine the two tags.

like image 159
Prisoner Avatar answered Sep 27 '22 23:09

Prisoner