I\'m using AudioRecord to record 16 bit PCM data in android. After recording the data and saving it to a file, I read it back to save it as .wav file.
The problem is
As Ronald Kunenborg correctly states the problem is the Litte Endian / Big Endian conversion.
The simplest way is to write a short helper like this:
public static void writeShortLE(DataOutputStream out, short value) {
out.writeByte(value & 0xFF);
out.writeByte((value >> 8) & 0xFF);
}
This is very helpful if you record audio to a wave file with Android and you're in need of the short array, too.
(Credits: https://stackoverflow.com/a/1394839/1686216)