anarchuser / mic_stream

Flutter plugin to get an infinite audio stream from the microphone
https://pub.dev/packages/mic_stream
GNU General Public License v3.0
100 stars 68 forks source link

Android PCM 16 Bit switched from big-endian to little-endian after upgrade #81

Closed DurandA closed 11 months ago

DurandA commented 11 months ago

Hi @anarchuser and thank you for the great work on this plugin.

I noticed that after upgrading from 0.6.4 to 0.7.1 the endianness of the PCM-16 recordings switched from big-endian to little-endian. To the best of my knowledge, endianness is always little-endian on Android so ByteOrder.nativeOrder() is consistently ByteOrder.LITTLE_ENDIAN. I expected the changes in endianness was changed in a3c1ddb42db94ba17aef5ae32f7fb6addec1b12e but from reading the diff I don't think it changes the endianness of the underlying data. This is also discussed in https://github.com/anarchuser/mic_stream/issues/75. I did not try the latest version on iOS yet but it used big-endian on 0.6.4.

Would settling on a consistent endianness and documenting it be accepted as a PR?

As a side note, sorry for the lack of news on https://github.com/anarchuser/mic_stream/issues/69. I am only upgrading to the new version now.

DurandA commented 11 months ago

I am not now sure 100% that the endianness changed. I got messed audio, changed the endianness which temporarily fixed the issue but it doesn't work anymore. Closing this for now until I understand the problem.

anarchuser commented 11 months ago

Either way, there should probably be another method to get the native endianness