Rhino Speech-to-Intent
iOS API
API Reference for the iOS Rhino SDK (Cocoapod)
Rhino
Class for the Rhino Speech-to-Intent engine. Rhino can be initialized either using the
High-level RhinoManager() Class or directly using the class constructor. Resources should
be cleaned when you are done using the delete()
function.
Rhino.init()
init
methods for the Rhino Speech-to-Intent engine.
Parameters
accessKey
String : The AccessKey obtained from Picovoice Console.contextPath
String : Absolute path to file containing context parameters (.rhn
). A context represents the set of expressions (spoken commands), intents, and intent arguments (slots) within a domain of interest.modelPath
String? : Absolute path to file containing model parameters (.pv
).sensitivity
Float32 : Inference sensitivity. Each value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.endpointDurationSec
Float32 : 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 : 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).
Throws
RhinoError
: If an error occurs while creating an instance of Rhino Speech-to-Intent engine.
Rhino.delete()
Releases resources acquired by the Rhino engine.
Rhino.process()
Process a frame of audio with the inference engine.
Parameters
pcm
[Int16] : An array of 16-bit pcm samples.
Returns
- Bool : A boolean indicating whether Rhino has a result ready or not.
Throws
RhinoError
: If there is an error while processing the audio frame.
Rhino.reset()
Resets the internal state of Rhino. It should be called before the engine can be used to infer intent from a new stream of audio.
Throws
RhinoError
: If there is an error while resetting.
Rhino.getInference()
Get inference result from Rhino.
Returns
- Inference : An inference object.
Throws
RhinoError
: If there is an error while getting the inference.
Rhino.contextInfo
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
The number of audio samples per frame.
Rhino.sampleRate
Audio sample rate accepted by Rhino engine.
Rhino.version
Current Rhino version.
Inference
Class for the Rhino's inference.
Inference.isUnderstood
If true, Rhino understood the inference.
Inference.intent
Inference intent name.
Inference.slots
Dictionary for inference slots and values.
RhinoManager
A High-level iOS binding for Rhino
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.init()
Parameters
accessKey
String : The AccessKey obtained from Picovoice Console.contextPath
String : Absolute path to file containing context parameters (.rhn
). A context represents the set of expressions (spoken commands), intents, and intent arguments (slots) within a domain of interest.modelPath
String? : Absolute path to file containing model parameters (.pv
).sensitivity
Float32 : Inference sensitivity. Each value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.endpointDurationSec
Float32 : 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 : 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).onInferenceCallback
((Inference) -> Void)? : It is invoked upon completion of intent inference.errorCallback
((Error) -> Void)? = nil) : Invoked if an error occurs while processing frames. If missing, error will be printed to console.
Throws
RhinoError
: If an error occurs while creating an instance of Rhino engine.
RhinoManager.delete()
Stops recording and releases Rhino resources.
RhinoManager.process()
Start recording audio from the microphone and infers the user's intent from the spoken command. Once the inference is finalized it will invoke the user provided callback and terminates recording audio.
Throws
RhinoError
: if microphone permission is not granted or Rhino has been disposed.
RhinoManagerError
Enums for RhinoManager error values:
case recordingDenied
case objectDisposed
RhinoError
Error thrown if an error occurs within Rhino engine.