Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alexa SSML not playing

I am trying to get into ASK and I just tried a dummy example with SSML. I am using Amazon Lambda and Python. If I test my code from the Lambda console I get the expected output:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "text": "<speak><audio src='https://s3.amazonaws.com/aws-website-resources-1183x/dice-die-roll.mp3' />Three</speak>",
      "type": "SSML"
    },
    "shouldEndSession": true,
    "card": {
      "content": "Three.",
      "type": "Simple",
      "title": "Dice"
    }
  }
}

When I go to the Alexa service simulator and try any request, the text in output speech is gone, the "Listen" button in the console is disabled and if I try it on the Echo, it doesn't play anything:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "type": "SSML"
    },
    "card": {
      "content": "Three.",
      "title": "Dice",
      "type": "Simple"
    },
    "shouldEndSession": true
  }
}

If I copy/paste the SSML <speak><audio src='https://s3.amazonaws.com/aws-website-resources-1183x/dice-die-roll.mp3' />Three</speak> into the voice simulator I can play it and it is played as expected. I've converted the mp3 file using ffmpeg: ffmpeg -y -i a.mp3 -ar 16000 -ab 48k -codec:a libmp3lame -ac 1 output.mp3 and I understand that Amazon's S3 should be trusted, what may be the problem? I've tried using single and double quotes in the SSML and I tried escaping the quotes to no avail. Anyone knows what I should look into?

like image 246
Josep Valls Avatar asked Jan 05 '23 11:01

Josep Valls


1 Answers

Dumb mistake. The output should be in ssml instead of text.

"outputSpeech": {
      "ssml": "<speak><audio src='https://s3.amazonaws.com/aws-website-resources-1183x/dice-die-roll.mp3' />Three</speak>",
      "type": "SSML"
    },
like image 163
Josep Valls Avatar answered Jan 13 '23 11:01

Josep Valls