本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
<amazon:breath> 和 <amazon:auto-breaths>
僅標準 TTS 格式支援此標籤。
自然音調的語音包含正確發音的字詞以及呼吸聲。新增呼吸聲至合成語音中,可讓語音聽起來更加自然。<amazon:breath>
和 <amazon:auto-breaths>
標籤提供呼吸聲。您有下列選項:
-
手動模式:您設定文字中呼吸聲的出現的位置、長度以及音量
-
自動化模式:Amazon Polly 會自動將呼吸聲插入語音輸出
-
混合模式:您和 Amazon Polly 都會新增呼吸聲
手動模式
在手動模式中,您將 <amazon:breath/>
標籤放入輸入文字內想要加入呼吸聲的位置。您可以分別使用 duration
和 volume
屬性來自訂呼吸聲的長度和音量:
-
duration
:控制呼吸聲的長度。有效值為:default
、x-short
、short
、medium
、long
、x-long
。預設值為medium
。 -
volume
:控制呼吸聲的音量。有效值為:default
、x-soft
、soft
、medium
、loud
、x-loud
。預設值為medium
。
注意
每個屬性值的確切長度和音量取決於使用的特定 Amazon Polly 語音。
若要使用預設值來設定呼吸聲,請使用沒有屬性的 <amazon:breath/>
。
例如,若要使用屬性來設定呼吸聲的長度與音量為中等,可將屬性設定如下:
<speak> Sometimes you want to insert only <amazon:breath duration="medium" volume="x-loud"/>a single breath. </speak>
若要使用預設值,您只需使用標籤:
<speak> Sometimes you need <amazon:breath/>to insert one or more average breaths <amazon:breath/> so that the text sounds correct. </speak>
您可以新增呼吸聲到段落中,如下所示:
<speak> <amazon:breath duration="long" volume="x-loud"/> <prosody rate="120%"> <prosody volume="loud"> Wow! <amazon:breath duration="long" volume="loud"/> </prosody> That was quite fast. <amazon:breath duration="medium" volume="x-loud"/> I almost beat my personal best time on this track. </prosody> </speak>
自動模式
在自動化模式下,您可以使用 <amazon:auto-breaths>
標籤,指示 Amazon Polly 以適當的間隔自動建立呼吸噪音。您可以設定間隔的頻率、呼吸聲音量以及呼吸聲長度。將 </amazon:auto-breaths>
標籤置於您想要加入自動呼吸聲的文字開頭,然後在尾端加上結束標籤。
注意
與手動模式標籤不同,<amazon:breath/>
、<amazon:auto-breaths>
標籤需要結束標記 (</amazon:auto-breaths>
)。
您可以使用以下含有 <amazon:auto-breaths>
標籤的可選屬性:
-
volume
:控制呼吸聲的音量。有效值為:default
、x-soft
、soft
、medium
、loud
、x-loud
。預設值為medium
。 -
frequency
:控制呼吸聲在文字中發生的頻率。有效值為:default
、x-low
、low
、medium
、high
、x-high
。預設值為medium
。 -
duration
:控制呼吸聲的長度。有效值為:default
、x-short
、short
、medium
、long
、x-long
。預設值為medium
。
在預設情況下,呼吸聲的頻率將取決於輸入文字。不過,呼吸聲經常出現在逗號和句點之後。
下列範例示範如何使用 <amazon:auto-breaths>
標籤:若要決定您的內容要使用哪些選項,請將適用的範例複製到 Amazon Polly 主控台,並聆聽差異。
-
使用不含選用參數的自動模式。
<speak> <amazon:auto-breaths>Amazon Polly is a service that turns text into lifelike speech, allowing you to create applications that talk and build entirely new categories of speech- enabled products. Amazon Polly is a text-to-speech service that uses advanced deep learning technologies to synthesize speech that sounds like a human voice. With dozens of lifelike voices across a variety of languages, you can select the ideal voice and build speech- enabled applications that work in many different countries.</amazon:auto-breaths> </speak>
-
使用含有音量控制的自動模式。未指定參數 (
duration
與frequency
) 皆設為預設值 (medium
)。<speak> <amazon:auto-breaths volume="x-soft">Amazon Polly is a service that turns text into lifelike speech, allowing you to create applications that talk and build entirely new categories of speech-enabled products. Amazon Polly is a text-to-speech service, that uses advanced deep learning technologies to synthesize speech that sounds like a human voice. With dozens of lifelike voices across a variety of languages, you can select the ideal voice and build speech- enabled applications that work in many different countries.</amazon:auto-breaths> </speak>
-
使用含有頻率控制的自動模式。未指定參數 (
duration
與volume
) 皆設為預設值 (medium
)。<speak> <amazon:auto-breaths frequency="x-low">Amazon Polly is a service that turns text into lifelike speech, allowing you to create applications that talk and build entirely new categories of speech-enabled products. Amazon Polly is a text-to-speech service, that uses advanced deep learning technologies to synthesize speech that sounds like a human voice. With dozens of lifelike voices across a variety of languages, you can select the ideal voice and build speech- enabled applications that work in many different countries.</amazon:auto-breaths> </speak>
-
使用含有多個參數的自動模式。對於未指定的
Duration
參數,Amazon Polly 會使用預設值 (medium
)。<speak> <amazon:auto-breaths volume="x-loud" frequency="x-low">Amazon Polly is a service that turns text into lifelike speech, allowing you to create applications that talk and build entirely new categories of speech-enabled products. Amazon Polly is a text-to-speech service, that uses advanced deep learning technologies to synthesize speech that sounds like a human voice. With dozens of lifelike voices across a variety of languages, you can select the ideal voice and build speech-enabled applications that work in many different countries.</amazon:auto-breaths> </speak>