- The frequencies for each piano key (except the far-right black one) are shown in parenthesis:
- C4# (277) D4# (311) F4# (369) G4# (415) A4# (466)
- C4 (261) D4 (293) E 4(329) F4 (349) G4 (392) A4 (440) B4 (493) C5 (523)
- The second number given is the length of time the sound should be played in milliseconds, eg. buzzer.frequency( 440, 100); plays the frequency A4 (440) for 100 milliseconds.
- Notes can be triggered by CPX button presses.
- Playing high vs low notes by changing the frequency value. This could be mapped to particular CPX buttons or other sensors.
- Different sounds could be played when a CPX button is pressed down as opposed to when it is released back up.
- Sounds can be played by frequency or by note name. Thus the following two give you the same thing:
- buzzer.frequency( 440, 100);
- buzzer.note( "A4", 100);
- The notes in a sequence or song can be collected together in an array, so it is easier to manipulate. For example an array of three notes might be:
- // 0-based indexing is used. The left-most element is at index position 1, and the right-most is at index position 4
- // index: 0 1 2 3 4
- var notes = ["C4","D4","E4","G4","A4"];
- You can use a random number generator to play random notes from an array.
- Provide your own note to be played at random, triggered by a button press.
- buzzer.playNotes(...) can be used to play a set of notes in sequence.
- Create your own song to be played using buzzer.playNotes(...)
- The null value can be used to leave space between notes
Use the tutorial steps given above to create a CPX program that does the following:
- When button A is pressed play a set of random notes from the pentatonic scale ("C4","D4","E4","G4","A4"). Notes in a pentatonic scale were used in our previous Focus Chimes assignment.
- When button B is pressed use buzzer.playNotes(...) to implement either the first part of taps, charge, or some other commonly recognizable tune
The grading criteria for this lab are:
- 1 point: All group member names are given at the top of your code. Plays random notes from a pentatonic scale when button A is pressed.
- 1 point: Uses buzzer.playNotes(...) to play a commonly recognizable tune when button B is pressed.
- 1 point extra credit: Make particular colored LEDs correspond to particular notes, so that the lights are synchronized with the sounds.
Submit your document as a file attachment using the google form, calling the essay topic Music 11 (for the 11 am lab) or Music 12 (for the 12 noon lab)