Lesson 1, Topic 1
In Progress
Speech Recognition
Let’s complete the script
- Add a when flag clicked block into the scripting area.
- Snap a recognize speech for () s in () block below the when flag clicked block. Change the time to 4 seconds.
- Now, snap an if () else block below the recognize speech for () seconds block.
- 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.
- Add a speak () block from Text to Speech palette under the if arm and write the message “Playing Mario Song!“.
- Next, a snap play sound () until done block below the speak () block and select Mario. This is how the script look:
- Duplicate the if () else block and snap it under the else arm.
- Change “mario” to “spiderman” in the condition of the if arm.
- Change the message in the speak block to “Playing Spiderman Song!“.
- Change the sound to Spiderman.
- 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:Click 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:
- Click Choose File.
- Select the image from the pop-up window that opens up.
- Once the image is selected, click Upload Assignment.
The file type allowed is SB3 file generated from the PictoBlox program. The maximum file size allowed is 15 MB.
Good luck!