Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Rhino Speech-to-Intent — iOS API


API Reference for the iOS Rhino SDK (Cocoapod)


Rhino

public 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 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.

public init(
accessKey: String,
contextPath: String,
modelPath: String? = nil,
sensitivity: Float32 = 0.5,
endpointDurationSec: Float32 = 1.0,
requireEndpoint: Bool = true) throws

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 to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false 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.

public func delete()

Rhino.process()

Process a frame of audio with the inference engine.

public func process(pcm:[Int16]) throws -> Bool

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.getInference()

Get inference result from Rhino.

public func getInference() throws -> Inference

Returns

  • Inference : An inference object.

Throws

  • RhinoError: If there is an error while getting the inference.

Rhino.frameLength

Rhino.frameLength: UInt32

The number of audio samples per frame.


Rhino.sampleRate

Rhino.sampleRate: UInt32

Audio sample rate accepted by Rhino engine.


Rhino.version

Rhino.version: String

Current Rhino version.


Inference

Class for the Rhino's inference.

public struct Inference { }

Inference.isUnderstood

Inference.isUnderstood: Bool

If true, Rhino understood the inference.


Inference.intent

Inference.intent: String

Inference intent name.


Inference.slots

Inference.slots: Dictionary<String, String>

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.

public class RhinoManager { }

RhinoManager.init()

public init(
accessKey: String,
contextPath: String,
modelPath: String? = nil,
sensitivity: Float32 = 0.5,
endpointDurationSec: Float32 = 1.0,
requireEndpoint: Bool = true,
onInferenceCallback: ((Inference) -> Void)?,
processErrorCallback: ((Error) -> Void)? = nil) throws

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 to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false 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()

public func delete()

Stops recording and releases Rhino resources.


RhinoManager.process()

public func process() throws

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

public enum RhinoManagerError: Error {}

Enums for RhinoManager error values:

  • case recordingDenied
  • case objectDisposed

RhinoError

public class RhinoError : LocalizedError { }

Error thrown if an error occurs within Rhino engine.

public class RhinoMemoryError : RhinoError {}
public class RhinoIOError : RhinoError {}
public class RhinoInvalidArgumentError : RhinoError {}
public class RhinoStopIterationError : RhinoError {}
public class RhinoKeyError : RhinoError {}
public class RhinoInvalidStateError : RhinoError {}
public class RhinoRuntimeError : RhinoError {}
public class RhinoActivationError : RhinoError {}
public class RhinoActivationLimitError : RhinoError {}
public class RhinoActivationThrottledError : RhinoError {}
public class RhinoActivationRefusedError : RhinoError {}

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Rhino Speech-to-Intent — iOS API
  • Rhino
  • init()
  • delete()
  • process()
  • getInference()
  • frameLength
  • sampleRate
  • version
  • Inference
  • isUnderstood
  • intent
  • slots
  • RhinoManager
  • init()
  • delete()
  • process()
  • RhinoManagerError
  • RhinoError
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.