• backtoschool
  • ell
  • finearts
  • languagearts
  • library
  • math
  • science
  • sel
  • socialstudies

Code Music

Search:

Grades: 3-12

Create Music with Coding

Begin the lesson by demonstrating the music coding feature. Share an example project where clicking keys on a keyboard object plays a simple tune, such as Mary Had a Little Lamb.

Allow times for students to play with the Make Music activities. Students click on the keyboard keys in the projects to hear the tones and experience how music can be coded. Then, explain to your students that they will create their own coded music.

Assign a blank canvas and instruct students to add a Sticker (e.g., a keyboard, instrument, etc.) from the Image library.

Have students select the image, go to the Edit menu, and choose Edit Alt Text. Explain that this is where they will code the music.

In the Alt Text dialog, have students add an open bracket "[" followed by "tone:". Then, have students enter tones (notes) and durations separated by commas and close the code with a bracket "]".

Example Code:

  • To play a single tone: [tone: C4, .25] (plays middle C for a quarter beat).
  • To play a sequence: [tone: E4 1, D4 1, C4 1, R 1] (E-D-C-Rest for one beat each).

Note Ranges and Durations:

  • Notes range from C0 (lowest) to B8 (highest).
  • Durations are measured in beats based on a 4/4 timescale:
    • 1 = 1 beat (quarter note)
    • .5 = half a beat (eighth note)
    • 25 = quarter of a beat (sixteenth note)

Create a Song

Provide students with a simple song example, such as the first few measures of Three Blind Mice.

  • [tone: E4 1, D4 1, C4 1, R 1, E4 1, D4 .5, D4 .5, C4 1]

Have students copy the code into the Alt Text Dialog of an object and test it by clicking the Speech icon.

To set an entire object to play tones, select the object, go to Edit > Properties, and check the Whole Object box in the Properties dialog.

Compose Original Music:

Challenge students to create a short song using multiple objects, each playing a different tone or sequence. Encourage students to experiment with combining notes and rests to create unique rhythms.

Students can use the Coding Music Cheat Sheet to compose their original pieces.

Have students present their projects to the class, explaining their process and playing their compositions.

Learn more about coding objects with text-to-speech.