190 likes | 313 Views
Unit 3 Music and Sound. Evangel College S.2 ICT. Animal Piano Project. We will use the blocks in the Sound category to build an Animal Piano project. New sprite. At first, we add the key sprites. Click the New Sprite From File button. New sprite.
E N D
Unit 3 Music and Sound Evangel College S.2 ICT
Animal Piano Project We will use the blocks in the Sound category to build an Animal Piano project.
New sprite At first, we add the key sprites. Click the New Sprite From File button
New sprite Click Costumes button on the left and then choose crab1-a in the Animal folder.
Shrink and Rename Click on the Shrink tool, then click on the crab in order to shrink it. Place it on the left hand side. (Optional: Rename the sprite to “C Note”.)
Play a Note Drag the PLAY NOTE block to the scripts area. The value 60 represents middle C. Click on the script. Can you hear the sound?
Key Press Drag the KEY PRESS block on top of the PLAY NOTE block. Change the key from “Space” to “a”. Press “a” on the keyboard. Can you hear the middle C sound?
Add other notes You can change the note using the keyboard.
Add other notes Prepare other notes: C Note: 60 Key: a G Note: 67 Key: g D Note: 62 Key: s A Note: 69 Key: h E Note: 64 Key: d B Note: 71 Key: j F Note: 65 Key: f C Note: 72 Key: k Hint: You may duplicate the sprite and then change the costume.
Import the stage background Choose the Stage and then Import
Animal Piano Project • Congratulations! You have created an Animal Piano! • Can you play a “happy birthday” song on it?
Challenging activities Activity 1 (Change tempo): Add script for the stage so that • When the key “b” is pressed, the tempo (beats per minute) increases, ie. faster. • When the key “v” is pressed, the tempo (beats per minute) decreases, ie. slower.
Challenging activities Activity 2 (Change volume): Add scripts for each sprite so that • When the keys “up-arrow” is pressed, the volume increases. • When the keys “down-arrow” is pressed, the volume decreases.
Challenging activities Activity 3 (Change instrument): Add scripts for each sprite so that • When key “1” is pressed, the piano plays Acoustic Grand sound. • When key “2” is pressed, the piano plays Violin sound.
Challenging activities Activity 4 (Mouse control): Add scripts for each sprite so that • When the user clicks on the keyboard, the piano plays sound too.
Programming concept: Event Event An event is triggered when something happens. For example, when the user presses a key on the keyboard, a key press event is triggered. There are many kinds of events, such as Key Press event, Mouse Click event, Green Flag event or even events triggered by other sprites.
Programming concept: Event Event driven programming Any programming model which uses events to run a specific portion of the program is called event-driven programming. Event capture and event handling A sprite can capture the event and handle it. For example, the cat sprite captures the keyboard event and plays a note.
Summary You have learnt: • How to use SOUND blocks to build scripts • How to new a Sprite, rename, resize and move it You have also learnt the following programming concepts: • Event – Happenings triggered by user or other sprites