Voice Recognition

"Create "Rock, Paper, Scissors" Game using Teachable Machine from Google to classify images"

Updated on: 2023-05-02

Voice Recognition #1

  1. Please open the Teachable Machine through this link https://teachablemachine.withgoogle.com/. Then open an “Audio Project”.
  2. There are five classes in this exercise including “Background noise, up, down, left, and right”. Add some classes and rename the names respectively.
  3. You could either choose to record the audio on your own or upload audio file.

Here’s the guide to record audio sample on your own for “Background Noise” class.

image1 Repeat the process for other four classes. Hints 1: You can adjust how many seconds to record (click that gear icon). Do not leave too much blank time for every audio sample which would take bad performance to your model. For example, 1 second is enough when recording single word for all other four classes since they are quite short. Hints 2: For “Background noise”, 20 audio samples are enough if your environment is quiet. As for other 4 classes, 15 audio samples are adequate normally. Additionally, you may invite your friends around to records some samples rather than simply record 15 samples with your own voice. image2 Hints 3: If you find there is no microphone panel in your browser (as figure shown below). You may check the microphone authorization of your browser. You may need to turn off your mic used in Zoom meeting currently or leave the Zoom meeting for a while. image3 4. Train the model and do some preview tests for your model. image4 This overlap factor determines how frequently the last second of audio is tested against the model you've made. With an overlap rate of 0, audio will be classified every second. With an overlap of 0.5, audio will be classified every half second.

Voice Recognition #2

  1. Export the model and copy this link to MS Word / Notepad for later use. image5
  2. Click the top left menu bar and click "Download Project as file" to save your project.
  3. Open Scratch for programming through this link https://mitmedialab.github.io/prg-extension-boilerplate/create/

Now, develop a mini program in Scratch to control the sprite using your voice.

  1. Please follow the steps in the following diagram. Then, press the “Green Flag” to execute your program and move the sprite. image6 After execution, you can find that the sprite moves to “x = 50, y = 50”(upper right). image7

Voice Recognition #3

  1. Integrate the voice recognition model that you have trained before. Please follow the steps in the following diagram. image8image9image10
  2. Please follow the design of blocks to be the same as below figure to complete the program. image11
  3. Now you can click the green flag to control this sprite.
  4. Click File and then click “Save to your computer” to save your project. image12
  5. Record a video for a complete demonstration.
We share all the resources here for free.We create practical AI workshops for students to gain hands-on experience and learn AI with fun. They will have more concrete ideas and feel more connected with the AI applications. After collecting the public resources on AI, we plan to create a website to organize these resources and categorize them by AI topics.
Contact

Core E, 6/F, Department of Electronic and Information Engineering, The Hong Kong Polytechnic University, Hung Hom, Kowloon, Hong Kong

pauli.lai@polyu.edu.hk