问题
I'm trying to use Twilio's <Say> verb to pronounce a sequence of digits clearly. I'm finding it is hard to generate a natural (half-second) pause between each digit. How do I do this correctly?
The <Pause> xml command only takes integer values for seconds, so it's too long to use.
回答1:
From here: Link
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 by the speech engine.
If you want to insert a long pause try using the
<Pause>
verb.<Pause>
should be placed outside<Say>
tags, not nested inside them.
回答2:
For less then one second pause:
<Say language="en-US" voice="alice">
Your verification code is 1,,,,2,,,,3,,,,4,,,,5
</Say>
You can increase and decrease the number of commas
according to you convenience.
回答3:
This is tangentially related, but I figured people looking for something similar would end up on this question (like I did).
I wanted the Say
verb to read a US phone number in a natural 3-3-4 cadence. Here is some C# that does just that. I'm sure you can figure out how to translate it to other languages:
private static string SayNaturalNumber(string digits)
{
var newNumber = "";
for (int i = 0; i < digits.Length; i++)
{
if (i == 0)
newNumber += digits[i];
else
newNumber += " " + digits[i];
if (i == 2) //after third digit
newNumber += ",,,,";
if (i == 5) //after sixth digit
newNumber += ",,,,";
}
return newNumber;
}
来源:https://stackoverflow.com/questions/12628933/how-can-i-generate-a-half-second-pause-in-twiml