Java writes bad wave files
- by Cliff
I'm writing out wave files in Java using
AudioInputStream output = new AudioInputStream(new ByteArrayInputStream(rawPCMSamples), new AudioFormat(22000,16,1,true,false), rawPCMSamples.length)
AudioSystem.write(output, AudioFileFormat.Type.WAVE, new FileOutputStream('somefile.wav'))
And I get what appears to be corrupt wave files on OSX. They won't play from Finder however using the same code behind a servlet writing directly to the response stream and setting the Content-Type to audio/wave seems to play fine in quicktime. What gives?