flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[enh] FFI for streams

Open imoldfella opened this issue 5 years ago • 4 comments
trafficstars

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.

imoldfella avatar Nov 02 '20 21:11 imoldfella

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 avatar Nov 03 '20 02:11 imoldfella

@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 ...

Larpoux avatar Nov 03 '20 09:11 Larpoux

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

Larpoux avatar Dec 28 '20 09:12 Larpoux

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.

github-actions[bot] avatar Dec 21 '23 01:12 github-actions[bot]