Robert
Robert

Reputation: 139

Use <audio> tag in Alexa SSML without spoken text

I’d like to use Alexa SSML to only play a notification sound via the tag. However that does seem to work only in conjunction with text.

In case it is relevant, I am sending the SSML to Alexa via the openHAB home automation software and its Amazon Echo Control binding. The devices I am sending it to are Sonos devices.

Tried to only use the audio text without spoken text, but then Alexa stays silent: <speak><audio src="soundbank://soundlibrary/home/amzn_sfx_doorbell_chime_01"/></speak>

If I add spoken text in front, it works: <speak>Now comes the sound: <audio src="soundbank://soundlibrary/home/amzn_sfx_doorbell_chime_01"/></speak>

How can I get it to work without the spoken text?

Upvotes: 2

Views: 192

Answers (1)

Diego
Diego

Reputation: 216

Try to use the following tag within a text-to-speech response that your skill sends to Alexa:

const speakOutput = '<audio src="soundbank://soundlibrary/home/amzn_sfx_doorbell_chime_01"/>'

and then you can add:

        return handlerInput.responseBuilder
        .speak(speakOutput)
        .reprompt(speakOutput)
        .getResponse()

Upvotes: 4

Related Questions