I am reading a wav file through AudioInputStream into a byte array,
AudioInputStream audiofile = AudioSystem.getAudioInputStream(f);
byte[] audio=new byte[numberofframes*framesize];
int bytes=audiofile.read(audio);
do I need to arrange the bytes of a sample considering that the data is arranged in little endian or does the AudioInputStream do it for me?
Big- versus little-endian matters if the data is encoded in more than a single byte, e.g., bit depths of 16 or more, regardless of the number of channels. Java does not automatically arrange the PCM bytes in a default order, it just accepts them.
The following is the clearest, best written single section of the java audio tutorials, imho, and covers issues pertaining to formats and their conversions:
http://docs.oracle.com/javase/tutorial/sound/converters.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With