->Homepage
->Schedule
->Courses
-->CS182
-->Tentative Schedule
-->Objectives
-->Quiz 1
-->Lab 1
-->Lab 2
-->Lab 3
-->Lab 4
-->Lab 5
-->Lab 6
-->Lab 7
-->Project
-->CS183
-->CS285
->Course Policies
->Electronic Submission
->Documentation Standards
->Old Exams
->C++ Examples
->MSVC++ Info
->Software
->Support Forum
->Unix Info
->Nature Photos

[Home]
[Rich][Home][Rich]
[Author]
CS182 -- Lab 6: Melodies

Winter 2003-2004

My dream job is to be a professional musician in the "Jeopardy!" house band -- because then I'd only have to learn that one song. -- Peter Medhurst
Overview

In this lab, you should develop skills using functions.

Procedures

In the first lab we created a program that would generate a short sound. In this lab you are required to create a program that will read a data file in the following format:

# length (in ms), space separated list of notes
# Should handle up to three notes per line
# All notes on the same line should play simultaneously
# - in front of note indicates an octave lower (-- indicates 2 octaves, etc)
# + in front of note indicates an octave higher (++ indicates 2 octaves, etc)
# A line with "1000, " indicates silence for 1000 milliseconds
1000, c
1000, c e
200, 
500, -a ++c#

Lines that begin with a # symbol are comments and should be ignored. Comment lines may appear anywhere in the file (not just at the beginning). In non-comment lines, the number before the comma indicates the duration of the line in milliseconds. The list of notes (your program must support zero, one, two, or three notes) to be played during that length of time. The notes should be separated by whitespace. For each + preceeding a note, the note should be an octave higher. For each - preceeding a note, the note should be an octave lower.

The sample data file shown above should play middle C for 1 second, then C and E for 1 second, then be silent for 0.2 seconds, and then play A one octave lower and C# two octaves higher for 0.5 seconds.

Your program should make use of at least two functions.

Just for Fun

If you are looking for an extra challenge you may want to allow the data file to contain a , waveform. The value of waveform could be sine, square, triangle, sawtooth, or whatever other waveforms you might like. It would control the type of waveform generated for the note(s) specified on that line.

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.

The lab report does not need to be self-contained. Your report should include:

  • A brief narrative filled with interesting observations about your experience with this assignment. Your narrative should convince the reader that you were thinking when doing this assignment.
  • An activity log indicating how much time you spent on each phase of the assignment. You should use the format found in the template XML file and report the time in the following categories:
    • Design
    • Coding
    • Debug (before you think it's working)
    • Test (after you think it's working)
    • Writing Report
    • Other
  • Sample program output: You should include a sample input file (within the XML report) and the corresponding .wav file generated by your program. The filename should be 182MSOELoginL6.wav where MSOELogin is your MSOE login name.
  • Documented source code for your program.

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 laboratory assignment was developed by Dr. Chris Taylor.

Last Updated: Thursday, 01-Jan-2015 14:33:02 EST