hw3songplayer - CSCI 1300 Homework 3 Song Generator Read...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 1300 Homework 3: Song Generator Read: About characters and strings: Zelle 4.1-4.3 About text files: 4.6.1-4.6.2 About conditionals: 7.1-7.3 Representing music. 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 of sound, music , in another way: as a sequence of notes . 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: C D E F G A B c 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. H CE Q DF Q EG H FA Q GB Q Ac H Bd Q ce
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The format of this assignment is a little different from the first two. In those, I got you started by providing what I hoped were pretty complete plans for the programs you needed to write. You then exercised your understanding (I hope) by making additions and modifications on the basic plan. In this assignment I’m going to move you towards self sufficiency (your ultimate goal) by providing less of a plan. I’m still going to describe some of the pieces of work your program needs to do, and how to do them in Python, but you’ll need to do more of the planning. To provide some support, I’ll be suggesting an order in which you can develop progressively more capable programs, in stages, so that you don’t have to make a plan for the most complex, most capable program, all at once. Phase I. Playing single notes. This program is going to read a file like scale.txt (on the moodle; you may need to paste this into a .txt file if it doesn’t download), that has these contents (and some more): C D E F G A B c For each note it is going to generate a corresponding tone, and it’s going to string these tones together, and put them in a WAV file. You can then play the WAV file to hear the music. You already know how to do parts of this. In particular, you know how to: string tones together, by concatenating lists of samples record samples in a WAV file But there are other pieces you don’t know how to do, other than perhaps getting some ideas from what you have read in Zelle.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern