renderMono method

void renderMono(
  1. List<double> destination, {
  2. int offset = 0,
})
Renders the waveform as a monaural signal. The audio renderer. The destination buffer.

Implementation

void renderMono(List<double> destination, {int offset = 0}) {
  int sampleCount = destination.length ~/ 2;

  sampleCount -= offset;

  List<double> left = List<double>.filled(sampleCount, 0, growable: false);
  List<double> right = List<double>.filled(sampleCount, 0, growable: false);

  render(left, right);

  for (var t = 0; t < sampleCount; t++) {
    destination[offset + t] = (left[t] + right[t]) / 2;
  }
}