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

六眼飞鱼酱① 提交于 2019-11-30 07:36:30

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/47306477/is-there-a-way-to-have-change-female-to-male-voice-during-the-conversation-in-di

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!