Skip to Content

How can I loop music with code in Scratch?

Think About

  • Why is it useful to repeat musical patterns?
  • How can you repeat musical patterns with code? 

Loop Music With Scratch

  1. In the following Scratch project example, there are three different sprites.
  2. Each sprite will create random music when you click on them.
    1. BUT,  the microphone sprite uses a repeat to make a random beatbox.
  3. Try adding in different “Control” blocks (yellow blocks) and “Sounds” blocks (purple blocks) to create something different.

Click here for the Scratch Project Example.

This is what control blocks look like:


This is what sound blocks look like:


Wait, what do the blocks do?

If you’re not sure what a block does, click on the question mark on the top of the screen and then click on a block for an explanation of what the block does.

Try meeting these challenges:

  • Can you use loops to make a song that never ends?
  • Can you make a repeating song that doesn’t get boring?
  • Can you use loops to make a beat with drums, melody, and harmony?
  • Can you make a bunch of loops that sound almost the same but have little differences?

If you are using the LRNG platform, go back, find out what to submit, and complete the XP.

If you are not using the LRNG platform, return to: How can I loop music with code?