How to Add Sound to Your Sprite on the Raspberry Pi
You can give your sprite some sound effects with the Raspberry Pi. 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.
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:
Import the sound to your sprite. To do this, click the Sounds tab above the Scripts Area, 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.
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 stops any movement or other blocks on the same sprite until the sound has finished playing.
The sound is imported to a particular sprite, so if you can’t see it as one of the choices in the Play Sound block, be sure you’ve imported it to the correct sprite.
There are also blocks you can use to create music using Scratch, using drums and pitched instruments. Notes are numbered, with C being 60, C# being 61, D being 6,2 and so on. There’s a block called Play Note 60 For 0.5 Beats that plays a note with a particular number for a certain duration.
When you click the menu in this block to specify which note to play, a piano opens that you can use to select the note. If you’re new to music, you can generally get a good result by starting with C, sticking to the white notes and making sure no two consecutive notes are too far apart on the piano.
There is also a block called Set Instrument to 1 which you can use to change the instrument, although at the time of writing, this doesn’t work on the Raspberry Pi.