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
React Native API


API Reference for the React Native Rhino SDK (npm)


Rhino

class Rhino { }

Class for the Rhino Speech-To-Intent engine.

Use this class when using a custom audio processing pipeline. Otherwise it is recommended to use the RhinoManager High-Level API, which contains integrated audio recording.

Rhino.create()

public static async create(
accessKey: string,
contextPath: string,
modelPath?: string,
sensitivity: number = 0.5,
endpointDurationSec: number = 1.0,
requireEndpoint: boolean = true
): Promise<Rhino>

Rhino constructor.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • contextPath string : Path to Rhino context file (.rhn). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • modelPath string : Optional. Path to the file containing model parameters (.pv). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • sensitivity number : Optional. Inference sensitivity. Each value should be a number within [0, 1].
  • endpointDurationSec number : 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 boolean : Optional. 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).

Returns

  • Promise<Rhino>: An instance of Rhino Speech-To-Intent engine.

Rhino.delete()

async delete()

Releases resources acquired by Rhino.


Rhino.contextInfo

get contextInfo()

Getter for Rhino context info.

Returns

  • string: Gets the source of the Rhino context in YAML format.

Rhino.frameLength

get frameLength()

Getter for number of audio samples per frame.

Returns

  • number: Number of audio samples per frame.

Rhino.sampleRate

get sampleRate()

Getter for audio sample rate accepted by Picovoice.

Returns

  • number: Audio sample rate accepted by Picovoice.

Rhino.version

get version()

Getter for version.

Returns

  • string: Current Rhino version.

Rhino.process()

async process(frame: number[]): Promise<RhinoInference>

Processes a frame of the incoming audio stream and emits the inference result. The number of samples per frame can be attained by calling .frameLength. The incoming audio needs to have a sample rate equal to .sampleRateand be 16-bit linearly-encoded. Rhino operates on single-channel audio.

Parameters

  • frame number[] : A frame of audio samples.

Returns

  • Promise<RhinoInference>: Inference result at time of frame being processed.

RhinoInference

export class RhinoInference { }

Class to contain Rhino inference data.


RhinoInference.isFinalized

get isFinalized()

Getter for the isFinalized flag.

Returns

  • boolean: If true, Rhino has made an inference.

RhinoInference.isUnderstood

get isUnderstood()

Getter for the isUnderstood flag.

Returns

  • boolean: If true, Rhino understood the intent.

RhinoInference.intent

get intent()

Getter for the inference intent name.

Returns

  • string: Inference intent name.

RhinoInference.slots

get slots()

Getter for the inference slots and values.

Returns

  • {[key: string]: string}: Map for inference slots and values.

RhinoError

class RhinoError extends Error { }

Exception thrown if an error occurs within Rhino Speech-To-Intent engine.

Exceptions:

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

RhinoManager

class RhinoManager { }

High-level React Native binding for Rhino Speech-To-Intent engine. It handles recording audio from microphone, processes it in real-time using Rhino, and notifies the client when an inference is detected.

This class offers integrated audio capture. For use-cases where there is already an audio-processing pipeline in place, use the Rhino Low-Level API.

RhinoManager.create()

public static async create(
accessKey: string,
contextPath: string,
inferenceCallback: InferenceCallback,
processErrorCallback?: ProcessErrorCallback,
modelPath?: string,
sensitivity: number = 0.5,
endpointDurationSec: number = 1.0,
requireEndpoint: boolean = true
): Promise<Rhino>

Rhino constructor.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • contextPath string : Path to Rhino context file (.rhn). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • inferenceCallback InferenceCallback : A callback for when Rhino detects the specified keywords.
  • processErrorCallback ProcessErrorCallback : Optional. A callback for when Rhino has made an intent inference.
  • modelPath string : Optional. Path to the file containing model parameters (.pv). Can be relative to the assets/resource folder or an absolute path to the file on device.
  • sensitivity number : Optional. Sensitivities for detecting keywords. Each value should be a number within [0, 1].
  • endpointDurationSec number : 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 boolean : Optional. 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).

Returns

  • Promise<Rhino>: An instance of Rhino Speech-To-Intent engine.

RhinoManager.delete()

public delete()

Releases resources acquired by RhinoManager.


RhinoManager.process()

public async process()

Starts recording audio from the microphone and tries to infer intent. When RhinoManager returns an inference result via the inferenceCallback, it will automatically stop audio capture for you. When you wish to result, call .process() again.


InferenceCallback

type InferenceCallback = (inference: RhinoInference) => void;

Callback interface invoked when an inference is finished.


ProcessErrorCallback

type ProcessErrorCallback = (error: RhinoErrors.RhinoError) => void;

Callback interface invoked when an error occurs while processing audio.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Rhino Speech-to-Intent React Native API
  • Rhino
  • create()
  • delete()
  • contextInfo
  • frameLength
  • sampleRate
  • version
  • process()
  • RhinoInference
  • isFinalized
  • isUnderstood
  • intent
  • slots
  • RhinoError
  • RhinoManager
  • create()
  • delete()
  • process()
  • InferenceCallback
  • ProcessErrorCallback
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.