top of page

Code and Compose music with Scratch!

Calling all future rockstars and coding whizzes! Scratch, a free coding platform for kidfs, lets students create their own orchestra... with code! Forget boring lines of text - Scratch uses drag-and-drop blocks to build melodies and even animate a musical band. Learn about how Scratch lets students become musical coders, revealing the surprising connection between making hit songs and creating computer programs. Get ready to code, compose, and conduct your very own digital orchestra!


 
Cover image for blog post

Resources





Simple tunes worksheet

 

Scratch


Created in 2003 by MIT, Scratch is a free, browser-based coding platform designed for children ages 8-16. Available in over 70 languages, it fosters a global community of young learners who have collaboratively created over 100 million projects. Scratch's unique drag-and-drop interface bypasses complex syntax, making coding accessible and engaging. Beyond the activity described here, Scratch empowers users to explore music, games, simulations, and animations, all while fostering a culture of sharing and customization.

Coding and composing music share the core principle of step-by-step sequencing

By using Scratch to compose music, students embark on a journey that unveils a surprising connections between coding and music creation. Both disciplines share a core principle: step-by-step sequencing. In music, the order of notes determines the melody and harmony, while in coding, the arrangement of commands dictates the program's functionality. Just as misplaced notes can produce a jarring or dissonant melody, incorrect code order can lead to a program malfunctioning entirely.


Activity


Let's dive into the music-making fun. First, students will code their songs in Scratch. They'll need the "Music" extension blocks, found under "Add Ons" in the bottom left corner of the online version of Scratch. They drag and click a "play note" block to choose a note from the handy piano keyboard that pops up. Stringing together these blocks builds melodies. The instrument type can be set with a "set instrument" block and  "Flag" block is used to kick things off.


Scratch Sprite

Once the melody is set, it's time to bring the music to life with animation. Students can animate their sprites (characters) in sync with the rhythm. They can either move the sprite or change its costume with each note. If they choose movement, be mindful of the sprite's location at the song's end. Moving 10 steps each beat could lead to an off-screen sprite. To avoid this, students can change the sprite's direction or movement style. Some fun options for animating sprites include enlarging, shrinking, or changing the sprite's color with each beat. Once a student has a moving, musical sprite, it's easy to create more band members! Simply right-click and duplicate a sprite in the sprite zone, including its code. Then, customize the new member with a unique instrument, outfit, and movement style. Add more sprites and a fitting background to complete the musical ensemble.


Example of orchestra project

For students new to Scratch, the provided slideshow offers a helping hand. There's an introductory video and completed projects to spark inspiration. The slideshow also includes two in-depth video tutorials: one on coding music and another on animation and adding instruments. For those who prefer pre-made melodies, the "Simple Tunes to Code" document has songs with accompanying videos in the resources area. For advanced students, the activity offers exciting challenges. They can code music directly from sheet music, create their own melodies, write music programs in Scratch, or even allow users to choose instruments or songs for the band.


Saving and sharing is a breeze. Students with Scratch accounts can share their projects via a link from their "MyStuff" page. Others can save their projects to their computer or Google Drive and send you the Scratch file, which you can view by uploading the file in Scratch.

289 views

Recent Posts

See All

Comments


bottom of page