I think Riven is probably right. There are lots of .wav variants, including things like 16-bit vs 32-bit, as well as the little vs big endian issue.
I just ran a program through the Eclipse debugger, based upon the info in the tutorial, inspecting the supported formats of a LineInfo object, and see 8 variants:
BigEndian = false, PCM_UNSIGNED, channels = 1, bits = 8
BigEndian = false, PCM_SIGNED, channels = 1, bits = 8
BigEndian = false, PCM_SIGNED, channels = 1, bits = 16
BigEndian = true, PCM_SIGNED, channels = 1, bits = 16
BigEndian = false, PCM_UNSIGNED, channels = 2, bits = 8
BigEndian = false, PCM_SIGNED, channels = 2, bits = 8
BigEndian = false, PCM_SIGNED, channels = 2, bits = 16
BigEndian = true, PCM_SIGNED, channels = 2, bits = 16
I haven’t run this through all my AudioSystem “Mixers” though, but I’m guessing this list is standard for what is supported.
Perhaps the following will help to inspect the format of the wav file you are trying to play?
InputStream inStream =
PlayASourceDataLine.class.getResourceAsStream("MySound.wav");
AudioInputStream aiStream =
AudioSystem.getAudioInputStream(inStream);
AudioFormat audioFmt = aiStream.getFormat();
DataLine.Info info = new DataLine.Info(SourceDataLine.class,
audioFmt);
System.out.println(info);