CSCI 1300 Homework 3: Song Generator
About characters and strings: Zelle 4.1-4.3
About text files: 4.6.1-4.6.2
About conditionals: 7.1-7.3
As we’ve seen, sounds can be represented by sequences of numbers representing air
pressure measurements. But there is a much older practice of representing certain kinds
, in another way: as a sequence of
. In this homework you’ll write a
program that uses a representation of notes to specify music and generate sound from it.
We won’t be using real musical notation (the staff, notes with tails, and so on), but a
simpler representation that uses just text. We’ll represent notes by letters, C,A,B, and so
on, just as they are described when people talk about music. We’ll also use letters to
represent the length of notes: whole note, half note, quarter note, and so on: W will stand
for a whole note, H for a half note, Q for a quarter note, and E for an eighth note. In
music, a whole note is played for some period of time, a half note for half as long, a
quarter note for a quarter as long, and so on.
Over the course of the assignment, you will work up from a program that can play a song
like this scale:
which has no length indications, and plays only one note at a time, to a program that can
play this, in which there are two note chords, with different lengths.