I've got the following problem:
I need to convert audio bytes (byte[]) from
48kHz, 16 bit, stereo, PCM signed, BIG ENDIAN
to
48kHz, 16 bit, stereo, PCM signed, LITTLE ENDIAN
in java and save it as .wav file.
List<byte[]> orderedBytes = bytesFromVoice;
/*
Here i need to sort the bytes
*/
int size = 0;
for (byte[] bs : orderedBytes) {
size += bs.length;
}
byte[] decodedData = new byte[size];
int i = 0;
for (byte[] bs : orderedBytes) {
for (int j = 0; j < bs.length; j++) {
decodedData[i++] = bs[j];
}
}
//writing to file
try {
getWavFile(getNextFile(), decodedData);
} catch (IOException exception) {
exception.printStackTrace();
}