tags:

views:

529

answers:

3

I'm reading a .wav file into a byte array with the following code.

AudioInputStream inputStream = 
    AudioSystem.getAudioInputStream(/*my .wav file */);
int numBytes = inputStream.available();
byte[] buffer = new byte[numBytes];
inputStream.read(buffer, 0, numBytes);
inputStream.close();

Is there a simple way to remove the .wav headers either before or after reading into the byte array?

A: 

Is a wav file header a fixed size? If so inputStream.skip?

mlk
A: 

If correct the .wav header is 44 bytes long, so skip/remove the first 44 and there you have it.

Don't know for sure though.

MrThys
+1  A: 

Here is a good reference on the wave file format.

daveb
you have to identify the chunks and remove the headers.
Peter Kofler