renderPcmBytes method

  1. @override
Future<Int16List> renderPcmBytes({
  1. required Uint8List bytes,
  2. required WaveformDocument document,
})
override

This method renders document to 16-bit PCM from bytes that are already in memory.

Web has no filesystem, so this method is the only render path there. This method runs the same C loop as the exporter, over the same decoders. Therefore the output is byte-identical on all six targets, and not on five.

On native, when the audio is a file, renderPcm is the better choice. renderPcm streams the source. This method holds a copy of the container in memory as well.

Implementation

@override
Future<Int16List> renderPcmBytes({
  required Uint8List bytes,
  required WaveformDocument document,
}) async {
  byteRenders.add((bytes.length, document));
  return renderPcm(sourcePath: '${bytes.length} bytes', document: document);
}