Cheetah - Flutter API
API Reference for the Flutter Cheetah SDK (pub.dev)
Cheetah
class Cheetah { }
Class for the Cheetah Speech-to-Text engine. Cheetah can be initialized using the creator.
Resources should be cleaned when you are done using the delete()
function.
Cheetah.create()
Static creator for initializing Cheetah.
static Future<Cheetah> create(String accessKey,String modelPath,{double endpointDuration = 1})
Parameters
accessKey
String : AccessKey obtained from Picovoice Console.modelPath
String : Path to the file containing model parameters.endpointDuration
bool? : (Optional) Duration of endpoint in seconds. A speech endpoint is detected when there is a chunk of audio (with a duration specified herein) after an utterance without any speech in it. Set duration to 0 to disable this. Default is 1 second.
Returns
Future<Cheetah>
an instance of the speech-to-text engine.
Throws
CheetahException
: If not initialized correctly.
Cheetah.process()
Process a frame of pcm audio with the speech-to-text engine.
Future<CheetahTranscript> process(List<int>? frame)
Parameters
frame
List<int> : a frame of audio samples to be assessed by Cheetah. The required audio format is found by calling.sampleRate
to get the required sample rate and.frameLength
to get the required frame size. Audio must be single-channel and 16-bit linearly-encoded.
Returns
Future<CheetahTranscript>
: Inferred transcription object.
Throws
CheetahException
: If process fails.
Cheetah.flush()
Processes any remaining audio data and returns its transcription.
Future<CheetahTranscript> flush()
Returns
Future<CheetahTranscript>
: Inferred transcription object.
Throws
CheetahException
: If process fails.
Cheetah.delete()
Frees memory that was allocated for Cheetah
Future<void> delete()
Cheetah.frameLength
int get frameLength
Getter for the number of audio samples per frame required by Cheetah.
Cheetah.sampleRate
int get sampleRate
Getter for the audio sample rate required by Cheetah.
Cheetah.version
String get version
Getter for Cheetah version string.
CheetahTranscript
class CheetahTranscript
Class that contains Cheetah transcript data.
CheetahTranscript.transcript
String get transcript
Getter for transcript data.
CheetahTranscript.isEndpoint
bool get isEndpoint
Getter for isEndpoint
flag.
CheetahException
class CheetahException implements Exception { }
Exception thrown if an error occurs within Cheetah:
class CheetahMemoryException extends CheetahException { }class CheetahIOException extends CheetahException { }class CheetahInvalidArgumentException extends CheetahException { }class CheetahStopIterationException extends CheetahException { }class CheetahKeyException extends CheetahException { }class CheetahInvalidStateException extends CheetahException { }class CheetahRuntimeException extends CheetahException { }class CheetahActivationException extends CheetahException { }class CheetahActivationLimitException extends CheetahException { }class CheetahActivationThrottledException extends CheetahException { }class CheetahActivationRefusedException extends CheetahException { }