image

IN THIS ADVENTURE, you explore the sounds of Scratch. More importantly, you learn how to use Scratch to record, play, and compose music! So, turn up your speakers (or put on your headphones) and let’s get started!

Using Sounds

The place where all of Scratch’s music and sound blocks live is in the Sound Block Palette, shown in Figure 10-1.

image

Figure 10-1 The Sound Block Palette

You can use the blocks in the Sound Block Palette to play sounds from the Sound Library, to play recorded sounds (even those that you record yourself), and to compose melodies by picking instruments and stringing notes together.

The Sound Library

Are you looking for that perfect sound for a sprite to make when it’s doing a particularly complex dance move? How about the sound of laughing or even of sneezing to add more realism to your project?

The Scratch Sound Library contains more than 100 sounds that you can use in your programs. These include a rooster crow, cat meows, cheering, and all sorts of musical instruments.

Before you can use any of these awesome sounds, you need to add them to your project in the same way that you add sprites and backdrops. It’s time to go to the library and check out some sounds. Go to the Scratch Project Editor and follow these steps:

  1. Select File  ⇒  New from the top toolbar to create a new project.
  2. Click the Sounds tab to open the Sound Editor, as shown in Figure 10-2.
  3. Click the Choose Sound from Library icon in the New Sound menu, which looks like a speaker.

    The Sound Library opens, as shown in Figure 10-3.

  4. Browse through the library and click the arrows to the right of the sounds you want to hear.
  5. Find a sound you like and click it to select it. Click OK to add the sound to the sound palette for the current sprite, as shown in Figure 10-4.
image

Figure 10-2 The Sound Editor

image

Figure 10-3 The Sound Library

image

Figure 10-4 Adding a sound to your sprite

Follow these steps to make your sprite play this new sound.

  1. Click the Scripts tab to open the Script Editor and the Block Palette.
  2. Drag a when this sprite clicked block from the Events Block Palette to the Scripts Area.
  3. Drag a play sound () block from the Sound Block Palette to the Scripts Area and snap it to the bottom of the when this sprite clicked block.
  4. Change the drop-down menu in the play sound () block to the sound that you added from the Sound Library.
  5. Click Scratch the Cat on the Stage to play the new sound!

The Sound Library has a lot of sounds, but you’re not limited to just these sounds. You can edit and change the sounds in the library and you can also upload and use any sound you can record or find on the web. You find out how to add custom sounds to your project in the next sections.

Using the Sound Editor

The Sound Editor is where you can view your sounds as waveforms, record new sounds, edit sounds, and apply effects to sounds.

To find out more about the Sound Editor, click the Sounds tab. You see the name of the selected sound, followed by a waveform diagram of that sound.

You can tell a lot about a sound from its waveform. The length of the waveform tells you how long the sound will play. The height of the waveform tells you how loud or quiet the sound is. The shape of the waveform tells you how complex the sound is.

Compare the waveform for the sound called Pop, shown in Figure 10-5, with the waveform for the sound called Computer Beeps3, shown in Figure 10-6.

image

Figure 10-5 The Pop sound

image

Figure 10-6 The Computer Beeps3 sound

Editing Sounds

Using the tools below the waveform, you can edit any sound to make it louder, quieter, shorter, and even longer!

Follow these steps to customize one of Scratch’s sounds!

  1. Select the Meow sound in the Sound Palette.

    You see the sound’s waveform.

  2. Click and drag your mouse over the waveform to select it, as shown in Figure 10-7.
  3. Click the Play button underneath the waveform to hear how Meow sounds.
  4. While the waveform is selected, click the Effects drop-down menu and select Reverse.

    Notice that the waveform flips over, as shown in Figure 10-8.

  5. Press the Play button now to hear a backward cat sound!
image

Figure 10-7 Selecting a sound’s waveform

image

Figure 10-8 Reversing a sound

You can also select and edit any part of a sound. For example, you can use the Sound Editor to make part of a sound louder or quieter, to make sounds fade in or out, and even to copy and paste parts of sounds into other sounds.

