CSE 161 Assignment #8: Soundlab

All parts of this assignment are due using Blackboard turn in by 10:00 am on Saturday, December 5. The required party of this assignment should be done with your most recently assigned partner. The extra credit portions may be done on your own or with any partner of your choosing.

Part I (Required)

Download the following files:

Add the following two functions to sound.py:

  1. backwards( ) should read the names of input and output WAV files, and create a backwards version of the input file in the output file.
  2. combine( ) should read the names of two input WAV files and one output file. The output file should have the length of the shorter of the two input files, and contain the combination of the two input files. Each sample in the output is the sum of the two corresponding samples in the inputs, divided by 2. The division by 2 is to prevent the output file from having a sample value too large to fit into 16 bits.

Use backwards( ) on secretMessave.wav and save the result as solution.wav. Listen to it in order to discover what the secret message was. Use combine( ) to combine declaration.wav and BornToRun.wav, and save the result as combined.wav. Listen to it to make sure that the combination was performed correctly. Turn in your new version of sound.py, solution.wav, and combined.wav. In the comment box, write the secret message.

Part II (Optional, Extra Credit): Sound Studio Ultra

You can do this option in addition to or instead of the other optional parts of the assignment.

Implement the following functions:

Save all the functions in a file named option1.py. Experiment with modifying various WAV files. Write a short description of what you did and how you tested it, in a file named report1.txt or report1.doc. Turn in the two files.

Part III (Optional, Extra Credit): Music Synthesizer

You can do this option in addition to or instead of the other optional parts of the assignment.

Implement a program that reads in a text file containing musical notation (as specified below) and creates a WAV file of the music. Create some input files based on simple melodies and run the program to turn them into sound files. Write a short report named report2.txt or report2.doc describing what you did. Turn in your musical notation files, the resulting WAV files, and the report.

The musical notation is as follows. Each note is specified by two characters separated by white space. The first character is a letter specifying the pitch A, B, C, D, E, F, G, or the letter R to indicate a rest. (Assume the scale is C major, and no notes are sharps or flats.) The second character is the duration specified a W, H, Q, E (whole, half, quarter, eighth). Any number of notes may appear on a line, and any number of lines may appear in file.

Part IV (Optional, Extra Credit): Music Composition

You can do this option in addition to or instead of the other optional parts of the assignment.

Create an original musical composition using any or all of the functions you implemented described above as well the functions given in the original sound.py file. You can create your own input WAV files using any programs you like. For example, you can use iTunes to rip samples from CDs. You can use the Sound Recorder application on a Windows PC to record from a microphone. You might run several different functions multiple times to create your final composition. Write a brief report describing what you did, and turn in the report, your composition, and any additional code you had to write (if any).