Introduction

In this project you’ll learn how to code your own musical instruments!

screenshot
screenshot

Step 1: Sprites

Before you can start coding, you’ll need to add in a ‘thing’ to code. In Scratch, these ‘things’ are called sprites.

Activity Checklist

  • First, open up the Scratch editor. It looks like this:

    screenshot
    screenshot
  • The cat sprite that you can see is the Scratch mascot. Let’s get rid of it, by right-clicking and then clicking ‘delete’.

    screenshot
    screenshot
  • Next, click ‘Choose new sprite from file’ to open up a list of all the Scratch sprites.

    screenshot
    screenshot
  • Select the Costumes folder on the left then open the Things folder.

    screenshot
    screenshot
  • Scroll down until you see a drum sprite. Click on a drum, and click ‘OK’ to add it to your project.

    screenshot
    screenshot
  • Right-click the drum and click ‘resize’ then drag the resize tool to make the sprite smaller.

    screenshot
    screenshot

Save your project

Click ‘File’ and then ’Save As…" to save your project.

screenshot
screenshot

Give your program a name, by typing one into the ‘New Filename’ text box.

You can then click ‘OK’ to save your project in the default ‘My Projects’ folder.

screenshot
screenshot

Step 2: The Stage

The stage is the area on the right, and is where your project comes to life. Think of it as a performance area, just like a real stage!

Activity Checklist

  • At the moment, the stage is white, and looks pretty boring! Let’s add a backdrop to the stage, by clicking on ‘Stage’ then ‘Edit’ from the ‘Backgrounds’ tab.

    screenshot
    screenshot
  • Click the ‘Import’ button from the backdrop Paint Editor.

    screenshot
    screenshot
  • Open the ‘Indoors’ folder, and then click on the stage backdrop and click ‘OK’.

    screenshot
    screenshot
  • Your stage should now look like this:

    screenshot
    screenshot

Step 3: Making a Drum

Let’s code your drum to make a sound when it’s hit.

Activity Checklist

  • You can find the code blocks in the column on the left of the page, and they are all colour-coded!

    Click on the drum sprite, and then drag these 2 blocks into the code area to the right, making sure that they are connected together (like Lego blocks):

    screenshot
    screenshot
  • Click the drum to try out your new instrument!

Save your project

Challenge: Improving your drum

  • Can you change the sound that the drum makes when it’s clicked?
screenshot
screenshot
  • Can you also get the drum to make a sound when the spacebar is pressed? You’ll need to use this event block:
    when [space v] key pressed

You can copy your existing code by right-clicking on it and clicking ‘duplicate’.

screenshot
screenshot

Save your project

Step 4: Making a Singer

Let’s add a singer to your band!

Activity Checklist

  • Add another 2 sprites to your stage; a singer and a microphone.

    screenshot
    screenshot
  • Before you can make your singer sing, you need to add a sound to your sprite. Make sure that you have selected your singer, then click the ‘Sounds’ tab, and click ‘Import’:

    screenshot
    screenshot
  • If you open the ‘Vocals’ folder, you will then be able to choose a suitable sound to add to your sprite.

    screenshot
    screenshot
  • Now that the sound has been added, you can add this code to your singer:

        when Singer clicked
        play sound [Singer] until done
  • Click on your singer, to make sure that she sings when clicked.

Save your project

Step 5: Costumes

Let’s make your drum look like it’s being hit!

Activity Checklist

  • You can also change how the drum looks when it’s clicked, by creating a new costume. Click the ‘Costumes’ tab, and you’ll see the drum image.

    screenshot
    screenshot
  • Click the ‘Copy’ button to create a copy of the costume then click ‘Edit’.

    screenshot
    screenshot
  • Select the line tool and draw lines to make it look like the drum is making a sound.

    screenshot
    screenshot
  • The names of the costumes aren’t very helpful at the moment. Rename the 2 costumes to ‘not hit’ and ‘hit’ by typing the new name of each costume into the text box.

    screenshot
    screenshot
  • Now that you have 2 different costumes for your drum, you can choose which costume is displayed! Add these 2 blocks to your drum:

    screenshot
    screenshot

    The code block for changing the costume is in the Looks section.

  • Test your drum. When clicked, your drum should now look like it’s been hit!

Challenge: Changing your singer’s costume

Can you make your singer look like she is singing when clicked? If you need help, you can use the instructions for creating a drum above.

screenshot
screenshot

Remember to test that your new code works!

Save your project

Challenge: Make your own band

Use what you’ve learnt in this project to make your own band! You can create any instruments you like, but look at the available sounds and instruments to get some ideas.

screenshot
screenshot

Your instruments don’t have to be sensible though. For example, you could make a piano made out of muffins!

screenshot
screenshot

As well as using existing sprites, you can also draw your own.

screenshot
screenshot

If you have a microphone you can even record your own sounds!

screenshot
screenshot

Save your project