question

octaviom avatar image
octaviom asked

Error playing audio file from S3 in Alexa Skill

Hello everybody. I came across this problem this week. I have hosted an audio file in S3 and I want Alexa to play it. This is my response. It looks like everything is ok. { "version": "1.0", "response": { "outputSpeech": { "type": "SSML", "ssml": " " }, "card": null, "reprompt": null, "shouldEndSession": true }, "sessionAttributes": {} } But at the moment I want to listen to the response in the test section of the developer portal I get this message: Error: There was a problem when trying to retrieve the audio from https://s3.amazonaws.com/wakeupcall/audio/audio-02-24-2016.mp3 I know there are some rules to play an audio file and I'm ok with that: - MPEG version 2 - No longer than 90 seconds - 48kbps bit rate - 16000 sample rate I'm just trying to play a single audio file which lasts barely 20 seconds. The strange thing here is that when I cut this file to 14 seconds it plays well, after 14 seconds it shows me that error. Here is a table that I've built with the duration and file size related. I'm not sure if this has something to do with it. DURATION(sec) FILE SIZE (KB) 14 85 15 91 16 97 17 103 18 109 19 115 20 123 And this is the command the I use for converting the file in the console using ffmpeg: ffmpeg -i input.m4a -ab 48k -c mp3 -ac 2 -ar 16000 -af volume=2 audio-02-24-2016.mp3 If you are so kind, you could download the file from here: https://s3.amazonaws.com/wakeupcall/audio/audio-02-24-2016.mp3 And try to play it. Maybe I'm not using the right command instructions. Thanks in advance!
alexa skills kitsubmission testing certification
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
1) When I try the given SSML in the emulator it fails. [code] [/code] 2) When I try the link in the given SSML in my browser, it fails. [code] https://s3.amazonaws.com/mybucket/audio/audio-02-24-2016.mp3[/code] 3) When I try the link on your page, it works. [code] https://s3.amazonaws.com/wakeupcall/audio/audio-02-24-2016.mp3[/code] 4) When I put the link on your page into the SSML, it fails. [code] [/code] Since (2) fails with an "access denied" message, I am assuming (1) fails because you haven't made that path/file public. Since (3) works, but (4) fails, I assume that file is public, but in the wrong format.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

octaviom avatar image
octaviom answered
1) It was just an example, that URL is invalid for sure. Just wanted to explain my point. 2) The same than 1) 3) This is the correct file 4) That's my point: The file is encoded according to the requirements: - MPEG v2 - No longer than 90 seconds (20 seconds of duration) - 48kbps bit rate - 16000 sample rate My questions: How did you try my SSML in your browser ? Could you recommend me a software to encode my file? or if you have worked with ffmpeg in the console, am I using the right combination of commands for converting the file? Thank you
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
>How did you try my SSML in your browser ? On the Alexa dev console, when you edit a skill, on the Test tab there is a a section where you can enter in either spoken text or SSML and it will parse/read it as Alexa would. >Could you recommend me a software to encode my file? >or if you have worked with ffmpeg in the console, I have used ffmpeg, and got it to work. But I tend to only use that for bulk work. (Like the ticks for Acoustic Metronome.) More often I use Audacity. In both cases, Amazon have documented the settings to use. Look in the Knowledge Base forum, and search for "audio". There's a message there with the exact settings to use. It's still easier to trip up in ffmpeg than Audacity. But I've had both work. Not relevant for your immediate problem (judging by the sample recording), but as a community service TsaTsaTzu did the conversion on a library of sound effect files we happened to have and have made the results available for use: https://s3.amazonaws.com/tsatsatzu-alexa/index.htm These are all Alexa-ready sounds you can use to add color to your skills. Now, if you want to get super-advanced, enable and invoke Starlanes. Just today I added a theme music intro that fades out as Alexa's narration comes in. It only plays the first time you invoke (or after being idle for 6 hours). So listen closely. It was tricky, but I'm pretty pleased with the result. (1000 in-game talents to anyone who works out how I did it!)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered
Hi octaviom, Did you ever have any luck with this? Please let us know! Thanks for all the help in troubleshooting, jjaquinta! Thanks, Justin
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

