CS 140 - Homework 13 - Due Monday April 21

  1. Write a 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.

  2. Use concat to concatenate three sounds (just add one more sound to the example above). Play the resulting sound object.
  3. In this part of the program use your new 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:

    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.