Reputation: 31
I'm using AudioRecord.read(byte[], int, int)
to record 16-bit PCM data. Using this method, I can get little endian data on my device but I don't know if it works on other devices. Although I saw API reference, I couldn't figure it out.
Does endian depend on native order?
Upvotes: 1
Views: 282
Reputation: 1891
Unfortunately it is not as simple as the previous (3 year old) answer suggests.
If you use 16bit PCM, Android will have it native endian encoded. See AudioFormat. Testing showed that on a Nexus 5x it was BE, a Xiaomi MI3s reported LE.
To get the endianess of your device you can use ByteOrder.nativeOrder()
Upvotes: 0
Reputation: 9286
You don't have to worry about it, Android take care of it for you.
Data in java is always represented as big endian
Upvotes: 1