You can have an array of bytes like:
List<Byte> arrays = new ArrayList<Byte>();
To convert it to arrays
Byte[] soundBytes = arrays.toArray(new Byte[arrays.size()]);
(Then you will need to write a converter to convert Byte[] to Byte[] ).
EDIT: You are using List<Byte> incorrectly, I will just show you how to read AudioInputStream simply with ByteArrayOutputStream .
AudioInputStream ais = ....; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int read; while((read = ais.read()) != -1) { baos.write(read); } byte[] soundBytes = baos.toByteArray();
PS An IOException is frameSize if frameSize not 1 . Therefore, use a byte buffer to read data, for example:
AudioInputStream ais = ....; ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int bytesRead = 0; while((bytesRead = ais.read(buffer)) != -1) { baos.write(buffer, 0, bytesRead); } byte[] soundBytes = baos.toByteArray();
source share