Search code examples
alexa-skills-kitssml

Audio file not longer than 240 seconds in Alexa


I am an Alexa skill newbie and would appreciate help from the community. I am trying to figure why I keep getting "Error retrieving text to speech: The audio file cannot be longer than 240 seconds" but the audio file in question is less than 240 seconds - it is actually 119 secs.

This is the code I am testing in the Alexa simulator :

<speak>
Alexa will now play this track.
  <audio src='https://ucbprelivefiles.s3-eu-west-1.amazonaws.com/s3fs-public/uk_21042020.mp3'/>
</speak>

Solution

  • It seems the audio file is not compatible with the Alexa, it has nothing to do with your audio length. I did the following things and it worked fine for me.

    Steps to fix the issue:

    • Download Audacity
    • Open the file to convert.
    • Set the Project Rate in the lower-left corner to 16000.
    • Click File > Export Audio and change the Save as the type to MP3 Files.
    • Click Options, set the Quality to 48 kbps and the Bit Rate Mode to Constant.

    And again save the file to AWS S3 and see it'll work just fine.

    Please refer to think link for more info.