CS-171
Program Assignment 5
An Audio Collage
The objectives of this assignment include the following:
You may elect to work on this assignment with a
partner. The two of you will submit one assignment with both of your names on
it and you will each receive the same grade. You must receive an ok from the
instructor regarding your partnership. It is also critical that each of you
participate equally; the next midterm will ask you to program methods similar
to these.
An award (+5 bonus points) will be given to the best
audio collage created by a student(s). We will post all the collages online
and then have a vote. Be creative, think about your project and have some fun
with this assignment.
You will place all of your code as methods in your copy of
You may use any of the wav file in our MediaSources
folder. You are also encouraged to search the internet for other wav files
(or audio files). Be warned that not all wav files found on the Internet are
of the correct format to work well with our default Sound constructor.
Our sound files are all at a sampling rate of 22050, contain one channel (i.e.
are mono), and use 16 bits (2 bytes) per sound sample. You will need to
"clean" your externally obtained wav files first to convert them into this
standard convention by using software that is installed on the instructor
machine.
All transformation loops should use the while-loop
construct instead of the for-loop.
Try to keep your final wav file around 30 seconds or
less.
Remember to document (comment) your code appropriately.
All methods described below should keep the original sound intact and return new sounds with the desired effects.
(10pts)
cut(10pts)
splicepublic Sound splice ( Sound endSound )
This method will create a new sound of the appropriate
length that contains first the calling sound and then the
endSound appended to the end.
(10 pts) add
public Sound add ( int start, Sound overlaySound )
This method will create a new
sound of the appropriate length. It contains all parts of both sounds. The
calling sound is copied to the new sound. Then starting at the sample
indicated by start the overlaySound will also be played (both at the same
time). If the overlay sound extends beyond the length of the calling sound,
then be sure your combined sound is long enough.
public Sound reverse ( )
This method will create a new sound the same length as
the calling sound. It will reverse the calling sound (backwards).
(10pts)
(10pts)
(15pts)
(10 to 15 pts)
echo
public Sound echo ( int start, int end, int numRepeats )
This method will
create a new sound that has an echo effect of the contents of the calling
sound. The numRepeats indicates how many times the echo is heard. For
additional credit, add a decayFactor which indicates how much more quiet each
subsequent echo is -- this should be a number such as 0.8 which decays the
volume of the ith echo by a factor of 0.8 raised to the ith power. (10 points
regular, 15 points with decay).
Others??
Be creative and think of other effects. Any that are substantively
different than those defined here could be used. Get the instructor's
approval ahead of time, so we can arrive at a commensurate point value for the
effort.