1
var Response = require('alexa-response');

//first intent
LaunchRequest:function(){
//Type 1 gives an error saying the "response is not valid" when tested in the     developers console.   
//the Response here is an npm library
Response.directives(
AudioPlayer.play({ url: 'https://s3.amazonaws.com/sounds226/boom.mp3' }),
AudioPlayer.enqueue({ url: 'https://s3.amazonaws.com/sounds226/boom.mp3' }                                    ) .build();

//Type 2 : gives an error when tested on echosim.io saying that the response is not valid
speechOutput = this.t('WELCOME_MESSAGE');    this.response.audioPlayerPlay("REPLACE_ALL",audioData[1].url).speak(speechOutput);
this.emit(':responseReady');

//Type 3: tried to insert the audio tag within the speech response, error again
speechOutput = {
speech: "<speak>" +message+ "<audio src = 'https://s3.amazonaws.com/sounds226/boom.mp3'/></speak>",
    type : 'SSML' 
};
response.ask(speechOutput);
}

我正在尝试在 Alexa 以我的技能说话之前插入音频。音频在 90 秒内。是我理解音频标签的方式错误还是以错误的方式使用指令?先感谢您。任何帮助表示赞赏

4

4 回答 4

0
  1. 检查音频剪辑的格式。它在 Alexa 文档的 SSML 页面上给出
  2. 确保您的音频剪辑符合该格式。
于 2019-10-13T13:31:04.683 回答
0

在 SSML 响应中使用<audio>标签时,请确保 MP3 文件符合 Alexa 要求的采样率 (16000) 和比特率 (48kbps)。

更多细节在这里。

于 2017-06-18T01:01:46.377 回答
0

音频应编码为特定格式(项目速率 16000 和质量为 48 kbps),以便 Alexa 播放。请使用以下命令转换您的音频,

ffmpeg -i -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000

您可以从https://www.ffmpeg.org/下载“ffmpeg”

如果您在运行上述命令之前使用 Windows CD 到 ffmeg 的 bin 文件夹。

于 2017-09-07T15:53:36.557 回答
0

以下是示例介绍:

https://developer.amazon.com/blogs/post/Tx1DSINBM8LUNHY/new-alexa-skills-kit-ask-feature-audio-streaming-in-alexa-skills

并且有明确的信息:

在响应 LaunchRequest 或 IntentRequest 时,您的响应可以包括 AudioPlayer 指令和标准响应属性,例如 outputSpeech、card 和 reprompt。例如,如果您在与 Play 指令相同的响应中提供 outputSpeech,则 Alexa 在开始流式传输音频之前会说出提供的文本。

文档 - https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference

更多关于开始游戏

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/custom-audioplayer-interface-reference#play

于 2017-02-13T10:12:51.843 回答