放慢 Twilio 文本到 gather 中的语音播放

Slowing down Twilio text to voice playback in gather

我正在尝试使用 SSMLProsody 函数来放慢人名和 phone 号码的播放速度。我已经使用 space 和句点方法来显示速度,但我想要更多的控制。我看到 SSMLProsody 方法有一个 "rate",我认为它可以解决问题,但我无法让它工作。如果有人可以帮助我,我将不胜感激。我的代码示例:

var gather = new Gather(allowVoiceResponse ? new List<Gather.InputEnum>(new[] {Gather.InputEnum.Speech, Gather.InputEnum.Dtmf}) : new List<Gather.InputEnum>(new[] { Gather.InputEnum.Dtmf }),
                numDigits: 1,
                hints: "connect me, connect me now, connect",
                timeout: CallLoopTimeout,
                speechTimeout: "auto",
                action: new Uri($"{NotificationConfigurationManager.Configuration.TwilioVoiceApiAddress}ConnectVisitorCallback?{queryParams.GenerateQueryString()}"),
                method: "POST");

if (lowSpeechConfidence)
{
     gather.Play(new Uri($"{NotificationConfigurationManager.Configuration.TwilioVoiceApiAddress}GetSoundClip?siteId={siteId}&index=3"));
}
else
{
     var sayName = new Say(voice: Say.VoiceEnum.Man).SsmlProsody(queryParams.SpacedName, rate: "30%");
     var sayPhone = new Say(voice: Say.VoiceEnum.Man).SsmlProsody(queryParams.SpacedPhoneNumber, rate: "30%");
     gather.Play(new Uri($"{NotificationConfigurationManager.Configuration.TwilioVoiceApiAddress}GetSoundClip?siteId={siteId}&index=1"))
                    .Append(sayName)
                    .Play(new Uri($"{NotificationConfigurationManager.Configuration.TwilioVoiceApiAddress}GetSoundClip?siteId={siteId}&index=2"))
                    .Append(sayPhone);
 }

此处为 Twilio 开发人员布道师。

仅当您使用 Amazon's Polly voices 时才支持 <Prosody> 和其他 SSML 命令。

所以你有:

var sayName = new Say(voice: Say.VoiceEnum.Man).SsmlProsody(queryParams.SpacedName, rate: "30%");

你需要像

这样的东西
var sayName = new Say(voice: Say.VoiceEnum.PollyJoanna).SsmlProsody(queryParams.SpacedName, rate: "30%");

您还可以在 Twilio 控制台中设置默认语音。