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. 20
Pencil Code, ABC Notation, and Assignment No. 7 (continued)
Tuesday, April 5, 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. 7: Programming Multiple Parts in Pencil Code
Pencil Code and ABC Notation Cheat Sheet
Openings / Announcements / Reminders
Important Date Reminders
- Yesterday: Monday, April 4: official Faculty Advising Period for the Fall 2016 semester begins
- Tomorrow: Wednesday, April 6: last day for students to withdraw from courses with a grade of ”W”
- In Two Days: Thursday, April 7: Invitation to test student projects in Jesse’s GUI Programming class
- Saturday, April 9: Hawkettes Concert, Cumnock Hall (North Campus)
- Saturday, April 30: Hawkapella Concert, Durgin Concert Hall (South Campus)
The final project assignment is now posted
- note that you need to report your partner(s) and your plans by April 14th
- if you are not going to use the MaKey MaKey board we lent you at the beginning of the semester, these must be returned
- this applies to 18 students
Class Notes
Related reading for this class: Cheat Sheet
Review of Coding Lists that Include Rests
Numerous groups had this problem in Assignment No. 6
The key is to “look at” the value you retrieve from the list before playing it
- remember that the contents of the list are just data
- you can do whatever you want with that data
Pencil Code
Differences from Scratch
- there are no instruments available in the Sound blocks group
- there is no rest in the Sound blocks group, but you can code a rest using
play 'Z'
- to play an MP3 file, it has to be loaded on a server
- once it starts playing there is no way to stop it!
- blocks mode is not complete, but additional capabilities are available in text mode
- some control structures are under the Sprites and Snippets groups
Reviewing why playing music doesn’t work the same as it does in Scratch
- separate sound generation engine
- think of the Pencil Code
play
block as a Scratch broadcast
- thus, the part of Pencil Code that interprets and plays ABC Notation is completely separate from Pencil Code and out of its control
ABC Notation Software
The abc music standard 2.1 (Dec 2011)
http://abcnotation.com/wiki/abc:standard:v2.1
Assessing the pros and cons of various ways to play music, especially on the Web
- native MP3 files in Chrome and Safari vs. OGG files in Firefox
- Scratch has poor timing but a more mature infrastructure
- ABC Notations is more sophisticated musically, but Pencil Code is limited structurally
Of course there are other ABC Notation editors and players
ABC Notation Encoding (continued)
Review from last class ...
Coding Note Values
- octaves go from C to B
- without additional notation, capital letters refer to octave 4
- an apostrophe after a note transposes that note up to the next higher octave
- lowercase letters can also be used for octave 5
- a comma after a note transposes it down to the next lower octave
adapted from: http://www.guitarsite.de/pics/clef.gif
- a rest is represented by a Z or a z
- some software, particularly EasyABC, requires the z to be lowercase
Coding Note Durations
- a quarter note has a duration of 1 beat
- therefore, a letter all by itself is a quarter note
- G = G1
- the 1 is optional
- an eighth note has a duration of 1/2 of a quarter note
- therefore, a letter followed by /2 is an eighth note
- A/ = A/2
- the 2 is optional
- a sixteenth note has a duration of 1/4 of a quarter note
- therefore, a letter followed by a /4 is a sixteenth note
- B/4
- there is nothing optional here
- a half note has a duration of 2 quarter notes
- therefore, a letter followed by a 2 is a half note
- C2
- there is nothing optional here
- a whole note has a duration of 4 quarter notes
- therefore, a letter followed by a 4 is whole note
- D4
- there is nothing optional here
- remember that some software, particularly EasyABC, requires rests to be coded with a lowercase z
- also note that the “standard” note value can be changed with te L: directive
- thus, if L:1/4 is specified, a G or G1 indeed represents a quarter note
- but if L:1/8 is specified, a G or G1 represents an eighth note
- dotted notes have a duration of 1-1/2 times the normal value of the note
- these are coded as a letter followed by 3/2 or 3/4 (as appropriate)
- E3/2
- note that you cannot write E1.5
Completely new material begins here ...
Coding Sharps and Flats and Naturals
- to sharpen a note, precede it with a carat: ^
- to flatten a note, precede it with an underscore: _
- to naturalize a note, precede it with an equals sign: =
Directives
- X: = reference number
- T: = title
- may be followed by another T: directive to add a subtitle
- example: T:The Kings' Entrance
- C: = composer
- must immediately follow a T: directive and precede the directives below
- example: C:Gian Carlo Menotti
- M: = meter = the time signature
- L: = the unit note value
- example: L:1/4 = a quarter note gets 1 beat
- K: = the key signature
- example: K:C = key of C with no sharps of flats
- example: K:Eb = key of E-flat with three flats (B, E, and A)
Example
figure source: http://www.letsplaykidsmusic.com/wp-content/uploads/2013/02/row-row-row-your-boat.jpg
Pencil Code implementation