问题描述
2021 年 3 月 1 日,Google Text-to-speech released beta features,包括对具有 <voice>
或 name
属性的 ssml lang
标记的支持。
我希望使用这些测试版功能,但我不知道它们发布到哪个渠道或如何访问它们。我没有在文档中找到任何可以引导我找到它们的面包屑。
我注意到在 TTS product home page 上,演示功能使用 v1beta1
,但不支持 <voice>
标签。
Screenshot of json from TTS demo stripping out the voice tag
也就是说,对于 ssml:
Blah Blah English Text. <voice name="ko-KR-Wavenet-D"> Blah Blah Korean Text.</voice> <break time="400ms" /> Blah Blah English Text.
</speak>
演示显示了以下 json 请求正文:
{
"audioConfig": {
"audioEncoding": "LINEAR16","pitch": 0,"speakingRate": 1
},"input": {
"ssml": "<speak> Blah Blah English Text. Blah Blah Korean Text. <break time=\"400ms\" /> Blah Blah English Text. </speak>"
},"voice": {
"languageCode": "en-US","name": "en-US-Wavenet-D"
}
}
我们的尝试
在我们自己的脚本中,使用 google text-to-speech api 从 csv 提示表生成音频,我们历来使用一般版本。当我们更改为 v1beta1
时,脚本仍然有效,但 <voice>
标记仍然无效。我们使用符号链接到 nodejs-text-to-speech master 的 npm 包。
我们的脚本使用:
const textToSpeech = require('@google-cloud/text-to-speech');
和
一般版本const client = new textToSpeech.TextToSpeechClient();
我们一直在尝试使用 3 月 1 日的测试版功能
const client = new textToSpeech.v1beta1.TextToSpeechClient();
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)