|
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:
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. |
© 2001-2015 Dr. Christopher C. Taylor | Office: CC-36C | Phone: 277-7339 |