question

Elliot avatar image
Elliot asked

Exercise Timer Alexa Skill

I'm building an exercise skill for Alexa in Python 2.7. I want Alexa to start a 10 second timer and say "Exercise". Once the 10 seconds is over Alexa should say "Stop".

I have tried doing this using the break SSML tag:

<speak>Exercise! <break time="10s"/> Stop </speak>

However this starts a timer/pause after "Exercise" has been said, I require the "Exercise" dictation to be inclusive of the 10 second timer.

Is there a function which would return the length of time Alexa takes to say a specific phrase? e.g. If "Exercise" = 1s then I could add an SSML break for 9s to simulate a 10s timer.

Any other ideas how I could implement this?

alexa skills kitssml
10 |5000

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

Noah avatar image
Noah answered

Not sure I understand, you just want it to go for exactly 10 seconds yes? I don't think you can get a specific time, but it's only half a second, so just make the break 9.5s and it'll be within a few milliseconds. Also worth noting Alexa times out after 10 seconds, so this sort of skill isn't really viable, Alexa requires some form of user interaction every 10 seconds, so they'd need to verbally respond at the end of the exercise. With 10 seconds of exercise, that leaves 0 seconds of time for them to respond, and even 8-9 seconds is still going to result in your app timing out a lot.

10 |5000

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

Elliot avatar image
Elliot answered

Yeah your understanding is correct. I iterate around multiple sets of Exercising for 10 seconds then resting for 10 seconds. I could estimate a break of 9.5s but I don't like that solution as the error would get larger depending on the number of sets asked by the user.

I wasn't aware of this limitation. I have tested other skills on echosim.io and Alexa speaks a response for more than 10 seconds. I'm sure there are story skills where Alexa speaks for longer than this time period. Is this just a limitation of echo dot?

10 |5000

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

Noah avatar image
Noah answered

Here are some official responses on the matter recently:

https://forums.developer.amazon.com/questions/73766/is-it-possible-to-make-alexa-wait-longer-for-respo.html

https://forums.developer.amazon.com/questions/59853/alexa-not-waiting-for-response.html

A question very similar to yours was asked here a little while back regarding pausing to let the user exercise: https://forums.developer.amazon.com/questions/49206/how-to-make-alexa-wait.html

Seems like it's not currently an option right now unless you want to fail certification. You could maybe constantly reset to a new state and force users to count their push-ups or something in order to maintain interaction? I'm not sure that would be allowed 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.

Elliot avatar image
Elliot answered

Thanks Noah.

Understood. I'll attempt to modify my skill by adding an audio file to play music during the pause period. I will add restrictions to ensure the total combined time of the audio file doesn't exceed the max 90 seconds.

I'll give that a try and see how testing goes :)

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.

Hi I am currently working on something similar and I'm wondering if you could share what your fix was that would be sooo amazing :):)

0 Likes 0 ·