Recording Sounds

If you have a microphone connected to your computer, you can use the Sound Editor to record your own voice or sounds!

To record a sound from your computer’s microphone, follow these steps:

  1. Click the Record New Sound icon (it looks like a microphone) in the Sound Palette.

    A new blank sound opens in the Sound Editor.

  2. Click the round icon under the waveform box in the Sound Editor. This is the Record button.

    You see a pop-up window, as shown in Figure 10-9, asking whether Scratch can have access to your computer’s microphone.

  3. Click the Allow button.
  4. The first time you use the microphone with Scratch, you see another pop-up window asking you again if it’s okay for Scratch to use your microphone. Choose OK here, too.

    Scratch starts recording.

  5. When you’re done recording, press the square icon (the Stop icon) to the left of the Record button to stop recording.

    If your sound was recorded successfully, you see a waveform in the Sound Editor, as shown in Figure 10-10, and you can click the Play icon to play back your sound.

image

Figure 10-9 Scratch asks for permission to use your microphone

image

Figure 10-10 A recorded sound in the Sound Editor

Importing Sounds

The last button under New Sound in the Sound Palette is the Upload Sound from File button. Using this button, you can find any sound file or music file on your computer and turn it into a sound inside Scratch that you can play inside your projects.

To import a sound, click the Import Sound from File button in the Sound Editor and then find any sound or music file on your computer and click Open. The new sound appears in your Sound Editor and is available to use with the sprite you imported it into.

Forming the Scratch Jazz Band

Most of the blocks inside the Sound Block Palette are for making your own music. You can think of these blocks as being very similar to an electronic keyboard. There are 21 different instruments and 18 different drums for you to choose from, and you can vary the speed of the music (its tempo), insert pauses (called rests), and change how loud or quiet the music plays (its volume).

With a little creativity and work, it’s possible to assemble Scratch blocks to make sprites work together to make beautiful music. In this section, you use Scratch’s sound blocks to put together a jazz band and play the beginning of an old standard.

The song you’ll be assembling is one of the most famous songs in all of jazz: “Autumn Leaves.”

Tuning Up Your Instruments

The first step in getting the band together is to put the sprites on the Stage. Follow these steps:

  1. Select File  ⇒  New from the top toolbar to create a new project.
  2. Click Choose Sprite from Library from the New Sprite menu.
  3. Locate the sprite named Guitar Bass from the Music and Dance category and add it to your project.
  4. Click Choose Sprite from Library again and add the Microphone sprite to your project.
  5. Click Choose Sprite from Library one more time and add the Drum1 sprite to your project.
  6. Remove Scratch the Cat from your project by using the Delete tool or right-clicking Scratch the Cat.

    You should now have three sprites on your Stage. Arrange them in any way you want, as shown in Figure 10-11.

image

Figure 10-11 The sprites for the Scratch Jazz Band project

Now that you have a band, let’s give them something to do. We’ll start with the drummer.

Finding a Drummer

Jazz drumming uses a special type of beat called a “swing beat.” A swing beat is difficult to simulate with a computer program, but you can do a reasonably good job with the Scratch music blocks. Follow these steps to program a simulated swing beat.

  1. Click the Drum1 sprite in the Sprite Pane to open the Scripts Area for the drum.
  2. Drag a play drum () for () beats block from the Sound Block Palette to the Scripts Area.
  3. Change the value of the first drop-down menu to (2) Bass Drum.
  4. Change the value of the second drop-down menu to 0.66.
  5. Drag a rest for () beats block from the Sound Block Palette to the Scripts Area and snap it to the bottom of the play drum (2) for (0.66) beats block.
  6. Change the value in the rest for () beats block to 0.66.
  7. Drag a play drum () for () beats block from the Sound Block Palette to the Scripts Area and snap it to the rest for (0.66) beats block.
  8. Change the value of the first drop-down menu in the play drum () for () beats block to 2 and the value of the second drop-down menu to 0.66.
  9. Drag another play drum () for () beats block to the Scripts Area and change its values to (6) Closed High Hat and 0.66 beats.
  10. Drag another rest for () beats block to the Scripts Area, snap it to your script, and change its value to 0.66 beats.
  11. Snap another play drum () for () beats block to the bottom of the script and change its values to (6) Closed High Hat and 0.66 beats.
  12. Drag a repeat () block from the Control Block Palette and surround the entire drum script with it.
  13. Change the value in the repeat () block to 8.

    Your drum script should now look like Figure 10-12.

