Win a copy of Spark in Action this week in the Open Source Projects 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

UnsupportedAudioFileException in AudioSystem.getAudioInputStream

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(

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