encode method
Owned features.encoderTokens, config.projectionSize projected rows.
capture receives owned copies of intermediate rows for parity checks.
Implementation
Float32List encode(
AudioFeatures features, {
void Function(String stage, Float32List rows)? capture,
}) {
if (_closed) throw StateError('Audio encoder is closed');
if (features.frames <= 0 ||
features.melBins != config.melBins ||
features.values.length != features.frames * config.melBins ||
features.values.any((x) => !x.isFinite)) {
throw ArgumentError('expected nonempty finite LFM3-Audio features');
}
return _encodeRows(
_downsample(features),
features.encoderTokens,
capture: capture,
);
}