samedi 27 décembre 2014

Keep getting the same byte array from an audio record android

I am new to android development, started a small project to record audio data and acquire the byte array from the audio record file. I am using the following code which I found:



ByteArrayOutputStream buffer = new ByteArrayOutputStream();
//outputFile is the path to the file
File aFile = new File(outputFile);
InputStream is = new FileInputStream(aFile);
byte[] temp = new byte[1024];
int read;

while((read = is.read(temp)) >= 0){
buffer.write(temp, 0, read);
}

byte[] data = buffer.toByteArray();


after examining the byte array I saw that some of the first bytes are equal to other recording I have done. How is that possible?


Aucun commentaire:

Enregistrer un commentaire