没有 SSML 的语音标记示例 - Amazon Polly

没有 SSML 的语音标记示例

以下示例显示了您所请求元数据的简单句子在屏幕上显示的效果:“Mary had a little lamb”(玛丽有一只小羊羔)。为简单起见,我们在此示例中未包括 SSML 语音标记。

以下 AWS CLI 示例针对 Linux、Unix 和 macOS 编排了格式。对于 Windows,请将每行末尾的反斜杠 (\) Unix 行继续符替换为脱字号 (^) 并在输入文本周围使用全角引号(“),内部标签使用单引号(’)。

aws polly synthesize-speech \ --output-format json \ --voice-id Joanna \ --text 'Mary had a little lamb.' \ --speech-mark-types='["viseme", "word", "sentence"]' \ MaryLamb.txt

当您发出此请求时,Amazon Polly 会在 .txt 文件中返回以下内容:

{"time":0,"type":"sentence","start":0,"end":23,"value":"Mary had a little lamb."} {"time":6,"type":"word","start":0,"end":4,"value":"Mary"} {"time":6,"type":"viseme","value":"p"} {"time":73,"type":"viseme","value":"E"} {"time":180,"type":"viseme","value":"r"} {"time":292,"type":"viseme","value":"i"} {"time":373,"type":"word","start":5,"end":8,"value":"had"} {"time":373,"type":"viseme","value":"k"} {"time":460,"type":"viseme","value":"a"} {"time":521,"type":"viseme","value":"t"} {"time":604,"type":"word","start":9,"end":10,"value":"a"} {"time":604,"type":"viseme","value":"@"} {"time":643,"type":"word","start":11,"end":17,"value":"little"} {"time":643,"type":"viseme","value":"t"} {"time":739,"type":"viseme","value":"i"} {"time":769,"type":"viseme","value":"t"} {"time":799,"type":"viseme","value":"t"} {"time":882,"type":"word","start":18,"end":22,"value":"lamb"} {"time":882,"type":"viseme","value":"t"} {"time":964,"type":"viseme","value":"a"} {"time":1082,"type":"viseme","value":"p"}

在这个输出中,文本的每个部分都由语言标记断开:

  • 句子“Mary had a little lamb.”(玛丽有一只小羊羔。)

  • 文本中的每个单词:“Mary”、“had”、“a”、“little”和“lamb”。

  • 相应音频流中每个声音的语音视位:“p”、“E”、“r”、“i”等。有关语音视位的更多信息,请参阅 语音视位和 Amazon Polly