TwiML™ Voice: <Say>
The <Say>
verb converts text to speech that is read back to the caller. <Say>
is useful for development or saying dynamic text that is difficult to pre-record. The verb offers different options for voices, each with its own supported set of languages and genders, so you can configure your TwiML depending on your preferred gender and language combination.
動詞の属性
The <Say>
verb supports different attributes, depending on the voice
value you set.
voice
The <Say>
verb allows you to specify the voice to use for the text. The voices man
and woman
support English, Spanish, French, German, and Italian languages. The voice alice
speaks even more languages with support for several different locales in a female voice. You can also use one of over 50 Amazon Polly voices. Please visit the Text-to-Speech docs page to learn more.
属性名 | 許容値 | 初期値 |
---|---|---|
voice | man, woman, alice, or any of the Amazon Polly voices | man (for Basic Provider); Salli (for Amazon Polly Provider). See the text-to-speech console to configure. |
loop | 0 以上の整数 | 1 |
language | 後述のセクションを参照 | 後述のセクションを参照 |
voice = man または woman のとき
voice に man
または woman
を指定した際は、以下の属性と値を指定できます。
※ 以下の値が言語の属性として使用できます。
属性名 | 許容値 | 初期値 |
---|---|---|
language | en、en-gb、es、fr、de | en |
DIAL動詞 と SMS動詞は、複数の属性を使えます。
下の例ではcallerIdパラメータが省略されていますが、Twilio for KDDI Web Communications をご利用のお客様においては、callerId パラメータで必ずご自身で購入したTwilio電話番号を指定する必要があり、かつ、省略できません。
DIAL動詞で電話をかける場合にはTwilio電話番号(050/0120/0800/その他番号)を、SMS動詞でSMSを送信する場合にはアメリカ番号もしくはSMSが有効なTwilio番号を指定する必要があります。
voice = alice の場合
When you set the voice to alice
, you may use the following values for the language attribute:
属性名 | 初期値 |
---|---|
language | en-US |
許容値 | 言語、ロケール |
da-DK | Danish, Denmark |
de-DE | German, Germany |
en-AU | English, Australia |
en-CA | English, Canada |
en-GB | English, UK |
en-IN | English, India |
en-US | English, United States |
ca-ES | Catalan, Spain |
es-ES | Spanish, Spain |
es-MX | Spanish, Mexico |
fi-FI | Finnish, Finland |
fr-CA | French, Canada |
fr-FR | French, France |
it-IT | Italian, Italy |
ja-JP | Japanese, Japan |
ko-KR | Korean, Korea |
nb-NO | Norwegian, Norway |
nl-NL | Dutch, Netherlands |
pl-PL | Polish-Poland |
pt-BR | Portuguese, Brazil |
pt-PT | Portuguese, Portugal |
ru-RU | Russian, Russia |
sv-SE | Swedish, Sweden |
zh-CN | Chinese (Mandarin) |
zh-HK | Chinese (Cantonese) |
zh-TW | Chinese (Taiwanese Mandarin) |
DIAL動詞 と SMS動詞は、複数の属性を使えます。
下の例ではcallerIdパラメータが省略されていますが、Twilio for KDDI Web Communications をご利用のお客様においては、callerId パラメータで必ずご自身で購入したTwilio電話番号を指定する必要があり、かつ、省略できません。
DIAL動詞で電話をかける場合にはTwilio電話番号(050/0120/0800/その他番号)を、SMS動詞でSMSを送信する場合にはアメリカ番号もしくはSMSが有効なTwilio番号を指定する必要があります。
language
The language
attribute allows you to specify a language and locale, with the affiliated accent and pronunciations. Twilio supports separate languages depending on the voice you choose. man
or woman
voices work with the following locales: English with an American accent (en
), English with a British accent (en-gb
), Spanish (es
), French (fr
), Italian (it
), and German (de
). The default is English with an American accent (en
).
The alice
voice speaks 26 total dialects (18 languages and 14 locales). See the table above for a description of all the languages and locales supported by Alice.
ご注意: Alice のみに対応する言語指定を行い、voice 指定を行わなかった場合、デフォルトでは Alice が適用されます。例えば、以下の TwiML ではデフォルトで Alice が指定されます。
loop
The loop
attribute specifies how many times you'd like the text repeated. The default is once. Specifying 0 will cause the <Say>
verb to loop until either the call is hung up or 1,000 iterations are performed.
名詞
The noun
of a TwiML verb is the content nested within the verb; it's what the verb acts upon. The only noun for the <Say>
verb is the plaintext that will be played.
名詞 | 概要 |
---|---|
plain text | The text Twilio reads to the caller. Basic TTS Voices are limited to 4,096 UTF-8 single byte characters. Polly Voices are limited to 3,000 UTF-8 single byte characters, not including SSML tags. |
ネスティングルール
You can't nest any verbs within <Say>
. However, you can nest <Say>
within the <Gather>
verb.
サンプル
例 1: Hello World
以下のTwiMLへ着信すると、1度だけ男性の声で "Hello world" と発話します。
例 2: Hello, Hello
このTwiMLでは、ポルトガル語でいう「こんにちは」を2回、発話します。
ヒントとテクニック
<Say>
動詞で発話すテキストの指定は 最大 4,096 ユニコード文字までです。
ただし、日本語の場合現在424文字までとなっております。<SAY>動詞を複数並べることによりこの制限を超えることができます。- テキストから音声への変換で、
<Say>
動詞は番号、日付、時間、金額、その他の省略記号の発音を推測します。 これらの読み上げを十分にテストしてください。 - When saying numbers, "12345" will be spoken as "twelve thousand three hundred forty-five", whereas "1 2 3 4 5" will be spoken as "one two three four five."
- Punctuation such as commas and periods will be interpreted as natural pauses.
<Say>
は事前に録音しておくことが難しい、動的なテキストの読み上げに使えます。<Say>
の内容が静的なテキストの場合は、実際に人が読み上げる音声を録音し、<Play>
動詞を使う方法もあります。- もし、長いポーズを入れたい場合は、
<Pause>
動詞を試してみてください。<Pause>
は<Say>
のタグの外に書かなければならず、中にネストしては使えません。
ヘルプが必要ですか?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.