Rhino Speech-to-Intent
Flutter API
API Reference for the Rhino Flutter SDK (pub.dev) .
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.contextInfo
Gets the source of the Rhino context in YAML format. Shows the list of intents, which expressions map to those intents, as well as slots and their possible values.
Rhino.frameLength
Getter for the number of audio samples per frame required by Rhino.
Rhino.sampleRate
Getter for the audio sample rate required by Rhino.
Rhino.version
Getter for Rhino version string.
Rhino.create()
Static creator for initializing Rhino.
Parameters
accessKey
String : AccessKey obtained from Picovoice Console.contextPath
String : Path to the Rhino context file (.rhn
). Can be either a path that is relative to the project'sassets
folder or an absolute path to the file on device.modelPath
String? : (Optional) Path to the file containing model parameters (.pv
). Can be either a path that is relative to the project'sassets
folder or an absolute path to the file on device. If not set it will be set to the default location.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.endpointDurationSec
double? : (Optional) Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.requireEndpoint
bool? : (Optional) If set totrue
, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set tofalse
, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set tofalse
only if operating in an environment with overlapping speech (e.g. people talking in the background).
Returns
[Rhino](#rhino)
an instance of the speech-to-intent engine.
Throws
RhinoException
: If not initialized correctly.
Rhino.process()
Process a frame of pcm audio with the Speech-to-Intent engine.
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
- RhinoInference object.
Throws
RhinoException
: If an error is encountering while processing.
Rhino.reset()
Resets the internal state of the engine. It should be called before the engine can be used to infer intent from a new stream of audio.
Throws
RhinoException
: If an error is encountered while resetting.
Rhino.delete()
Frees memory that was allocated for Rhino.
RhinoInference
Class for the Rhino's inference.
RhinoInference.isFinalized
Whether Rhino has made an inference.
RhinoInference.isUnderstood
If true, Rhino understood the inference.
RhinoInference.intent
If isUnderstood, name of intent that was inferred.
RhinoInference.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.
RhinoManager.contextInfo
Gets the source of the Rhino context in YAML format. Shows the list of intents, which expressions map to those intents, as well as slots and their possible values.
RhinoManager.frameLength
Getter for the number of audio samples per frame required by Rhino.
RhinoManager.sampleRate
Getter for the audio sample rate required by Rhino.
RhinoManager.version
Getter for Rhino version string.
RhinoManager.create()
Static creator for initializing Rhino.
Parameters
accessKey
String : AccessKey obtained from Picovoice Console.contextPath
String : Path to the Rhino context file (.rhn
). Can be either a path that is relative to the project'sassets
folder or an absolute path to the file on device.inferenceCallback
InferenceCallback : A callback for when Rhino has made an intent inference.modelPath
String? : (Optional) Path to the file containing model parameters (.pv
). Can be either a path that is relative to the project'sassets
folder or an absolute path to the file on device. If not set it will be set to the default location.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.endpointDurationSec
double? : (Optional) Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.requireEndpoint
bool? : (Optional) If set totrue
, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set tofalse
, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set tofalse
only if operating in an environment with overlapping speech (e.g. people talking in the background).processErrorCallback
ProcessErrorCallback : (Optional) Reports errors that are encountered while the engine is processing audio.
Returns
[RhinoManager](#rhinomanager)
: An instance of RhinoManager.
Throws
RhinoException
: If not initialized correctly.
RhinoManager.process()
Opens audio input stream and sends audio frames to Rhino until an inference result is sent via inference callback.
Throws
RhinoException
: If there was a problem starting the audio engine.
RhinoManager.delete()
Releases Rhino and audio resources.
InferenceCallback
Type for function that receives inference result from Rhino.
Parameters
- inference RhinoInference : Rhino's inference.
ProcessErrorCallback
Type for the error callback that occurs while processing audio.
Parameters
- error RhinoException
RhinoException
Exception thrown if an error occurs within Rhino engine: