STFTFrames.fromBuffers constructor

STFTFrames.fromBuffers({
  1. required int frames,
  2. required int bins,
  3. required Float32List real,
  4. required Float32List imag,
})

Builds a complex STFT result from caller-owned real and imaginary buffers.

Implementation

factory STFTFrames.fromBuffers({
  required int frames,
  required int bins,
  required Float32List real,
  required Float32List imag,
}) {
  final expectedLen = frames * bins;
  if (real.length != expectedLen || imag.length != expectedLen) {
    throw ArgumentError(
      'real/imag must both have length frames * bins ($expectedLen)',
    );
  }
  return STFTFrames._(frames, bins, real, imag);
}