CS285 -- Lab 4: Song Generator

Winter 2004
Objectives Addressed
Procedure

Write a program that will generate a number of songs. The first song should consist of a random number of notes in a random sequence. The duration of each note should be randomly selected from the following list:

Duration Probability
x/16 y/16
x/8 y/8
x/4 y/4
x/2 y/2
x y
2x y/4
4x y/16

where x = 250 ms and y is the probability of selecting a note with a duration of 250 ms, i.e., it should be twice as likely to select a duration of 250 ms than a duration of 125 ms. No song should be more than 5 minutes in length.

The second song should contain all of the same notes as the first song, only the notes should be in a scrambled order.

The third song should contain all of the same notes with the order of the notes progressing from shortest to longest and lowest to highest.

The fourth song should be exactly the same as the first song only one octave higher.

The fifth song should be exactly the same as the first song only each note should be replaced with a triplet of notes going in sequence from the same note an octave lower, the same note, and the same note an octave higher. The total duration of the triplet of notes should be the same as the original note.

Your program should also produce a histogram indicating how frequently the various durations occurred within the song. The histogram should look something like this:

x/16: *
 x/8: **
 x/4: ****
 x/2: ********
   x: ****************
  2x: ****
  4x: *
Constraints
Lab report (due 11:00pm, the day prior to week 7 lab)

Here is a template file to use as a starting point for this report.

Your report should include:

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

Your grade will depend on quality of design, clarity of code and documentation, as well as whether your program produces the correct results. If you have any questions, consult your instructor.

Acknowledgment

This assignment was originally developed by Dr. Darrin Rothe and modified by Dr. Chris Taylor.

Last Updated: Friday, 02-Jan-2015 10:08:19 EST