O'Reilly logo

Scratch Cookbook by Brandon Milonovich

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

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:

  1. Create four new variables; name them First note, Second note ...

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