How I made an ear trainer

Editor’s Note: This is a guest post created by Suri via the Contribute a Post feature on this website. It has been minimally edited by Devin Ulibarri.

What is an Ear Trainer?

A few weeks ago, I created an ear training program as part of my remote Music Blocks lessons with Devin Ulibarri at MAP Family Learning Center. An ear trainer is a simple game that plays pitches and tests a user’s ability to identify the played pitches. This article explains how I created the ear training program.

Details for How I Made an Ear Trainer

The code contains two Start Blocks. The mouse chooses the random pitches and the question mark is a button to reveal the answer if you don’t know what note is being played.

The blocks at the top of the mouse’s Start Block sets the value of box2 and the mouse’s position. The Forever Loop in the mouse plays the pitch and does the level system. The first If-then-else block checks if the input of the user is correct. If the input is incorrect, it’ll replay the note again. If the input is correct one point will be added to box2, which stores how many points the user has. After one point is added to box2, the If-then-else block inside will check if the user has enough points to go to the next level and it’ll display the amount of points the user has and how many more they need to level up. If the user has enough points to level up the level will change, and a larger variety of notes will be played. 

The question mark’s Start Block (i.e. Start Block with question mark avatar) checks to see if the user has clicked it. Upon clicking the question mark, the Action Block named “Reveal” will print the name of the note that was played. 

The “level” Action Blocks choose the random note that will be played by setting the value of box1 to a random pitch within a certain range of pitches. The “play” Action Block plays do and then plays the random pitch and the reveal action block prints the name of the note. 

Try the Ear Trainer for Yourself

Project Link: https://musicblocks.sugarlabs.org/index.html?id=1629147515542280&run=True

Conclusion

There you have it! That is how I created a fun and handy ear trainer using Music Blocks!

I encourage you try my project, remix my project, or create a whole new ear trainer using the description provided.