Workaround for UnsupportedAudioFileException ?

Posted by tschan on Stack Overflow See other posts from Stack Overflow or by tschan
Published on 2010-05-16T13:08:41Z Indexed on 2010/05/16 13:30 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

I'm in a very early stage of writing a small music/rhythm game in Java (via Slick framework, which in turns uses OpenAL, but that's probably irrelevant here). The game needs to read (and playback) several sound files in WAV format, but some of the files are throwing [javax.sound.sampled.UnsupportedAudioFileException] exceptions.

at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102)
at org.newdawn.slick.openal.WaveData.create(WaveData.java:123)
at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:713)
at org.newdawn.slick.openal.SoundStore.getWAV(SoundStore.java:683)
at org.newdawn.slick.Sound.<init>(Sound.java:33)

The files can be played back just fine in Winamp or Foobar2000, so this means Java just don't recognize some variants of the file format. What are my options at this point?

Note: The files in question are user-supplied, so i cannot just convert them beforehand (using something like audacity). Any conversion steps must be done at runtime.

© Stack Overflow or respective owner

Related posts about java

Related posts about wav