Lesson 1, Topic 1
In Progress

Speech Recognition

Let’s complete the script

  1. Add a when flag clicked block into the scripting area. 
  2. Snap a recognize speech for () s in () block below the when flag clicked block. Change the time to 4 seconds.
    Alexa 1
  3. Now, snap an if () else block below the recognize speech for () seconds block. 
  4. In the condition of the if () else block, add a () contains ()? block from the Operators palette. In the first argument, add a speech recognition result block and in the second write “mario“. So, if the decoded text contains the word Mario, it will execute the if branch blocks.
  5. Add a speak () block from Text to Speech palette under the if arm and write the message “Playing Mario Song!“.
  6. Next, a snap play sound () until done block below the speak () block and select Mario. This is how the script look:
    Alexa 2
  7. Duplicate the if () else block and snap it under the else arm.
  8. Change “mario” to “spiderman” in the condition of the if arm.
  9. Change the message in the speak block to “Playing Spiderman Song!“.
  10. Change the sound to Spiderman.
    Alexa 3
  11.  Finally, in under else arm, add a speak () block and write “Sorry, I am unable to understand the command“.

The script is complete. It will look like this:Alexa 4Click the green flag to start the script. 

 

Assignment

Before you move on to the next lesson, a small assignment awaits you!

You must upload the PictoBlox program you wrote in this activity to the website. 

Submitting the assignment is a must in order to receive the certificate after completing the course.

Follow the steps below to upload your assignment:

  1. Click Choose File.
  2. Select the image from the pop-up window that opens up.
  3. Once the image is selected, click Upload Assignment.

evive Alert The file type allowed is SB3 file generated from the PictoBlox program. The maximum file size allowed is 15 MB.

Good luck!

Get in Touch!