Java - What do the Bytes Recieved by Reading from an AudioInputStream Correspond to?

208 Views Asked by At

Can someone explain what the bytes you get by reading an AudioInputStream correspond to? Things like volume or frequency/pitch. I have this code that reads the bytes from the entire file.

int BUFFER_SIZE = 1024;
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
byte[] bytesBuffer = new byte[BUFFER_SIZE];
int bytesRead = -1;
while ((bytesRead = audioStream.read(bytesBuffer)) != -1) {
  for(byte b:bytesBuffer)
    System.out.print(b+" ");
  System.out.println();
}

Currently I am trying to get the maximum volume in the sound file I have. It is a 16 bit PCM wav file.

0

There are 0 best solutions below