Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Hey there,
I was just reading Dan Becker's old article about reading MP3 files and couldn't get it to work. I downloaded his demo code and JLayer 1.0.1 and here's the command line I used:
java -cp ../MP3.jar:../../JLayer1.0.1/jl1.0.1.jar:. Play path/to/audio.mp3
But it gave me this error:
Problem with file path/to/audio.mp3:
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1170)
at Play.playAudioFile(Play.java:48)
at Play.main(Play.java:35)I tried itterating all types like this:
AudioFileFormat.Type types[] = AudioSystem.getAudioFileTypes();
for( int i=0; i<types.length; ++i )
System.out.println( "Available Type: " + types[i] );and it did not print out MP3:
Available Type: AU
Available Type: AIFF
Available Type: WAVE
I'm using mac OS X 10.4 and java 5. Thanks for any tips!
bjorn