flutter_sound
flutter_sound copied to clipboard
[enh] FFI for streams
At least on my Android tablet the recorded data is being sent unaligned (offset 49 in the buffer to be exact). This is a significant performance loss to realign the data in order to process it. It was also quite surprising and took a while to figure out why the data was mangled so I would consider this a usability improvement as well.
await _mMic.startRecorder(
toStream: recordingDataController.sink,
codec: Codec.pcm16,
numChannels: 1,
sampleRate: SAMPLE_RATE,
);
Thanks for considering. I did dig through the Java a little bit and may dig a little more, but I haven't really grokked the dart <-> java thing yet.
Digging into this, it seems that flutter doesn't support short[] as a channel data type https://flutter.dev/docs/development/platform-integration/platform-channels How would you feel about passing as long[] with a separate parameter for the actual length? Not sure its relevant, but I always get a divisible by 4 number of samples anyway.
@imoldfella , thank you very much for all your investigations on Recording to Stream.
I am not sure actually to understand everything, but I will study your post very carefully. Recording to Stream is a new feature for Flutter Sound, and I really want that it will work perfectly. I consider this feature as very, very important ...
In a future version, the input Streams and output Streams will be handled with FFI instead of Flutter Channels. The performance will be really improved.
Registered in the Flutter Sound Project
This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.