public void writeToFile(String outFileName) 
    throws SoundException
  {
    
    /*
     get an audioInputStream that represents this sound.
     then, we will write from the stream to the file
     */
    AudioInputStream audioInputStream = makeAIS();
    AudioFileFormat.Type type = audioFileFormat.getType();
    
    try {
      audioInputStream.reset();
    }//try reset audioInputStream
    catch(Exception e)
    {
      printError("Unable to reset the Audio stream.  Please "+
                 "try again.", e);
    }//catch
    
    
    //get the file to write to
    File file = new File(outFileName);
    if(!file.exists())
    {
      //if the file doesn't exist, make one
      try
      {
        file.createNewFile();
      }//try
      catch(IOException e)
      {
        printError("That file does not already exist, and"+
                   "there were problems creating a new file" +
                   "of that name.  Are you sure the path" +
                   "to: " + outFileName + "exists?", e);
      }//catch
    }//if
    
    
    //write to the file
    try
    {
      if(AudioSystem.write(audioInputStream, type, file) == -1)
      { 
        printError("Problems writing to file.  Please " +
                   "try again.");
      }
      
      // if the write was successful then set the file name to the
      // new name
      else
      {
        this.fileName = outFileName;
      }
    }//try
    catch(FileNotFoundException e)
    {
      printError("The file you specified did not already exist " +
                 "so we tried to create a new one, but were unable"+
                 "to do so.  Please try again.  If problems "+
                 "persit see your TA.", e);
    }
    catch(Exception e)
    { 
      printError("Problems writing to file: " + outFileName, e);
    }//catch
    
    
    //close the input stream, we're done writing
    try
    {
      audioInputStream.close();
    }//try
    catch(Exception e)
    {
      printError("Unable to close the Audio stream.");
    }//catch
    
  }//writeToFile(String outFileName)