我想用SSML markers通过 Google Cloud text-to-speech API 请求音频流中这些标记的时间。这些时间戳是必要的,以便为用户提供效果提示、单词/部分突出显示和反馈。
我找到了 this question这是相关的,尽管问题是指每个单词的时间戳而不是 SSML <mark>
标签。
以下 API 请求返回 OK,但显示缺少请求的标记数据。这是使用 Cloud Text-to-Speech API v1
.
{
"voice": {
"languageCode": "en-US"
},
"input": {
"ssml": "<speak>First, <mark name=\"a\"/> second, <mark name=\"b\"/> third.</speak>"
},
"audioConfig": {
"audioEncoding": "mp3"
}
}
回复:
{
"audioContent":"//NExAAAAANIAAAAABcFAThYGJqMWA..."
}
它只提供没有任何上下文信息的合成音频。
是否有我忽略的 API 请求可以公开有关这些标记的信息,例如 IBM Watson 的情况和 Amazon Polly ?
最佳答案
看起来这在 Cloud Text-to-Speech API v1beta1
中受支持:https://cloud.google.com/text-to-speech/docs/reference/rest/v1beta1/text/synthesize#TimepointType
您可以使用 https://texttospeech.googleapis.com/v1beta1/text:synthesize
.套装TimepointType
至 SSML_MARK
.如果未设置此字段,则默认不返回时间点。
关于markers - 如何从 Google Cloud text-to-speech API 获取 SSML <mark> 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57381977/