question

MaciekR avatar image
MaciekR asked

Make Alexa speak between each next stream in AudioPlayer

I'm trying to build audioplayer based on the example skill shared here
https://github.com/alexa/skill-sample-python-audio-player

My specific issue is that, I would like Alexa to speak something between each played mp3 in a queue.
It is possible to make Alexa speak before PlayDirective, but I struggle to make her speak between each next mp3.

The goal is to have scenario like this:
- Alexa speak -> stream nr 1 -> Alexa speak sth -> stream nr 2 etc.

I tried to add the speak section to
AudioPlayer.PlaybackStarted,
AudioPlayer.PlaybackFinished,
AudioPlayer.PlaybackNearlyFinished,
but I always received error that is not allowed.

If there any work around? Any help would be appreciated.

alexa skills kitalexa voice servicealexaalexa simulatoralexa skills challenge
10 |5000

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

1 Answer

Randy Thompson avatar image
Randy Thompson answered

Alexa's streaming audio API does not support TTS (Alexa speaking) between tracks at this time. It only supports it before the first audio file in an audio stream. You can read more about this limitation in the Note found at the bottom of the AudioPlayer Interface Reference's AudioPlayer requests section:

Note: When responding to AudioPlayer requests, you can only respond with AudioPlayer directives. The response cannot include any of the standard properties such as outputSpeech. In addition, some requests limit the directives you can use, such as not allowing Play. Sending a response with unsupported properties causes an error...


As a hacky workaround, you could insert pre-recorded MP3 files of Alexa speaking between each track. Obviously a very unwieldy solution, though.

10 |5000

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