UMass Lowell Dept. of Computer Science
COMP 2120 / MUED 2120 — Sound Thinking
Spring 2016 Semester, Section 201
Prof. Jesse M. Heines and Prof. Gena Greher
Notes for Class No. 18
Transposition (conclusion) and Synchronization Using the Scratch Timer
Tuesday, March 29, 2016
A video of this class is (or will be) posted at: http://echo360.uml.edu/heines2016/comp-mued2120.html
Handouts and Materials
Assignment No. 6 — Transposing Using Scratch Lists
Openings / Announcements / Reminders
Academic Calendar Note: Wednesday, April 6, is last day for students to withdraw from courses with a grade of “W”
Class Notes
How did you do on the “Hey Jude” exercise?
Revisiting Transposition
Definition
- taking the same intervalic range (or distance) between notes and adjusting for range
“Home Base”
- the most comfortable key in which an instrument plays
- depends on the range of the instrument
- is different for different instruments
- to get instruments to play the same note, adjustments must be made for each one’s different “home base”
When transposing, the distances between notes remain the same
- this yields maximum flexibility for matching sounds
Terms you should now know
- “list”
- “list index”
- “indirection”
- “string” (as opposed to “number”)
Revisiting Timing and Synchronization
What happens quickly on a computer and what takes a while to happen?
- setting a variable?
- adding 1 to a variable?
- playing an MP3 file?
- loading an MP3 file from your computer’s internal disk?
- loading an MP3 file from a flash drive or other USB device?
- loading an MP3 file from the web?
What kinds of problems can occur with timing and syncrhonization?
- clips with blank space (silence) at the beginning or end of the sound?
- clips of different length?
- what can make the computer hiccup?
Using the Scratch Timer with MP3 Files
Script Main
Script Got
Script Sing
Questions on the above code
- why are the two “play sound until done” blocks in separate scripts?
- why are the "broadcast" blocks in script Main not “broadcast until done” blocks?
- why is the “reset timer” block needed?
- why does the “wait until” block test for “timer is greater than 4” rather than “timer is equal to 4”?
- why do we need the “volume got” and ”volume sing” variables?
Using the Scratch Timer with MIDI Notes
Playing “Row, Row, Row Your Boat” as a round, synchronized with the Scratch timer
https://scratch.mit.edu/projects/1237114/#editor
Script Main
Script Init
Script Part 1
Script Part 2