Spring 2007
Homework 5 - Adding Background Music
3% Extra Credit
Due: Wednesday, May 9, 2007 at 11:59 pm
This extra credit assignment is similar to
lab 11. The biggest difference is that the background music volume
will change at different times during the final sound object.
You are to write a function called addBackground () that will
take two parameters. The first parameter will be the foreground sound
object. The second parameter will be the background sound object.
This function must return a new sound object that combines these two
sound objects as follows:
- For the first 3 seconds of the new sound object play the background
sound object at maximum volume. Refer to the "normaling" technique
discussed in class.
- For the next 1 second, have the volume of the background sound object
gradually decrease its maximum volume until it gets to one fourth of its
original
sound volume.
- For the next X seconds (where X is the length of the foreground sound
object), play the foreground sound object combined with the background
sound object. The foreground sound object must be played at its
regular volume. The background sound object must be played at one fourth
of its original sound volume.
- For the next 1 second, have the volume of the background sound object
gradually increase from one fourth of its original sound volume to its
maximum sound volume.
- For the final 3 seconds, have the volume of the background sound
object be played at its maximum volume.
Thus the new sound object will be 8 seconds longer than the original
forground sound object. If the background sound object is not long enough,
simply have it repeat as namy times as needed.
Submitting Your Project
Your code must be commented and written in good programming style.
You are to submit your final program to the digital drop box
on the CS 101 Blackboard site.