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 — Web API


API Reference for the Rhino Web SDK (npmjs).


Rhino

class Rhino {}

Class for the Rhino Speech-to-Intent engine.


Rhino.create()

static async function create(
accessKey: string,
context: RhinoContext,
inferenceCallback: InferenceCallback,
model: RhinoModel,
options: RhinoOptions = {}
): Promise<Rhino> {

Creates an instance of the Rhino Speech-to-Intent engine. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • context RhinoContext : Object containing Rhino context data.
  • inferenceCallback InferenceCallback : User-defined callback invoked upon processing a frame of audio.
  • model RhinoModel : Object containing Rhino model data.
  • options RhinoOptions : Optional configuration arguments.

Returns

  • Rhino : An instance of the Rhino engine.

Rhino.process()

async function process(pcm: Int16Array): Promise<void>

Processes a frame of audio. The required sample rate can be retrieved from .sampleRate and the length of frame (number of audio samples per frame) can be retrieved from .frameLength. The audio must be single-channel and 16-bit linearly-encoded. Detected inferences are returned via the inferenceCallback callback.

Parameters

  • pcm Int16Array : A frame of audio.

Rhino.reset()

async function reset(): Promise<void>

Resets the internal Rhino state.


Rhino.release()

async function release(): Promise<void>

Releases resources acquired by the Rhino Web SDK.


Rhino.contextInfo

get contextInfo(): number

Stores 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

get framelength(): number

Number of audio samples per frame.


Rhino.sampleRate

get sampleRate(): number

Audio sample rate accepted by Rhino.


Rhino.version

get version(): string

Rhino version string.


RhinoWorker

class RhinoWorker {}

Class for creating instances of the RhinoWorker.


RhinoWorker.create()

static async function create(
accessKey: string,
context: RhinoContext,
inferenceCallback: InferenceCallback,
model: RhinoModel,
options: RhinoOptions = {}
): Promise<RhinoWorker> {

Creates a worker instance of the RhinoWorker using a base64'd string of the model file. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • context RhinoContext : Object containing Rhino context data.
  • inferenceCallback InferenceCallback : User-defined callback invoked upon processing a frame of audio.
  • model RhinoModel : Object containing Rhino model data.
  • options RhinoOptions : Optional configuration arguments.

Returns

  • RhinoWorker : An instance of RhinoWorker.

RhinoWorker.process()

function process(pcm: Int16Array): void

Processes a frame of audio. The required sample rate can be retrieved from .sampleRate and the length of frame (number of audio samples per frame) can be retrieved from .frameLength. The audio must be single-channel and 16-bit linearly-encoded. Detected inferences are returned via the inferenceCallback callback.

Parameters

  • pcm Int16Array : A frame of audio.

RhinoWorker.reset()

async function reset(): Promise<void>

Resets the internal Rhino state.


RhinoWorker.release()

function release(): Promise<void>

Releases resources acquired by the Rhino Web SDK.


RhinoWorker.terminate()

function release(): Promise<void>

Terminates the active worker. Stops all requests being handled by worker.


RhinoWorker.contextInfo

get contextInfo(): number

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


RhinoWorker.frameLength

get framelength(): number

Number of audio samples per frame.


RhinoWorker.sampleRate

get sampleRate(): number

Audio sample rate accepted by Rhino.


RhinoWorker.version

get version(): string

Rhino version string.


InferenceCallback

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

Type defining the interface for the user-defined inferenceCallback used to receive inference results from the Rhino engine.

Parameters

  • inference RhinoInference : Inference data.

RhinoInference

type RhinoInference = {
isFinalized: boolean
isUnderstood?: boolean
intent?: string
slots?: Record<string, string>
}

Type containing inference result data returned from the Rhino engine.

Parameters

  • isFinalized boolean : When true, Rhino has concluded the inference.
  • isUnderstood boolean : If isFinalized, indicates if the intent was understood based on the context.
  • intent string : If isUnderstood, the name of the intent that was inferred.
  • slots Record<string, string> : If isUnderstood, a map of the slot keys and values that were inferred.

RhinoContext

type PvModel = {
base64?: string;
publicPath?: string;
customWritePath?: string;
forceWrite?: boolean;
version?: number;
};
type RhinoContext = PvModel & {
sensitivity?: number;
};

Type representing a context created using the Picovoice Console. One of base64 or publicPath must be specified.

Parameters

  • base64 string : Optional. Base64 representation of a trained Rhino context (.rhn file).
  • publicPath string : Optional. The Rhino context (.rhn file) path relative to the public directory.
  • customWritePath string : Optional. Custom path to save the model in storage.
  • forceWrite boolean : Optional. A flag that indicates whether to overwrite the context in storage even if it exists.
  • version number : Optional. Version of file in storage. Set to a higher number to update the model file.
  • sensitivity number : Optional. Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity value results in fewer misses at the cost of (potentially) increasing the erroneous inference rate.

RhinoModel

type PvModel = {
base64?: string;
publicPath?: string;
customWritePath?: string;
forceWrite?: boolean;
version?: number;
};
type RhinoModel = PvModel;

Type representing a context created using the Picovoice Console. One of base64 or publicPath must be specified.

Parameters

  • base64 string : Optional. Base64 representation of a Rhino parameter model (.pv file).
  • publicPath string : Optional. The Rhino parameter model (.pv file) path relative to the public directory.
  • customWritePath string : Optional. Custom path to save the model in storage.
  • forceWrite boolean : Optional. A flag that indicates whether to overwrite the context in storage even if it exists.
  • version number : Optional. Version of file in storage. Set to a higher number to update the model file.

RhinoOptions

type RhinoOptions = {
endpointDurationSec?: number;
requireEndpoint?: boolean;
processErrorCallback?: (error: string) => void;
};

Type containing optional arguments used then creating an instance of Rhino.

Parameters

  • 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 preemptively 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).
  • processErrorCallback (error: string) => void : Optional. Callback invoked if an error is encountered when calling .process().

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Rhino Speech-to-Intent — Web API
  • Rhino
  • create()
  • process()
  • reset()
  • release()
  • contextInfo
  • frameLength
  • sampleRate
  • version
  • RhinoWorker
  • create()
  • process()
  • reset()
  • release()
  • terminate()
  • contextInfo
  • frameLength
  • sampleRate
  • version
  • InferenceCallback
  • RhinoInference
  • RhinoContext
  • RhinoModel
  • RhinoOptions
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.