Audio: Change Volume of samples in byte array
I'm reading a wav-file to a byte array using this method (shown below) . Now that I have it stored inside my byte array, I want to change the sounds volume. private byte[] getAudioFileData(final String filePath) { byte[] data = null; try { final ByteArrayOutputStream baout = new ByteArrayOutputStream(); final File file = new File(filePath); final AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(file); byte[] buffer = new byte[4096]; int c; while ((c = audioInputStream.read(buffer, 0, buffer.length)) != -1) { baout.write(buffer, 0, c); } audioInputStream.close(); baout.close(