flutterRhino - Flutter API

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


Rhino

class Rhino { }

Class for the Rhino Speech-to-Intent engine. Rhino can be initialized either using the High-level RhinoManager() Class or directly using the creator. Resources should be cleaned when you are done using the delete() function.


Rhino.version

String get version

Getter for Rhino version string.


Rhino.frameLength

int get frameLength

Getter for the number of audio samples per frame required by Rhino.


Rhino.sampleRate

int get sampleRate

Getter for the audio sample rate required by Rhino.


Rhino.create()

Static creator for initializing Rhino.

static Future<Rhino> create(String accessKey, String contextPath,
{String? modelPath,
double sensitivity = 0.5,
bool requireEndpoint = true})

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • contextPath String : Absolute path to the Rhino context file (.rhn).
  • modelPath String? : (Optional) Path to the file containing model parameters. If not set it will be set to the default location (.pv).
  • sensitivity double : (Optional) Inference sensitivity. A higher sensitivity value results in fewer misses at the cost of (potentially) increasing the erroneous inference rate. Sensitivity should be a floating-point number within 0 and 1.
  • requireEndpoint bool : (Optional) Boolean variable to indicate if Rhino should wait for a chunk of silence before finishing inference.

Returns

  • [Rhino](#rhino) an instance of the speech-to-intent engine.

Throws


Rhino.process()

Process a frame of pcm audio with the Speech-to-Intent engine.

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

Parameters

  • frame List<int>? : a frame of audio samples to be assessed by Rhino. 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


Rhino.delete()

Frees memory that was allocated for Rhino.

Future<void> delete()

RhinoInference

Class for the Rhino's inference.

class RhinoInference { }

RhinoInference.isFinalized

bool get isFinalized

Whether Rhino has made an inference.


RhinoInference.isUnderstood

bool? get isUnderstood

If true, Rhino understood the inference.


RhinoInference.intent

String? get intent

If isUnderstood, name of intent that was inferred.


RhinoInference.slots

Map<String, String>? get slots

If isUnderstood, dictionary of slot keys and values that were inferred.


RhinoManager

Manager for creating an instance of Rhino. A High-level Flutter binding for Rhino Speech-to-Intent engine that handles recording audio from microphone, processes it in real-time using Rhino, and notifies the client when an intent is inferred from the spoken command.

class RhinoManager { }

RhinoManager.create()

Static creator for initializing Rhino.

static Future<RhinoManager> create(
String accessKey, String contextPath, InferenceCallback inferenceCallback,
{String? modelPath,
double sensitivity = 0.5,
bool requireEndpoint = true,
ProcessErrorCallback? processErrorCallback}
)

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • contextPath String : Absolute path to the Rhino context file (.rhn).
  • inferenceCallback InferenceCallback : A callback for when Rhino has made an intent inference.
  • modelPath String? : (Optional) Path to the file containing model parameters. If not set it will be set to the default location (.pv).
  • sensitivity double : (Optional) Inference sensitivity. A higher sensitivity value results in fewer misses at the cost of (potentially) increasing the erroneous inference rate. Sensitivity should be a floating-point number within 0 and 1.
  • requireEndpoint bool : (Optional) Boolean variable to indicate if Rhino should wait for a chunk of silence before finishing inference.
  • processErrorCallback ProcessErrorCallback : (Optional) Reports errors that are encountered while the engine is processing audio.

Returns

  • [RhinoManager](#rhinomanager) : An instance of RhinoManager.

Throws


RhinoManager.process()

Opens audio input stream and sends audio frames to Rhino until an inference result is sent via inference callback.

Future<void> process()

Throws


RhinoManager.delete()

Releases Rhino and audio resources.

Future<void> delete()

InferenceCallback

Type for function that receives inference result from Rhino.

typedef InferenceCallback = Function(RhinoInference inference);

Parameters


ProcessErrorCallback

Type for the error callback that occurs while processing audio.

typedef ProcessErrorCallback = Function(RhinoException error);

Parameters


RhinoException

class RhinoException implements Exception { }

Exception thrown if an error occurs within Rhino engine:

class RhinoMemoryException extends RhinoException { }
class RhinoIOException extends RhinoException { }
class RhinoInvalidArgumentException extends RhinoException { }
class RhinoStopIterationException extends RhinoException { }
class RhinoKeyException extends RhinoException { }
class RhinoInvalidStateException extends RhinoException { }
class RhinoRuntimeException extends RhinoException { }
class RhinoActivationException extends RhinoException { }
class RhinoActivationLimitException extends RhinoException { }
class RhinoActivationThrottledException extends RhinoException { }
class RhinoActivationRefusedException extends RhinoException { }


Issue with this doc? Please let us know.