Sound function (method) named concat that returns a new
Sound object that is the concatenation of two sound objects. That is,
concat splices two sounds together into a new sound, the first sound followed by the second sound. The two sound
objects to concatenate are the current sound object (this) and a sound object that is passed as a parameter. The concat method is a function and should return
a new Sound object. Here is an example of how
concat might be called.
String path = "T:/Harcourt/Spring2008/CS140/sounds/"; Sound s1 = new Sound(path + "it.wav"); Sound s2 = new Sound(path + "is.wav"); Sound s3 = s1.concat(s2); // note that concat returns a new sound object s3.explore(); // plays "it is"
A call to concat produces a new sound, it doesn't modify
the original sound object or the dound object passed to it. So in the above example,
s1 and s2 are unchanged. Try your function on this example.
concat to concatenate three sounds
(just add one more sound to the example above).
Play the resulting sound object.
concat method to create
a single sound with ten words in it constructed from ten separate sound files. Use the recordings of words in the sounds folder. Here's an outline of how
I want you to solve this:
sounds folder. You are going to use Java's
array initializer syntax to do this. Here's an example array of strings initialized with four words that all exist in the sounds folder.
String [] words = {"her", "horse", "is", "fun"};
"T:/Harcourt/Spring2008/cs140/sounds" to
each string in the array of words and append also the string ".wav"
to each word in
the array.
concat to create a
new sound with all the words concatenated.
You are not supposed to use ten different sound variables, one for each sound, you are supposed to use arrays and for-loops.
This program is worth two
homework grades. Turn in both a printout at the beginning of class and
and e-mail me your Java file HW13.java as an attachment.
Your e-mail should say HW13 in the subject line and the file name should be HW13.java.