top of page

Coding and Music: Music Boxes

Students will learn how music boxes work, and will "code" a simple tune by punching holes in a paper strip that they will then play on a music box. Before this, they will write a tune in Song Maker from a worksheet. Then, they will transpose the song to a paper strip and punch holes for each note. It should take about two 45-minute class periods to do the activity. See resources for information on purchasing music boxes.

Cover image for blog post

There were music boxes long before there were vinyl records, 8-track tapes, CDs, or Apple Music. The inner workings of all music boxes are very similar. They have a row of teeth, similar to a comb, of different lengths. Longer teeth make deeper tones, whereas shorter ones make higher ones. Notes are played by knobs on a rotating drum plucking the teeth. How far apart the knobs are placed determines the length of the note. When there are faster notes, like eighth notes, the spaces between them are closer together. When there are slower notes, like whole notes, the spaces between them are further apart. Every time the cylinder goes all the way around, the tune plays again.

Why this activity?

Technological developments often drive change in how we live. For a long time, punch cards were an important way to store information. In the 1800s, the Jacquard loom changed the way textiles were made. Before it was invented, the best weavers could only make a few inches of cloth a day. However, by putting instructions on chained punch cards, weavers were able to make yards of cloth a day, even if the patterns were complicated. Similar technology was used to program player pianos, which used long rolls of perforated paper instead of chained punch cards. Player pianos were common in many homes until they were replaced by vinyl records and radio. Until the 1970s, punch cards were the most common way to input information into a computer. For milestone achievements, like landing on the moon, computers had to be fed huge stacks of cards.

Until the 1970s, punch cards were the most common way to input information into a computer.


Some of your students might have a music box at home or have seen one, so ask them what they know about them. Show any music boxes you might have and the music box movies from the slideshow presentation. Demonstrate how to use the music box they are going to program, including how to put the paper strips in the right way. Let the kids run the music box themselves to help them understand how it works.

Image of music box

Explain that the pitch of the note is determined by the position of the holes on the paper strip. The pitch is higher if the hole is higher on the paper strip, the same way that sheet music works. The length of a note is shown differently when paper strips are used instead of sheet music. In sheet music, the duration is indicated by the type of note (half note, quarter note, so on). How far apart the holes are punched on the paper strips determines how long the note is. Notes that are farther apart last longer than those that are close together.

Before punching holes in the paper strips, we had the students code the song on Song Maker. Using Song Maker to code a song is exactly the same as using paper strips. In fact, Song Maker's default range is two octaves in the key of C, just like the paper strip. Students can pick from three different song sheets based on how good they are at music. The easiest song sheet only needs students to copy the notes exactly into Song Maker. The second easiest song sheet gives the notes and the beat for each note. The third song sheet requires students to be able to read sheet music. When students have finished coding their song in Song Maker, have them play it for you or another student to make sure it sounds right.

After using Song Maker to code a song, students can transpose the song onto a paper strip. They should first mark the notes with a pencil, placing the notes from Song Maker on the punch sheet's cross hairs. The markings on the paper strip should correspond to the notes on Song Maker. Check each student's marks or have another student look at them before they start punching holes. It is critical that they punch holes on the marks squarely. Finally, they should play their song on the music box.

Example of music strip for music boxes

Once the students play their song on the music box, they can play it on different surfaces to hear how it sounds. A tambourine, a drum, glass, wood, and metal are all surfaces that could be used. Students should pay attention to how the same notes sound different on different surfaces. This could be a good way to start talking about different kinds of instruments. How, for instance, is the sound of a music box on metal or wood like the sound of a woodwind or brass instrument?


Amazon has several hand crank music boxes, including one by Ejoyous and FVTvogue. Each one costs about $20. I would suggest buying enough music boxes for about a quarter of your largest class and buying extra paper strips. You can buy the paper strips as a roll or as individual sheets.


Recent Posts

See All
bottom of page