decreaseVolume()
to the Sound
class in the
file Sound.java
. This is very similar to the way we added
methods to the Picture
class (for example decreaseRed()
).
In a Lab18
class add a method decreaseVolume()
to the Sound
class. This method should decrease
the volume of the sound by 50%. Test your method on any sound file.
Lab18
class to open and play the Gettysburg address
in the sound file gettysburg.wav
. Call this sound object sound1
.
Lab18
class to open and play the sound in the sound
file taps.wav
. Call this sound object sound2
.
sound1
and
sound2
into a new
third sound, sound3
.
Play the resulting sound3
object and you should be able to
hear the two different tracks.
sound3
object the taps sound file is too loud. Decrease the volume of it using your new handy decreaseVolume
method before
you add the sounds together. You may need to call decreaseVolume
several times to get it at the right volume.
Add a method to the Sound
class named addSounds
. Add sounds
takes three Sound
objects as parameters. The first two are the
sound objects to add and the third is the sound object that results from adding together
the first two. Test your method on the example from Part 2 above.