process method

Future<LeopardTranscript> process(
  1. List<int>? frame
)

Process a frame of pcm audio with the speech-to-text engine.

frame frame of 16-bit integers of 16kHz linear PCM mono audio.

returns LeopardTranscript object which contains the transcription results of the engine.

Implementation

Future<LeopardTranscript> process(List<int>? frame) async {
  try {
    Map<String, dynamic> result = Map<String, dynamic>.from(await _channel
        .invokeMethod(_NativeFunctions.PROCESS.name,
            {'handle': _handle, 'frame': frame}));

    return _pluginResultToLeopardTranscript(result);
  } on PlatformException catch (error) {
    throw leopardStatusToException(error.code, error.message);
  } on Exception catch (error) {
    throw LeopardException(error.toString());
  }
}