首页 > 解决方案 > 在 Alexa SSML 中调整速率/音高的问题

问题描述

我试图通过以下方式调整 Alexa 的说话速度和音调:

outputSpeech: {
            type: "SSML",
            ssml: "<speak><prosody pitch="+50%">higher pitch</prosody></speak>"
},

执行结果成功,但是我注意到了"ssml": "<speak><prosody pitch=NaN" ,当我去模拟器测试时,Alexa回应了There was a problem with the requested skill's response

所以我尝试了几件事:

ssml: "<speak><prosody rate="150%">faster pace</prosody></speak>"

执行结果失败:“SyntaxError: Unexpected number”,

标签: alexassml

解决方案


您可以尝试使用此 \" 转义韵律标记属性中的双引号吗

"<speak><prosody pitch=\"+50%\">higher pitch</prosody></speak>"

或使用单引号

  const speechOutput = '<speak><prosody pitch="+50%">higher pitch</prosody></speak>';
      return handlerInput.responseBuilder
      .speak(speechOutput)
      .getResponse();

推荐阅读