IC210 Fall 2009

Programming Project 2

Music Manipulation


Executive Summary

Your roommate has started going even further with the antics.  This roommate claims to have taken some great music and scrambled it in into 2 separate files, in a way that “you’ll never be able to un-scramble”. You need to show off your skills and demonstrate that you are up to the challenge.


Your assignment is to create a program that can read in a .wav file of the user’s choice and perform various functions to it.  The finale will be unscrambling the mystery music.


Due Dates and Honor

The project will be due by the “close of business” on Thursday October 29, 2009. See the course policy for details about due dates and late penalties.


Again, this is a Programming Project, and it is very important that you understand and abide by the Department's policy concerning programming projects. Please view: http://www.usna.edu/cs/academics/ProgrammingPolicy.pdf


Important Notes Up Front

  1. Easy extra credit! Complete Steps 1-4 by Fri Oct 24 and get extra credit!
  2. Unlike Project 1, you must submit your work on Blackboard as you go (after completing each step) -- not just the final product.
  3. You must write and use a different function for each step, where that function does the bulk of the work.
  4. Your program will use an array (actually, probably more than one) to store a song or songs. For full credit, each function must fully process the contents of the array as appropriate (e.g., if there are 100 samples, deal with all 100, not 99!), and not access any invalid array indices (e.g., going beyond the end of the array).
  5. A demo executable is provided – see the course calendar.
  6. Starter code is provided. Download from the course calendar.
  7. We are using the same support code for .wav files as for Project 1, but project2.cpp in the starter code now demonstrates additionally functionality that you will need. Read project2.cpp carefully before you start!
  8. You will need to use pass-by-reference for this project! Make sure you understand it!  However, you should not make a function argument pass-by-reference unless it is actually necessary for it be so. In other words, if your instructor changed one of your arguments from pass-by-reference to pass-by-value, it should break your program in some way.
  9. Your program should produce output that roughly matches the provided screenshots.

More details for 1, 2, and 3 are given later.



The project is divided up into several functions, worth varying number of points, not strictly based on difficulty. You are strongly encouraged to solve each function - including thorough testing. Your maximum grade will depend upon which functions you get working.


All of your program’s functionality will be implemented via function calls, with your main() function serving primarily as central hub with some sort of selection structure calling the functions that implement the required functionality. The user should be able to continue selecting options until he chooses to quit.


Step 1: (10 pts.) Display menu

Using a function, print a menu to the screen and return the user’s menu selection to the main() function. The menu should include a selection option for all the features your program is capable of; as well as a quit option.  Your function should continue to ask the user for their choice until a valid choice is entered.



Step 2: (10 pts.) Load Song

This function should:




NOTE : In the rest of this writeup, assume unless otherwise shown that the user has just read in a fresh copy of “frequency.wav” (from the starter code). Thus, by comparing your program’s output to the screenshots, you can see if your program is doing the right thing.


Step 3: (10 pts.) Print head and tail of current song

This function should:




Step 4: (10 pts.) Write your song to a file

This function should:


Step 5: (10 pts.) Change the volume

This function should:




Step 6: (15 pts.) Increase the Speed

This function should:



Step 7: (15 pts.) Reverse the song

This function should:




Step 8: (15 pts.) Combine 2 songs

This function should:



Step 9: (5 pts.) Unscramble mystery1 and mystery2 into one song


Step 10 Extra Credit: (Max 3 points) Create a sound clip

Your must add an option to your menu that allows the user to generate a sound clip.

This Function should:


Step 11 Extra Credit: (Max 5 points) Create Mystery Files

You must add an option to your menu that allows the user to scramble any song file.

This Function should: 


Other Extra Credit: (Max 3 points) Start Early!

·         Submit working steps 1 – 4 prior to class on Friday 24 Oct 2009 and receive 3 points extra credit on your final grade. Submit your steps on Blackboard AND turn in hardcopy to your instructor of:  a.) project2.cpp b.) a screenshot  showing you loading a file, printing the head/tail, and saving the file.


Friendly Reminder:


·         You MUST submit a working solution for EACH of the above steps as you complete them.   Submit just the project2.cpp file. It’s okay if you make some changes to a step after you submit it, but we want to see the progression of your steps. The individual steps will not be graded for style or functionality – as long as it looks reasonably like you submitted the steps, what counts will be the style and functionality of the final result (submit on Blackboard as such)


Important grading points:

·         The default method of passing variables is pass by value.

·      Appropriate use of functions to implement this program is critical to receiving the maximum possible score.

·       If your program does not compile as submitted, you will receive a zero.

·      Your program must read input and write output in the exact format specified in this project description.

·      Your program’s source code must comply with the Required Style Guide in order to maximize the grade you receive on this project.

·      Your grade will also depend on the reasonable use of C++ code.  Don’t use 50 lines of code where 5 would do.


There will be both a paper and an electronic part to your submissions. The paper submission can be handed to your instructor or slid under their office door (but do not put your project in their mailbox). For the purposes of any late penalties, your project is not considered submitted until your instructor receives BOTH the electronic and paper portions of your submission. Any disagreement between your paper and electronic submissions will result in a grade reduction.


Electronic submission: Unless otherwise specified by your instructor, your electronic submission should be made via Blackboard.  As you complete each step you should submit your project2.cpp file.   Submitting steps out of order is completely acceptable!  Simply note the out of order submission in the comments at the top of your code with your name.  i.e., “Submitting Step 6, step 5 has not yet been completed”.


When completely finished, submit your project2.cpp file (and the unscrambled .wav file, if you get it working) under the “Final submission” link on Blackboard.


If you desire to submit a revised solution to any completed step notify your instructor via email so they can clear your previous submission.  However, unless changes are dramatic this is not required for intermediate steps (see “Friendly Reminder” above) – the final submission is what is graded.


Paper submission: staple in this order: