Scratch coding offers many ways to enhance projects, and one of them is by adding music and sounds! So today you and your child will learn how to create music and add sounds in Scratch. There are many options for adding customized and pre-recorded sounds.

For live expert guidance making fun games and animations with coding, join our award-winning free Scratch classes, designed by professionals from Google, Stanford, and MIT.

Discover How to Create Music in Scratch

To add music and sounds to your Scratch project you have many options. One of the places to start is the “Sounds” panel in the upper left.

Sounds panel in Scratch

Scratch has hundreds of pre-recorded sounds you can add to your project. To do so, click the “add sound” symbol in the bottom left. Then you’ll see all the options available! You can scroll through them or search in categories like “Animals”, “Percussion” or “Wacky”. You can even use the search bar to see if there is a specific sound like a growl, a meow, or bark! Press the purple play button next to a sound to preview it before you select it for your project.

The sounds that you select here will now be available in the dropdown menu in the sound category of your coding blocks. Most sprites only have a sound related to them to start (like the meow for the cat). Some sprites will only have a pop noise. Once you add more sounds, in the sounds tab, your sprite will have many more options to choose from!

How to Upload Music to Scratch

Another option is to upload a sound or music file from your computer. Hover over the “add sound” symbol, and then click the “upload” option at the top of the choices that appear. Now you can select the file from your computer that you want. Another option is to upload a sound or music file from your computer. Hover over the “add sound” symbol, and then click the “upload” option at the top of the choices that appear. Now you can select the file from your computer that you want. Scratch supports MP3 and WAV sound files. Make sure to only use sounds that you have permission to use!

You can edit any sound you upload just like a sound that was already in the Scratch library. Make sure to change the name of your sound to be more descriptive if needed.

Choose a sound in Scratch coding

If you would like to record a sound, you can do that as well! Hover over the “add sound” symbol, but this time select “record”, which is the third option from the top. Make sure to enable microphone access. Then click the button in the pop up screen and start recording.

Once you have the perfect sound recorded, you have many options for customization. You can change the speed and volume, or play around with effects like fade in/out. If you make a mistake, you can always undo it using the back arrow next to the name of your sound. These customization options can be used on sounds from the Scratch library, uploaded sounds, or sounds you record. With these options, the possibilities are endless!

How to speed up sound in Scratch coding

How to Create a Music Loop in Scratch

In your project, you might want to code background music for different projects. To do this, you will want to create a music loop. The first block you’ll need is “when green flag clicked” from the Events section. Next you’ll need a block to execute the loop from the Control section. If you want the sound to loop over the entire project, use the “forever” block. If you only want to loop a certain number of times, then use the “repeat” block and change the number to what you want it to be.

Finally, within your loop, you want to put a “play sound until done” Sound block. This makes sure the entire soundtrack finishes before looping again. Only sounds that are selected from the sound tab will be visible in the dropdown menu. Each sprite will have their own list of sounds. Go back to the sound tab if you want more options or to listen to the different sounds before adding them to your code. Your final loop looks like this.

Create a music loop in Scratch coding

Using the Instruments Extension in Scratch

Back on the “Code” tab, the “Music” extension is another way to add sound. The extension button is in the bottom left corner. Extensions allow you to add new blocks to your code that do different things. The new blocks will be under their own category and will be a mint green color.

Instrumentals extension in Scratch coding
Coding for tempo

Now you have a whole new set of drag and drop blocks to use! You can select percussion instruments ranging from the snare drum to the cowbell. A different block lets you select instruments like piano or clarinet. Other blocks let you set the tempo or the duration of a note. Have fun exploring and trying out the different blocks. For example, the tempo block will change how fast or slow your music will play.

One way to get creative is the play notes block. The first note specifies the pitch of the block. The larger the number, the higher the note. You can also use the interactive piano that pops up to test out the different notes. The second number in this block lets you set how long to play the note.

Use the play notes block in Scratch coding for kids

Tips for Common Bugs Encountered While Trying to Add Sound

1. Ensure your sound files are supported and properly imported

Before adding music, make sure the sound file is in a format that Scratch supports, like MP3 or WAV. If the file doesn't import correctly, try converting it to one of these formats using a free online converter. Make sure to get help from a trusted adult before uploading or downloading files from a website.

2. Check volume levels and synchronization

Use the “set volume to” and “play sound until done” blocks to manage volume and synchronization. Adjust the volume to a suitable level so the music doesn't overpower other sounds in the project. Test out your music often to see how your changes impact the music!

3. Avoid overloading your project with multiple sounds

Manage sound files carefully to prevent your project from becoming too complex or laggy. Only use essential sounds and make sure to stop one sound before starting another if they should not overlap. Place the "Stop All Sounds" block before the "Play Sound" block to ensure only one sound plays at a time.

Check Out Cool Scratch Projects with Music

Need a few ideas for inspiration? Explore some awesome Scratch projects that enhance their impact with music.

  1. Pumpkinoids uses laser sounds to complement the visuals. This project was made in Create & Learn's Scratch Ninja class.
  2. Egga's Time Traveling Adventure uses sounds to add suspense. This project was made in our Accelerated Scratch class.
  3. Macintosh 128K uses computer sounds as a special effect. This project was made in our Scratch Ninja class.

Create Music in Scratch

Now you can take a Scratch project you already have and add your own musical creations to it, or start a fresh project! You can experiment with different Scratch concepts, like having a sound play when you click on a sprite by using a conditional. There are many musically themed sprites available in the sprite library. If you are interested in learning more, our Scratch classes and Scratch camps are a great way to learn how to build stories to accompany musical additions. Up next, find out how to make a jumping game in Scratch.

Written by Sophie Andrews, a Create & Learn instructor. Sophie Andrews is a student at Stanford University studying Math and Computational Sciences. She loves teaching and is a teaching assistant for Stanford's introductory computer science classes. Her work focuses on data science. Last year she built the online National Vote Trackers for The Cook Political Report, and she currently leads the Data Team at The Stanford Daily. She's also interned with the FCC and the National Renewable Energy Lab.