O'Reilly logo

Raspberry Pi For Dummies by Mike Cook, Sean McManus

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Sounds and Music

As well as changing a sprite’s appearance, you can give it some sound effects. Scratch comes with sounds including slurps, sneezes, and screams; ducks, geese, and owls; and pops, whoops, and zoops. There are effects there for most occasions, and many of them are a natural partner for one of the sprites that Scratch provides.

warning_bomb.eps At the time of writing, some of the sounds provided are in MP3 format, but Scratch can only play those that are in WAV format. If you get a message saying a sound is in an unrecognized format, try another sound.

Here are the two steps to using sounds in your Scratch project:

1. Import the sound to your sprite. To do this, click the Sounds tab above the Scripts Area, as shown in Figure 10-10, and then click the Import button. Browse the provided sounds. You can click a file once to hear a preview of it, and click it twice to bring it into your sprite.

After you’ve imported a sound, click the speaker beside it to preview it, or click the X button to delete it from your project. If you a delete a sound in this way, it remains on your SD card so you can import it again later.

2. Use one of the blocks to play a sound. To see the Sound blocks, click the Sound button at the top of the Blocks Palette first.

The Play Sound block enables you to choose which sound you’d like to play from those you have imported. The Play Sound Until Done block ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required