Scratch Silver III
Scratch Silver II
SCRATCH SILVER I
SCRATCH GOLD III
1 of 3

5.03 Play music

Create a sprite that will interact with your instrument sprite and play sounds.

Your instrument will play notes when another sprite touches the different colours on your instrument sprite. This is similar to how a guitar plays notes when a pick touches the strings, or a piano plays notes when fingers press the keys.

Make or choose a sprite that will follow your mouse-pointer and can be used to play different notes. In the example below, we have used a simple coloured circle.

Now, get your sprite to follow your mouse-pointer, so that the person playing the instrument can control it.

Add code so that your new sprite follows the mouse-pointer.

Use My Blocks to design what your instrument sounds like.

There are many elements of music that you can experiment with. You can change the notes, instrument, beats, rest, and tempo.

Create a My Blocksblock that has inputs for as many of these elements as you want.

When the sprite that is following the mouse-pointer touches a specific colour on your instrument sprite, a sound should be played. Your music maker can use the play note: block to set different instruments, notes, beats, and rests.

Add if...then blocks and the play note: blocks to your instrument sprite. Add as many if...else blocks as you need.

Debug: You might find some bugs in your project that you need to fix. Here are some common bugs.

Did you use the colour picker to select the colour that plays a note, on your touching color blocks?

The 'select colour' interface shown, with the colour picker highlighted.

Add as many different colours as notes wanted. Sometimes when you have very similar shades of colour, it may recognise them as the same colour (and therefore play the same note).

You can change the length of time that a note plays for, and the length of time between notes. In your play note: block, adjust the beats and rest values. Increase them to slow down the music, and decrease them to speed it up.

Then instrument will replay a note depending on the length of time the note is played for. In your play note: block, adjust the beats and rest values. Increase them to slow down the music, and decrease them to speed it up.

×
×

Cart