On day 9 of our 30-day skill challenge, we'll be making a hand wash timer that you can groove to. We'll also be learning about Skill Design and how to make Chatterbox Stop Audio and Wait.
I think it is safe to say that we all have been washing our hands more than ever before in the history of humankind. The CDC (Center for Disease Control) recommends that you scrub your hands for 20 seconds or "Hum the "Happy Birthday" song from beginning to end twice."
I don't know about you, but I'm so tired of singing Happy Birthday that I don't even want to hear it on my birthday?!
That's why today we're going to make a hand wash timer that we can groove to...
So far we've built a bunch of skills, but we haven't discuss the process of designing a skill.
There are 3 main parts to every skill:
For our hand wash timer, it should follow something similar to:
For the most part this is right. But if we think about it deeper, step #2 could involve multiple steps. Let's try this out in 3 steps.
Just like we've done in previous skills, we are going to start with a Listen block. So far, we've used two different Listen blocks.
The When I hear block is listening for specific keywords or keyphrases to match, while the On phrases like block requires similar examples in order to "train" itself to understand the variances between.
For this skill we'll simply use: "Start hand wash timer"
When we say "Play a song for 20 seconds" are we doing one thing or are we doing multiple things? Turns out that language is a little bit tricky sometimes. Humans are able to understand multiple things all at once while computers need to be told all the steps. But if we look closer we'll see that there are extra steps.
"Play a song for 20 seconds" really means:
Step 1: Luckily, we already know that the Play audio block is how we can easily play audio sounds. For this example we'll be using this song:
For this example:https://www.youtube.com/watch?v=_NNYI8VbFyY
Step 2: To make Chatterbox wait, you use the Wait block which you can find in the Actions category. This block will wait for an amount of seconds.
Step 3: We've learned how to start audio by playing it, but to Stop audio we need a different audio block. Use the audio block with a selector. Set the selector to STOP.
After 20 seconds of music, we want Chatterbox to speak. For this we use the Speak block and enter what you want the message to be.
Deploy the skill and try it out! If you didn't listen to the song yet, you're in for a nice surprise. 😀