Ejemplo n.º 1
0
 /**
  * This method loads a (.wav) file into a WAVData object.
  *
  * @param filename The name of the (.wav) file
  * @return a WAVData object containing the audio data
  * @throws UnsupportedAudioFileException if the format of the audio if not supported.
  * @throws IOException If the file can no be found or some other IO error occurs
  */
 public static WAVData loadFromFile(String filename)
     throws UnsupportedAudioFileException, IOException {
   WAVData result = null;
   File soundFile = new File(filename);
   AudioInputStream aIn = AudioSystem.getAudioInputStream(soundFile);
   return readFromStream(aIn);
 }
Ejemplo n.º 2
0
 /**
  * This method loads a (.wav) file into a WAVData object.
  *
  * @param stream An InputStream for the .WAV file.
  * @return a WAVData object containing the audio data
  * @throws UnsupportedAudioFileException if the format of the audio if not supported.
  * @throws IOException If the file can no be found or some other IO error occurs
  */
 public static WAVData loadFromStream(InputStream stream)
     throws UnsupportedAudioFileException, IOException {
   WAVData result = null;
   AudioInputStream aIn = AudioSystem.getAudioInputStream(stream);
   return readFromStream(aIn);
 }