Directions for Creating a Virtual Xylophone in Scratch

Working Sample:

1.  Start Scratch.  Delete the Cat.

2.  Create a Variable Called "Instrument"
    a.  Click Orange Variable Block
    b.  Click "Make a variable"
    c.  Type "Instrument"
    d.  Click "OK"

3.  Double Click on Instrument Variable to get a slider.  (You can use this to change instrument sounds in your program.)

4.  Click Paint a New Sprite.  
      a.  Draw a Large Rectangle and fill with a color.  
      b.  Use text tool and put a "C" in the lower part of the "Bar."
      c.  Click OK
      d.  Name this Sprite "LowC"

5.  Click "Costumes" Tab on "LowC"

6.  Click "Copy"

7.  Click "Edit" on "costume2"

8.  Use Flood Fill to make the outline of the Bar white.

9.  Click "OK"

10.  Click on "Stage"

11.  Click on "Backgrounds" Tab.

12.  Click "Edit"

13.  Flood Fill the stage so it is a solid color.

14.  Click Ok

15.  Your Stage should look like:

16.  Add This Script to the "LowC" Sprite

17.  Add this Script to "LowC" Sprite (to play when clicked)

18.  Add this Script to "LowC" Sprite (to play when 1 key is pressed)

19.  The entire Script should look like:

20.  Click the Green Flag and Test - it should play 1 note)

21.  Use stamp tool to copy the "LowC" Sprite

22.  Make the Following Changes to new Sprite
    a.  Use Shrinker Tool to make it smaller
    b.  Change the "Go To" to a the new x and y position
    c.  Change the "play note" to 62 (Pitch name D) in when LowC clicked
    d.  Change when 1 key pressed to when 2 key pressed
    e.  Change the "play note" to 72 (Pitch name D) in when 2 key pressed
    f.  Edit the Costumes so "D" is on the Bar

23.  Finished Script for D Bar should look like:

24.  Click the Green Flag and test the scripts.  You should be able to play two pitches.

25.  Use the copy tool and create the rest of the Xylophone.  The finished stage should look like

26.  Modify the scripts so the xylophone can play all eight notes.

Email Mr.Michaud

Copyright ©2011 Mr. Michaud.