Workshop on Teaching Machines

Lecturer: Dr. Chung CHAN

What will you learn?

  1. Teach a machine to listen to music.
  2. Understand how a machine can learn from examples.
  3. Identify potentials and limitations of machine learning.
  4. Have fun!

Course intended learning objectives (CILOs):

What to teach?

A machine taught to classify musical notes!

  1. Allow the use of microphone.
  2. Sing Doe, Ray, or Me.
  3. See if the output is right.
  4. Tune the overlap factor.

To ensure the machine did not cheat, she cannot hear herself. To test her, you have to sing the notes yourself or play the samples from a different device.

How to teach?

Open an Audio Project

  1. Visit teachable machine website:
  2. Choose Audio Project.

The steps of teaching

  1. Data collection.
  2. Training.
  3. Testing and deployment.

How collect data?

Collect samples of noise

  1. In Background Noise, Click Mic.
  2. Click Record 20 Seconds.
  3. Click Extract Sample.

Collect samples of doe

  1. In Class 2, Click Mic.
  2. Click the setting icon .
  3. Set Duration to 20 secs and click Save settings.
  4. Click Record 20 Seconds and repeatedly sing doe.
  5. Click Extract Sample and rename Class 2 to Doe.

Collect samples of ray

  1. Click Add a class.
  2. In Class 3, Click Mic.
  3. Repeat the previous procedure to collect samples of ray and rename the class to Ray.
  4. You may repeatedly add more classes of musical notes later.

Save your data

  1. Click the menu icon.
  2. Choose Save project to Drive.
  3. Choose Download project as file to save the project to your computer.

How to train the machine?

Train a model

  1. In Training, Click Advanced.
  2. Change Epochs from 50 to 1 and click Train Model.
  3. Test your model in Preview.

Improve your model

  1. Change Epochs to 5 or more.
  2. Wait for training to complete.

How to deploy your machine?

Export your model

  1. Click Export Model.
  2. Click Upload my model.
  3. Copy the sharable link.
  4. Paste the link to a new tab.
  5. You can continue to improve your model and export it again.

How stuff works?


Click the play button to train the neural net.
Observe what happens to the output?
(Use the control on the lower right to continue.)

Choose different datasets and play again.
Can the neural network learn different boundaries?
(scroll down to learn more about neural network. Use the control on the lower right to continue.)

Mapping to the machine you trained:

  • Data points: Audio samples

  • Colors/Classes: Background noise or musical notes

  • Neural Network: Model trained to classify musical notes