Play a Drum

Using the two code blocks shown in Figure 11.4, you can add the playing of a drum to your Scratch application and, when necessary, pause drum play for a specified number of beats.

Figure 11.4. These code blocks let you control the playing of a drum within your applications.


The first code block shown in Figure 11.4 plays a drum sound for a specified number of beats. This code block lets you choose from among 46 different types of drums, each of which is easily selected by clicking on the code block’s drop-down list, as demonstrated in Figure 11.5.

Figure 11.5. This code block supports the playing of 46 different types of drum sounds, numbered from 35 to 81.


The second code block shown in Figure 11.4 lets you momentarily pause drum play for a specified number of beats. Using both of the code blocks, you can play a wide assortment of drums within your applications.

In this example, the first sound block plays a drum beat for five beats using an Acoustic Snare. The second sound block rests for .5 beats, and the third code block uses an Open Triangle to play a drum for .5 beats.

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

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