image

Figure 10-12 The drum script

Playing the Melody

Here’s how to make the script that will play the melody.

  1. Click the Guitar sprite in the Sprite Pane to open the Guitar Scripts Area.
  2. Drag a when green flag clicked block from the Events Block Palette to the Scripts Area.
  3. Drag a set tempo to () bpm block from the Sound Block Palette, snap it to the when green flag clicked block, and set its value to 145.

    In music, the tempo is how fast or slow a song is. BPM stands for “beats per minute.” A clock ticks off seconds at 60 bpm. So, a bpm of 145 is a little faster than twice the speed of the second hand on a clock.

  4. Drag a set instrument to () block from the Sound Block Palette and snap it to the set tempo to (145) bpm block.
  5. Select the (4) Guitar from the instrument drop-down menu.

The next part of the song you’re programming has 17 notes. Most of these play for one beat. Follow these steps to program all 17 notes.

  1. Drag a play note () for () beats block to the Scripts Area.
  2. Change the value of the second number in the play note () for () beats block to 1.
  3. Make 11 copies of this block so that you have a total of 12 play note () for () beats blocks.
  4. Make four groups of three linked blocks, as shown in Figure 10-13.
  5. Set the notes for all the play note () for () beats blocks to the values shown in Figure 10-13.
  6. Double-click each group of blocks, one at a time. You should notice that the notes in each group get higher, but each group of three notes starts on a lower note.
  7. Drag a new play note () for () beats block from the Sound Block Palette and snap it to the bottom of the first group of three.
  8. Set the note in this block to Eb (63) and the number of beats to 5.
  9. Drag a new play note () for () beats block from the Sound Block Palette and snap it to the bottom of the second group of three (the one that starts on note 53).
  10. Set the note in this block to D (62) and the number of beats to 2.
  11. Drag another new play note () for () beats block from the Sound Block Palette and snap it to the bottom of this same group of notes.
  12. Set the note in this block to D (62) and the number of beats to 3.

    Your guitar sprite’s Scripts Area should now look like Figure 10-14.

  13. Drag a play note () for () beats block from the Sound Block Palette to the bottom of the third group (starting with 51) and set its note to Middle C (60) and its beats value to 5.
  14. Drag a play note () for () beats block from the Sound Block Palette to the bottom of the fourth group (starting with 50) and set its note to Bb (58) and its beats to 5.
image

Figure 10-13 Making groups of notes

image

Figure 10-14 Two note groups completed

Now you have all the notes programmed to play the first four lines of “Autumn Leaves.” If you double-click them in order, you can hear how the song goes.

In the next section, you program the timing between the players in the band.

Playing Together

Broadcasting blocks and event blocks can be used to coordinate between different scripts and sprites. In this section, you make the drummer start drumming and the singer start singing.

The first step is to start the drums at the right time. In this song, you want the drummer to start after the first three notes are played by the guitar. Follow these steps to program the guitar to broadcast messages to the other instruments.

  1. Separate the last note in the first group of notes from the other three.
  2. Drag a broadcast() block from the Events Block Palette and snap it to the bottom of the third note in the first group.
  3. Select New Message from the broadcast () block and create a new message with the word drum.
  4. Click the Drum1 sprite in the Sprites Pane to view the drum sprite’s script.
  5. Drag a when I receive () hat block from the Events Block Palette and snap it to the top of the Drum1 sprite’s script.
  6. Select the drum message from the when I receive () hat block’s drop-down menu.
  7. Click the Guitar Bass Sprite in the Sprites Pane to return to the Guitar Bass sprite’s script.
  8. Snap the note that you removed from the bottom of the first group to the bottom of the broadcast (drum) block.
  9. Double-click on the first group of notes.

    The drums should start playing when after the third note plays.

