Learn to read music with Scratch

MIT Scratch is a great visual programming language for kids and people that want to prototype something audio/visual quickly.

You can download version 1.4 of Scratch here: https://scratch.mit.edu/scratch_1.4/ or use version 2 in the browser: https://scratch.mit.edu/

In this blog post we'll get Scratch to teach you to read music. We'll show a random note on the stave and you'll have a few seconds to play it. Scratch then plays the note so that you can see if you got it right.

I (try to) play the guitar, so I've included the open strings on the stave below.

Before you create the script, you need to add a few variables:
  • note
  • note-ypos
  • notenumber
  • prepause
Then click the stage and draw the background stave above (you could just copy that image and import it).

Now change the main sprite (the cat) to a black circle. Add another costume and colour the circle red.

Now add the script to the main sprite...

You can now click the green flag and the program should run, show a note and play it after a few seconds. It'll repeat forever, until you click the stop button.

If the note appears in the wrong place on the stave then edit the background and move the stave up or down until the note appears in the right place.

Here are a few ideas to improve the program:

  • stop the program playing the same note twice
  • only show the ledger lines above or below the stave when the note needs them
  • record which notes the player finds easy in a list and play less of the easy notes and more of the harder ones
  • allow the player to mark notes as easy as the program runs.
Have fun!

P.S. There's now a version of this program written in Racket: