Musical Objects Interlude!
Goals:
- Use custom objects to access advanced music features
 
Coding Snippets:
- Pass an object to the 
Pianoconstructor to change its default properties. Thetimbreproperty controls the quality of sound ands its behavior over time based on key-value pairs in a nested object. - The  
playfunction accepts an ABC-notation string that represents a song. Alternatively, passplayan object with asongproperty and other optional properties. For example,tempo:480specifies a quick pace, much faster than the default rate of 120 eighth notes per minute. 
Math and Computer Concepts:
- Sound is formed by audible waves of pressure. The 
waveproperty determines the shape of the wave used to generate sound, which significantly affects the sound produced. Variants include 'piano', 'triangle', 'square', 'sawtooth', 'sine', and 'noise'. - In sound and music, the term envelope describes how the amplitude (or loudness) of a sound changes over time.  Components of the envelope include 
gain,attack,decay,sustain, andrelease, all of which can be specified as properties of a timbre object. Check out this example program for more details. 
Activities:
Save each of the following in a folder called Music.
- EbonyAndIvory:  Use additional instrument object properties to specify a tricked-out, customized keyboard.  These properties include the number of keys (
keys), the color of the white keys (color),the color of the black keys (blackColor), the color of the key outlines (lineColor), the key outline line's width (lineWidth), and the overall keyboard pixel dimensions (widthandheight). - Use output from  
sizexyto code a FullScreenPiano. Show only the minimum number of keys necessary to see all notes that get played. - MaestroTurtle: create single-key pianos for the notes C,D,E,F,G,A,B, positioning them so their images don't overlap. Then make the turtle randomly jump around the space occupied by the keys, and have the key or keys it lands on play a note. For an extra challenge, add a label above each sprite showing which key it is.
 - Write a WaveSampler program that plays a short song once for each of the six wave options. Consider adding drawings, images, or animations that show the shape of the wave as it plays.
 

   
 
        
        
   
