Tuesday, October 18, 2016

The Sound of Music - A Scratch Project

Hope the new school year has been going well for everyone. Sharing here a Scratch project that we worked on in the classroom before the summer vacations started. An interdisciplinary project, this one combines music with programming, and was intended to be a Father's Day gift from the kids to their dads. It came as a pleasant surprise that Scratch was having a similar theme that month (June 2016) for their Design Studio. 

Here are the sample Scratch projects that I created: one of my fav songs ever, Do-Re-Mi from The Sound of Music and the Carol of the Bells. Note that the sample projects are intended to be just a starting point to familiarize the students with the programming concepts that would be used in the assignment.


Create your own Music Project, using the instructions in the Sound section of Scratch.


Students learn to create their own piece of music using Scratch programming.

Programming Concepts

  • Using Sound instructions in Scratch
  • Concurrent programming


1-1.5 hrs

Programming Assignment

Create your own music using the Sound instructions in Scratch. You can have both harmony & melody by using concurrent programming. If you prefer, you can also have animations alongside your music.

Lesson Plan

Go over the sample code in the The Sound of Music and the Carol of the Bells projects. The majority of the program uses the instructions from the Sound section of Scratch. Listed below are code snippets used in both the programs.

1.   The instruction "Play Note __ for __ beats" is the most widely used instruction for this assignment. Choose the note you want to play from the drop-down menu for this instruction, or type in the note number if you would like to go beyond the two octaves available in the drop-down menu.

2.  The number of beats that you choose in the above instruction (whole, half, quarter, eighth notes, etc.) helps with the tempo of your music. You can set the tempo for the music at the beginning of the piece using "set tempo to __ bpm (beats per minute)". You can also use this instruction to create the effects of ritardando, accelerando, a tempo, etc..

3.  The code snippet here shows how to choose an instrument. Once the instrument is chosen, a function to play a particular piece of music is called. In the sample program The Sound of Music, I have just one function that plays Do-Re-Mi. You could also have multiple pieces of music programmed under different function names, and use "when __ key pressed" under Events to decide which piece of music plays at each key press.

4.  Use the "set volume to __% " instruction to control the dynamics of the music. This lets you play parts of the music in forte, piano, etc..

5.  To create the effect of harmony & melody, use concurrent programming. The Carol of the Bells sample program uses two "When Green Flag Clicked" blocks to achieve this purpose. One of the blocks simulates the harmony and the other block simulates the melody. Both blocks will execute at the same time - concurrently - when the green flag is clicked.

6.  If any animation is needed alongside the music, you can use yet another "When Green Flag Clicked" block to achieve the purpose. The movement of the bell in the Carol of the Bells is an example.

7.  The Sound of Music code also allows you to choose between multiple instruments by clicking on the sprites representing different music instruments. Message passing between sprites is used here to choose the instrument. You can also use "When this Sprite clicked" instruction in Events to choose the instrument, and then play the music instead of message passing.

8.  Use "Rest for __ seconds" instruction to adjust the timing if required. This is especially useful when playing harmony & melody concurrently.

You can even convert your computer's keyboard into a piano by assigning notes to each key. Overall, this was a very creative and fun exercise for the kids.

No comments:

Post a Comment