本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
具有SSML範例的語音標記
從 SSML增強型文字產生語音標記的程序與SSML不存在時的程序類似。使用 synthesize-speech
命令,並指定 SSML增強型文字和您想要的語音標記類型,如下列範例所示。為了讓範例更易於讀取,我們不包含視覺語音標記,但這些也可以包含。
下列 AWS CLI 範例已針對 Unix、Linux 和 macOS 格式化。對於 Windows,將每行結尾的反斜線 (\) Unix 連續字元取代為粗略 (^),並在輸入文字周圍使用完整引號 (") 取代內部標籤的單引號 (')。
aws polly synthesize-speech \ --output-format json \ --voice-id Joanna \ --text-type ssml \ --text '<speak><prosody volume="+20dB">Mary had <break time="300ms"/>a little <mark name="animal"/>lamb</prosody></speak>' \ --speech-mark-types='["sentence", "word", "ssml"]' \ output.txt
當您提出此請求時,Amazon Polly 會在 .txt 檔案中傳回下列項目:
{"time":0,"type":"sentence","start":31,"end":95,"value":"Mary had <break time=\"300ms\"\/>a little <mark name=\"animal\"\/>lamb"} {"time":6,"type":"word","start":31,"end":35,"value":"Mary"} {"time":325,"type":"word","start":36,"end":39,"value":"had"} {"time":897,"type":"word","start":40,"end":61,"value":"<break time=\"300ms\"\/>"} {"time":1291,"type":"word","start":61,"end":62,"value":"a"} {"time":1373,"type":"word","start":63,"end":69,"value":"little"} {"time":1635,"type":"ssml","start":70,"end":91,"value":"animal"} {"time":1635,"type":"word","start":91,"end":95,"value":"lamb"}