Next, you program the events that cause the singer to sing each line of the song. The first four lines of “Autumn Leaves” are

The falling leaves

Drift by the window

The autumn leaves

Of red and gold

Each of these lines should be sung along with each of the groups of notes. Follow these steps to program the singing!

  1. Drag a broadcast () block to the top of each group of three notes.

    You’ll be using these broadcast blocks to tell the singer when to sing each line of the song.

  2. Create a new message for each of these new broadcast blocks. The four messages should be falling leaves, window, autumn leaves, and red and gold.

    When you’re finished, your guitar Scripts Area should look like Figure 10-15.

  3. Snap the five pieces together into one script.

    The falling leaves broadcast block should snap to the set instrument to (4) block. The window broadcast block should snap to the bottom of that. Then comes the piece that starts with the autumn leaves, and finally the section that begins with the red and gold broadcast block.

image

Figure 10-15 The guitar script with broadcasts

When the blocks are linked together, they should look like Figure 10-16.

image

Figure 10-16 The finished guitar script

In the next steps, you use the broadcasted messages from the guitar to trigger the microphone sprite to say the lines of the song. Follow these steps:

  1. Click the Microphone sprite in the Sprite Pane.
  2. Drag four when I receive () blocks from the Events Block Palette.
  3. Select falling leaves in the first when I receive () block.
  4. Drag a say () block from the Looks Block Palette, snap it to the first when I receive (falling leaves) block, and change its value to The falling leaves.
  5. Select window in the second when I receive () block.
  6. Drag a say () block from the Looks Block Palette, snap it to the when I receive (window) block, and change its value to Drift by the window.
  7. Select autumn leaves in the third when I receive () block.
  8. Drag a say () block from the Looks Block Palette, snap it to the when I receive (autumn leaves) block, and change its value to The autumn leaves.
  9. Select red and gold in the fourth when I receive () block.
  10. Drag a say () for () secs block from the Looks Block Palette and snap it to the when I receive (red and gold) block.
  11. Change the first value in this say () for () block to Of red and gold and change the second value to 4.
  12. Click the Green Flag to see and hear your finished jazz band program do its thing!

Singing Along!

After you have the melody and drums in place, you can play the song and sing along. Or, if you have a microphone connected to your computer, you can record yourself singing along and hear it every time you press the Green Flag!

Follow these steps to record your lyrics and add them to the band:

  1. Click the Microphone sprite in the Sprite Pane.
  2. Click the Sounds tab to open the Sound Editor.
  3. Click the Record New Sound icon.
  4. Click the Record button and start singing!
  5. When you’re done singing, click the Stop button.
  6. Name your sound.

    If everything worked correctly, you see a waveform for your singing in the Sound Editor, as shown in Figure 10-17.

  7. Play back the sound. If it has any silence at the beginning, select it and use Edit  ⇒  Cut to delete it.

    You want the singing to start as soon as the Green Flag is clicked.

  8. Click the Scripts tab to open the Scripts Area for the Microphone sprite.
  9. Drag a when green flag clicked block from the Events Block Palette to the Scripts Area.
  10. Drag a play sound () block from the Sound Block Palette and snap it to the when green flag clicked block.
  11. Select your singing sound in the drop-down menu for the play sound () block.
  12. Click the Green Flag to hear yourself singing along with the music!
image

Figure 10-17 The new singing sound

How did you do? Does it sound amazing? If not, try again! Unfortunately, Scratch doesn’t give us a way to play the song while we’re singing, so you just need to experiment. But, that’s what Scratch is all about! Play around with it and have fun!

Further Adventures in Coding

Want to find cool new sounds to use in your projects? Check out Free Sounds at https://freesound.org/, where you can find hundreds of different sounds that are all free to download and use. You can even record and upload your own sounds to freesound.org!

image

Achievement Unlocked: The Sounds of Scratch Music

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.23.101.60