Please use javax.sound.sampled.AudioInputStream to read in bytes
This is an InputStream which is specialized for reading audio files. In particular, it only allows operations to act on a multiple of the audio stream's frame size.
File file = new File("audio.wav");
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file);
byte[] audioData = new byte[(int) file.length()];
audioInputStream.read(audioData);
OR FileInputStream
:
A FileInputStream obtains input bytes from a file in a file system. What files are available depends on the host environment.
FileInputStream is meant for reading streams of raw bytes such as image data. For reading streams of characters, consider using FileReader.
File file = new File("audio.wav");
FileInputStream inputStream = new FileInputStream(file);
byte[] bytes = inputStream.readAllBytes();//Read