top of page

Creating a Scratch Band: A Fun Music and Coding Activity

When I was a kid, two things filled my free time: music and coding. I was always strumming my guitar, singing, or tinkering with simple programs on my old TI-99 computer. Wanting to bring together my interests in music and coding, I worked with our school’s music teachers to create a Scratch activity where students can explore music and coding together.. We begin with the basics: students composed simple melodies by snapping together code blocks that represent musical notes. From there, they add movements and characters, programming each to play different instruments. This cross-disciplinary project not only teaches music and coding but also encourages creativity, teamwork, and computational thinking.

Students compose simple melodies by snapping together code blocks that represent musical notes.

Scratch is a free coding platform developed by MIT in 2003, offers kids a fun and accessible way to dive into programming and music creation. With its simple drag-and-drop interface, Scratch removes the tricky syntax that can trip up beginners, making it perfect for students. When they use Scratch to compose music, they start to see the connections between coding and music. Both music and coding rely on step-by-step sequencing. A melody is built by arranging notes while a program is shaped by the order of code blocks. This parallel helps students understand core coding concepts while they explore the creative side of music, blending logic and art in a way that's engaging and approachable.


Creating a Scratch Band


To support this exciting blend of music and coding, I created a comprehensive slideshow to guide both teachers and students. It starts with a video introduction to Scratch, perfect for newcomers to the platform. To get students inspired, I included examples of three completed projects, each showcasing different ways to bring music to life through code.


The slideshow also features two in-depth video tutorials: one focused on step-by-step instructions for coding music in Scratch, and the other on adding movements and additional instruments. For students who might need help translating musical notes into code, there’s a Simple Tunes to Code worksheet that provides simple music to code for beginners. More advanced students can translate notes directly from sheet music or even create their own melodies.


To start coding their songs in Scratch, students first add the "Music" extension blocks, which they can find by clicking "Add Extensions" in the bottom left corner of the Scratch interface. Once the Music extension is enabled, they set up the starting point of their song by adding a "when green flag clicked" block, so the melody begins with a click of the green flag.

example of coding a tune in Scratch
Coding a tune in Scratch

Next, they choose an instrument using the "set instrument to" block, with options like piano, electric guitar, and more. To build the melody, students string together "play note" blocks, each representing a note in their song. When they select the "play note () for () beats" block, a piano keyboard pops up, letting them scroll through notes (middle C, for example, is labeled as note 60). This block also lets them control the length of each note—setting beats to "1" plays a note for one full beat, while "0.5" plays for half a beat, and so on. By combining different notes and durations, students create unique rhythms and melodies, bringing their coded compositions to life.


With the melody in place, students can add animations to their characters, known as sprites, making them “perform” the song. By synchronizing movements to each beat, students create an illusion of musical performance. For example, a sprite can move, change size, or switch colors in time with the music. Avoiding commands like “glide” that take longer to execute keeps everything in sync. With each note, the sprite can seem to “dance,” adding a visual layer to their musical piece.


Example of duplicating a sprite
Duplicating a sprite

To create a full band, students can duplicate their sprite, giving each copy a new instrument, costume, and unique movements. Right-clicking on a sprite and selecting “duplicate” makes this easy. With each sprite assigned to a different instrument, students can experiment with layering sounds and rhythms, transforming their project into a lively ensemble. Adding in more sprites and selecting an interesting background completes their animated, musical performance.


When it’s time to save or share their project, Scratch keeps things simple. Students with accounts can share their projects directly from their “MyStuff” page with a link, making it easy to show off their work to family or friends. Alternatively, they can save a copy of their project to their computer or Google Drive. By creating and sharing these Scratch projects, students not only learn to code and compose but also discover how to collaborate, document their work, and communicate their creativity to others. This activity not only brings music and coding together but also empowers students to explore new ways of expressing themselves—showing that learning can be both structured and wildly creative.

612 views

Recent Posts

See All
bottom of page