octaviom avatar image
octaviom answered
Hello Justin! Thank you for getting in touch and thanks to @jjaquinta for his/her feedback. I haven't been able to success in this yet. I've tried dozens of combinations for converting my .m4a audio file not only with a command that I found in another thread in the forum but also trying to change other parameters: ffmpeg -i input.m4a -ab 48k -c mp3 -ac 2 -ar 16000 -af volume=2 audio-02-17-2016.mp3 ffmpeg -y -i input.m4a -ar 24000 -ab 48k -codec:a libmp3lame -ac 1 audio-02-17-2016.mp3 ffmpeg -i input.m4a -acodec mp3 -ac 2 -ab 48k -ar 16000 -async 1 -y -f vob audio-02-17-2016.mp3 ffmpeg -i input.m4a -codec:a libmp3lame -qscale:a 2 -ab 48k -ar 16000 output.mp3 These are examples of commands that I've used to convert my file from m4a to mp3 using ffmpeg (also tried Audacity), store it in S3 and trying to play it in the test console. I always get the error message. But only if the duration of the file is greater than 14 seconds. If my file's duration is equal or lower than 14 seconds it works fine. I don't know if the duration of the file size is related with this. At the beginning I assumed that my only limitation (regarding to the duration) was 90 seconds for a file, and I even told my customer that it was ok until 90 seconds. But I couldn't even have an audio of 20 seconds working ok. Please let me know if any of you have converted successfully an audio file greater than 20 or 60 seconds and get it to work. Here's the link to the .m4a file in my GoogleDrive https://drive.google.com/open?id=0B7Ov3ODFrhu0Zk84ZFZ3MjI5OG8 I don't think it has something to do with the file, because I faced the same problem with other formats (mp3 itself) Thank you again !!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
I was unable to get your file to play in the emulator, as well. Here is my converted version and the failing SSML: [code] [/code] The error given on the dev console is: [code]Error: There was a problem when trying to retrieve the audio from hxxps://s3.amazonaws.com/tsatsatzu-alexa/sound/misc/octaviom.mp3[/code] However, I have a test playback skill. When I invoke the same file through that skill, it works fine. You can see the same behavior in my published skill, Acoustic Metronome. If you invoke it, and ask it to play 60 beats, it plays a 90 second file of 60 beats per minute. However, when I invoke the same SSML in the dev console: [code] [/code] it does not work. That seems pretty rock-solid proof there is a bug in the dev console's playback. Over to you, Amazon... :-)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

coeusmobile avatar image
coeusmobile answered
Hello @jjaquinta!! You were so cool by converting the audio and trying in your skill. I really appreciate that :) The console for me was an important start point to try my skills and I hadn't work with audios longer than 10 seconds. That's why I trusted in the console. I hadn't tried in my echo yet until today, right now. And I used these commands for converting my file again: ffmpeg -i input.m4a -ab 48k -c mp3 -ac 2 -ar 16000 -af volume=2 audio-02-26-2016.mp3 ffmpeg -y -i input.m4a -ar 16000 -ab 48k -codec:a libmp3lame -ac 1 audio-02-26-2016.mp3 * As well as the Audacity software. The 3 files from these 3 sources wasn't played in the console (as expected) but when I tried them in my echo they 3 worked fine!! So, my case is resolved :) Thank you so much @jjaquinta, bless you.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

octaviom avatar image
octaviom answered
@jjaquinta. I manage both accounts. My personal one and coeusmobile, sorry for replying with a different one. I didn't notice it. Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gaju12 avatar image
Gaju12 answered

hey there 1) make the url of audio file public setting option 2) https://s3.amazonaws.com/gajenderstore/spear_throw.mp3 download this file and upload in yr amazon s3 and make it public and check in alexa skill kit it will work. 3) there is problem in your audio file make bit rate 48kbps thanks :) gajender singh

1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Yes and to add to this answer, the Hz must be 16000. You can download the tool GoldWave to convert your audio files to the acceptable bitrate and herts. Open the file in GoldWave and then save them choosing 16000 hz and 48kbps. Cheers

0 Likes 0 ·
newuser-b788bab0-d530-4139-8404-e4bf0b3ecde1 avatar image
newuser-b788bab0-d530-4139-8404-e4bf0b3ecde1 answered

Hi all just to say I had this issue but converted my short mp3 to 48kbps bit rate - 16000 sample rate as recommended by @octaviom and everything was spot on. Don't forget to give the file public access in s3.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.