Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

UnsupportedAudioFileException in AudioSystem.getAudioInputStream

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(

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(

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!
    Bookmark Topic Watch Topic
  • New Topic