• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UnsupportedAudioFileException in AudioSystem.getAudioInputStream

Emily Hart
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have been trying to get my application to play .wav files, but I have been running into trouble. Specifically, when I run the lines
I get a
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1170)

The File object should be OK because file.isFile() returns true and file.getAbsoluteFile() returns the expected file path.

When I play the actual file with a media player (Totem Movie Player), it plays with no problem.

A more complete version of my code is below:

I also tried running this code with a .au file, and it failed with:
java.lang.IllegalArgumentException: No line matching interface Clip supporting format ULAW 8012.0 Hz, 8 bit, mono, 1 bytes/frame, is supported.
at javax.sound.sampled.AudioSystem.getLine(AudioSystem.java:459)

To be clear, I do not need to get .au files working for my app, but I thought it might be helpful that the line of code that is problematic for .wav files is not for .au files.

When I run the following code:

I get the printout:

I have found numerous pieces of similar example code online, which seem to expect AudioSystem.getAudioInputStream to not throw an error. This makes me think that maybe the problem has something to do with my setup rather than my code. I am running Ubuntu 9.04 with Java SE 6.

Any help is much appreciated. Thanks!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic