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


API Reference for the Java Rhino SDK (rhino-java)

package: ai.picovoice.rhino


Rhino

public class Rhino { }

Class for the Rhino Speech-to-Intent engine.

Rhino can be initialized using the Rhino.Builder Class. Resources should be cleaned when you are done using the delete() function.


Rhino.Rhino()

public Rhino(
String accessKey,
String libraryPath,
String modelPath,
String contextPath,
float sensitivity,
float endpointDurationSec,
boolean requireEndpoint) throws RhinoException

Rhino constructor. See also the Rhino.Builder Class.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • libraryPath String : Absolute path to the native Rhino library.
  • modelPath String : Absolute path to the file containing model parameters.
  • contextPath String : Absolute path to file containing context parameters.
  • sensitivity float : 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.
  • endpointDurationSec float : 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 : 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

  • Rhino: An instance of the Rhino Speech-to-Intent engine.

Throws

  • RhinoException: If an error occurs while creating an instance of the Rhino Speech-to-Intent engine.

Rhino.delete()

public void delete()

Releases resources acquired by Rhino.


Rhino.getFrameLength()

public int getFrameLength()

Getter for number of audio samples per frame.

Returns

  • int: Number of audio samples per frame.

Rhino.getSampleRate()

public int getSampleRate()

Getter for audio sample rate accepted by Picovoice.

Returns

  • int: Audio sample rate accepted by Picovoice.

Rhino.getVersion()

public String getVersion()

Getter for version.

Returns

  • String: Current Rhino version.

Rhino.getContextInformation()

public String getContextInformation()

Getter for context information.

Returns

  • String: Returns the context information.

Rhino.process()

public boolean process(short[] pcm) throws RhinoException

Processes a frame of the incoming audio stream and emits a flag indicating if the inference is finalized. The number of samples per frame can be attained by calling getFrameLength(). The incoming audio needs to have a sample rate equal to getSampleRate() and be 16-bit linearly-encoded. Rhino operates on single-channel audio.

Parameters

  • pcm short[] : A frame of audio samples.

Returns

  • boolean: Flag indicating whether the engine has finalized intent extraction.

Throws

  • RhinoException: If there is an error while processing the audio frame.

Rhino.getInference()

public RhinoInference getInference() throws RhinoException

Gets inference result. If the spoken command was understood, it includes the specific intent name that was inferred, and (if applicable) slot keys and specific slot values. Should only be called after the process() function returns true, otherwise Rhino has not yet reached an inference conclusion.

Returns

  • RhinoInference: The result of inference.

Throws

  • RhinoException: If inference retrieval fails.

Rhino.Builder

public static class Builder { }

Builder for creating an instance of Rhino with a mixture of default arguments.


Rhino.Builder.build()

public Rhino build() throws RhinoException

Creates an instance of Rhino Speech-to-Intent engine.

Returns

  • Rhino: An instance of Rhino Speech-to-Intent engine.

Throws

  • RhinoException: If an error occurs while creating an instance of Rhino Speech-to-Intent engine.

Rhino.Builder.setAccessKey()

public Rhino.Builder setAccessKey(String accessKey)

Sets the AccessKey to the builder.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

Rhino.Builder.setContextPath()

public Rhino.Builder setContextPath(String contextPath)

Sets the context path to the builder.

Parameters

  • contextPath String : Absolute path to the context file.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

Rhino.Builder.setLibraryPath()

public Rhino.Builder setLibraryPath(String libraryPath)

Sets the library path to the builder. If not set it will be set to the default location.

Parameters

  • libraryPath String : Absolute path to the file containing the Rhino library.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

Rhino.Builder.setModelPath()

public Rhino.Builder setModelPath(String modelPath)

Sets the model path to the builder. If not set it will be set to the default location.

Parameters

  • modelPath String : Absolute path to the file containing model parameters.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

Rhino.Builder.setSensitivity()

public Rhino.Builder setSensitivity(float sensitivity)

Sets sensitivity to the builder. Value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.

Parameters

  • sensitivity float: Inference sensitivity.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

Rhino.Builder.setEndpointDuration()

public Rhino.Builder setEndpointDuration(float endpointDuration)

Sets endpointDuration to the builder. 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.

Parameters

  • endpointDuration float: Endpoint duration in seconds.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

Rhino.Builder.setRequireEndpoint()

public Rhino.Builder setRequireEndpoint(boolean requireEndpoint)

Sets requireEndpoint to the builder. 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).

Parameters

  • requireEndpoint boolean: Indicates whether an endpoint is required for Rhino to finish inference.

Returns

  • Rhino.Builder: The instance of Rhino.Builder object.

RhinoInference

public class RhinoInference { }

Class to contain Rhino inference data.


RhinoInference.getIsUnderstood()

public boolean getIsUnderstood()

Getter for the isUnderstood flag.

Returns

  • boolean: If true, Rhino understood the inference.

RhinoInference.getIntent()

public String getIntent()

Getter for the inference intent name.

Returns

  • String: Inference intent name.

RhinoInference.getSlots()

public Map<String, String> getSlots()

Getter for the inference slots and values.

Returns

  • Map<String, String>: Map for inference slots and values.

RhinoException

public class RhinoException extends Exception { }

Exception thrown if an error occurs within the Rhino engine.

Exceptions:

public class RhinoActivationException extends RhinoException { }
public class RhinoActivationLimitException extends RhinoException { }
public class RhinoActivationRefusedException extends RhinoException { }
public class RhinoActivationThrottledException extends RhinoException { }
public class RhinoIOException extends RhinoException { }
public class RhinoInvalidArgumentException extends RhinoException { }
public class RhinoInvalidStateException extends RhinoException { }
public class RhinoKeyException extends RhinoException { }
public class RhinoMemoryException extends RhinoException { }
public class RhinoRuntimeException extends RhinoException { }
public class RhinoStopIterationException extends RhinoException { }

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Rhino Speech-to-Intent — Java API
  • Rhino
  • Rhino()
  • delete()
  • getFrameLength()
  • getSampleRate()
  • getVersion()
  • getContextInformation()
  • process()
  • getInference()
  • Rhino.Builder
  • build()
  • setAccessKey()
  • setContextPath()
  • setLibraryPath()
  • setModelPath()
  • setSensitivity()
  • setEndpointDuration()
  • setRequireEndpoint()
  • RhinoInference
  • getIsUnderstood()
  • getIntent()
  • getSlots()
  • RhinoException
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.