toMono method

Float64List toMono()

Mix the audio channels down to mono.

Implementation

Float64List toMono() {
  if (channels.isEmpty) return Float64List(0);
  final mono = Float64List(channels[0].length);
  for (int i = 0; i < mono.length; ++i) {
    for (int j = 0; j < channels.length; ++j) {
      mono[i] += channels[j][i];
    }
    mono[i] /= channels.length;
  }
  return mono;
}