Interactive note playing
In this recipe we are going to create a program that integrates many techniques we've used already in this book with the use of sounds. Specifically, we are going to create a program that asks the user for three notes to play and an instrument number. The program will then take the user input to play a tune.
Getting ready
Not much is required to get this recipe moving. First, open up a new Scratch file to use. You can customize the appearance through either picking a background or a new sprite if you'd like, though this is not necessary. Here we will work strictly with the default sprite and white background.
How to do it…
Follow these steps to get this recipe set:
Create four new variables; name them
First note
,Second note
,Third note
, andInstrument
.- Drag over a new block and place it in the Script area.
Below the top hat block you just dragged over, select the say () for () secs block from the Looks category.
Replace the text in the block from step 3 to say
I am going...