Recording PCM-16 to a Dart Stream.

Recording PCM-16 to a Dart Stream

Please, remember that actually, Flutter Sound does not support Floating Point PCM data, nor records with more that one audio channel. On Flutter Sound, Raw PCM is only PCM-LINEAR 16 monophony

To record a Live PCM file, when calling the verb startRecorder(), you specify the parameter toStream: with you Stream sink, instead of the parameter toFile:. This parameter is a StreamSink that you can listen to, for processing the input data.

Notes :

  • This new functionnality needs, at least, an Android SDK >= 21
  • This new functionnality works better with Android minSdk >= 23, because previous SDK was not able to do UNBLOCKING write.


You can look to the simple example provided with Flutter Sound.

  IOSink outputFile = await createFile();
  StreamController<Food> recordingDataController = StreamController<Food>();
  _mRecordingDataSubscription =

            ((Uint8List buffer)
  await _mRecorder.startRecorder(
        toStream: recordingDataController.sink,
        codec: Codec.pcm16,
        numChannels: 1,
        sampleRate: 48000,

Tags: guide