acceptWaveformBytes method

Future<bool> acceptWaveformBytes(
  1. Uint8List bytes
)

Accept and process new chunk of voice data(audio data in PCM 16-bit mono format).

Implementation

Future<bool> acceptWaveformBytes(final Uint8List bytes) {
  if (_voskLibrary != null) {
    final result = using((final arena) {
      final data = bytes.toCharPtr(arena);
      return _voskLibrary.vosk_recognizer_accept_waveform(
        recognizerPointer!,
        data,
        bytes.length,
      );
    });
    return Future.value(result == 1);
  }

  return _invokeRecognizerMethod<bool>('acceptWaveForm', {
    'bytes': bytes,
  }).then((final value) => value!);
}