Music Project
Unit 3 Optional Project
This page needs KEEP SUCH THAT updated. –MF, 6/22/20
PG: I’d very much want to have a map-onto-scale one. (I have an example somewhere.) Kids who care about music will find the switches interesting, and even kids who claim not to be able to hear the differences will.
BH: This is fine as far as it goes, but it calls out for more, starting with a note-name-to-midi-number reporter, and then making a round.
MF: BH has reviewing to do (see TG)
This page has been renumbered; need to check if this throws off the numbering in the solutions or TG. –MF, 4/26/19
See also:
- Old sound content collected together
- Old Looks and Sound page
-
The
MapBlock & Music (has invert and round)
In this project, you will use the Snap! play note block to create music while you review abstract data types and higher-order functions.
-
“U3-MusicProject”

-
Reviewing Higher-Order Functions with Sound
-
Build and compare these
playscripts. Run each script a few times.The inputs values given to the
play noteblock are musical pitches. Higher values create higher notes. You can input any integer from 0 and 127. The number 60 represents middle C. -
Need to Review?
These need updating!! –MF, 4/5/19
-
You learned about
for eachin Unit 2 Lab 2: Checking Each Quiz Answer. -
You learned about
keepin Unit 2 Lab 3. -
You learned about
mapin Unit 3 Lab 2.
Creating an Abstract Data Type to Organize Musical Data
-
Pitch is the amount of highness or lowness of a musical note; the pitch value goes in the first input slot of the
play noteblock.The length of a note is the amount of time that the note plays (the number of beats); the length value goes in the second slot of
play note.Create a
noteADT to manage the pitch and length of each note in a song.-
Create the constructor:
-
Create two selectors:
-
Create the constructor:
![]()
Creating Blocks to Play Music
-
Use
for eachtogether with your selectors to build a
block that takes a list of notes as input and plays each pitch for the specified number length of time.
-
Create a reporter to reports the notes for a song of your choosing. Here’s an example:
-
Test your song with your
play songblock, and debug any problems.
![]()
-
Use the
block to change the pace at which the notes are played. A higher number will make your song play faster; a lower number will make it play slower.
BPM stands for “beats per minute.”
Transposing Music
-
Compare the output of these two scripts that you created above. Discuss what map + 5does to the sounds you hear:

-
Use
maptogether with your ADT blocks to create a reporter that transposes (shifts) a list of notes. It should take a list of notes and a number indicating how much to transpose (shift) the song as input, and it should report the adjusted song. For example:

-
Try playing your song using your
transposeblock with several different shift numbers so that you can hear the impact ofmap.
Doesn’t work in Snap! but would have been a nice way to tie the page together… :/
Creating a Round
Boring? Maybe not for A/V kids…
Using a Frequency Cutoff
-
Compare the output of these two scripts that you created above. Discuss what keep \< 65does to the sounds you hear:

- …

![transpose block definition hint showing 'transpose (notes) by (shift): report (map (note, pitch: ((pitch from note ([empty list input slot])) + ([something unreadable])) length: ([something unreadable])) over ([something unreadable]))' transpose block definition hint showing 'transpose (notes) by (shift): report (map (note, pitch: ((pitch from note ([empty list input slot])) + ([something unreadable])) length: ([something unreadable])) over ([something unreadable]))'](../../img/3-lists/transpose-definition.png)