flutterLeopard - Flutter API

API Reference for the Flutter Leopard SDK (pub.dev)


Leopard

class Leopard { }

Class for the Leopard Speech-to-Text engine. Leopard can be initialized using the creator. Resources should be cleaned when you are done using the delete() function.


Leopard.create()

Static creator for initializing Leopard.

static Future<Leopard> create(
String accessKey,
String modelPath)

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • modelPath String : Path to the file containing model parameters.

Returns

Throws


Leopard.process()

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

Future<String> process(List<int>? frame)

Parameters

  • frame List<int> : a frame of audio samples to be assessed by Leopard. The required audio format is found by calling .sampleRate to get the required sample rate. Audio must be single-channel and 16-bit linearly-encoded.

Returns

  • Future<String>: Inferred transcription.

Throws


Leopard.processFile()

Processes given audio data and returns its transcription.

Future<String> processFile(String path)

Parameters

  • path String : Absolute path to the audio file. The file needs to have a sample rate equal to or greater than Leopard.sampleRate. The supported formats are: FLAC, MP3, Ogg, Opus, Vorbis, WAV, and WebM.

Returns

  • Future<String>: Inferred transcription.

Throws


Leopard.delete()

Frees memory that was allocated for Leopard

Future<void> delete()

Leopard.sampleRate

int get sampleRate

Getter for the audio sample rate required by Leopard.


Leopard.version

String get version

Getter for Leopard version string.


LeopardException

class LeopardException implements Exception { }

Exception thrown if an error occurs within Leopard:

class LeopardMemoryException extends LeopardException { }
class LeopardIOException extends LeopardException { }
class LeopardInvalidArgumentException extends LeopardException { }
class LeopardStopIterationException extends LeopardException { }
class LeopardKeyException extends LeopardException { }
class LeopardInvalidStateException extends LeopardException { }
class LeopardRuntimeException extends LeopardException { }
class LeopardActivationException extends LeopardException { }
class LeopardActivationLimitException extends LeopardException { }
class LeopardActivationThrottledException extends LeopardException { }
class LeopardActivationRefusedException extends LeopardException { }


Issue with this doc? Please let us know.