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


API Reference for the Rhino C SDK.


pv_rhino_t

typedef struct pv_rhino pv_rhino_t;

Container representing the Rhino engine.


pv_rhino_init()

PV_API pv_status_t pv_rhino_init(
const char *access_key,
const char *model_path,
const char *context_path,
float sensitivity,
float endpoint_duration_sec,
bool require_endpoint,
pv_rhino_t **object);

Create a Rhino instance. Resources should be cleaned when you are done using the pv_rhino_delete() function.

Parameters

  • access_key char * : AccessKey obtained from Picovoice Console.
  • model_path char * : Absolute path to file containing model parameters (.pv).
  • context_path char * : Absolute path to file containing context parameters. A context represents the set of expressions (spoken commands), intents, and intent arguments (slots) within a domain of interest (.rhn).
  • 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.
  • endpoint_duration_sec 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.
  • require_endpoint 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).
  • object pv_rhino_t * * : Constructed instance of Rhino.

Returns

  • pv_status_t : Returned status code.

pv_rhino_delete()

void pv_rhino_delete(pv_rhino_t *object);

Releases resources acquired by Rhino.

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.

pv_rhino_process()

pv_status_t pv_rhino_process(pv_rhino_t *object, const int16_t *pcm, bool *is_finalized);

Processes a frame of audio and emits a flag indicating if the inference is finalized. When finalized, pv_rhino_is_understood()[#pv_rhino_is_understood] should be called to check if the spoken command is considered valid. The number of samples per frame can be attained by calling pv_rhino_frame_length(). The incoming audio needs to have a sample rate equal to pv_sample_rate() and be 16-bit linearly-encoded. Picovoice operates on single-channel audio.

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.
  • pcm int16_t * : A frame of audio samples.
  • is_finalized bool * : A flag indicating if the inference is finalized.

Returns

  • pv_status_t : Returned status code.

pv_rhino_is_understood()

PV_API pv_status_t pv_rhino_is_understood(const pv_rhino_t *object, bool *is_understood);

Indicates if the spoken command is valid, is within the domain of interest (context), and the engine understood it. Upon success pv_rhino_get_intent() may be called to retrieve inferred intent. If not understood, pv_rhino_reset() should be called.

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.
  • is_understood bool * : A flag indicating if the spoken command is understood.

Returns

  • pv_status_t : Returned status code.

pv_rhino_get_intent()

pv_status_t pv_rhino_get_intent(
const pv_rhino_t *object,
const char **intent,
int32_t *num_slots,
const char ***slots,
const char ***values);

Getter for the intent. The intent is stored as an intent string and pairs of slots and values. It should be called only after intent inference is finalized, and it is verified that the spoken command is understood via calling pv_rhino_is_understood().

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.
  • intent bool ** : Inferred intent.
  • num_slots int32_t * : Number of slots.
  • slots const char *** : Array of inferred slots. Its memory needs to be freed by calling pv_rhino_free_slots_and_values().
  • values const char *** : Array of inferred slot values. Its memory needs to be freed by calling pv_rhino_free_slots_and_values().

Returns

  • pv_status_t : Returned status code.

pv_rhino_free_slots_and_values()

PV_API pv_status_t pv_rhino_free_slots_and_values(const pv_rhino_t *object, const char **slots, const char **values);

Frees memory resources allocated to slots and values after calling pv_rhino_get_intent(). One should not free these resources via standard C library 'free()'.

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.
  • slots const char ** : Slots.
  • values const char ** : Slot values.

Returns

  • pv_status_t : Returned status code.

pv_rhino_reset()

pv_status_t pv_rhino_reset(pv_rhino_t *object);

Resets the internal state of the engine. It should be called before the engine can be used to infer intent from a new stream of audio.

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.

Returns

  • pv_status_t : Returned status code.

pv_rhino_context_info()

pv_status_t pv_rhino_context_info(const pv_rhino_t *object, const char **context_info);

Getter for context information.

Parameters

  • object pv_rhino_t * : Rhino Speech-to-Intent object.
  • context char * * : A frame of audio samples.

Returns

  • pv_status_t : Returned status code.

pv_rhino_version()

const char *pv_rhino_version(void);

Getter for version.

Returns

  • char * : Rhino version.

pv_rhino_frame_length()

int32_t pv_rhino_frame_length(void);

Getter for number of audio samples per frame.

Returns

  • int32_t : Frame length.

pv_sample_rate()

int32_t pv_sample_rate(void);

Audio sample rate accepted by Rhino.

Returns

  • int32_t : Sample rate.

pv_status_t

typedef enum {
PV_STATUS_SUCCESS = 0,
PV_STATUS_OUT_OF_MEMORY,
PV_STATUS_IO_ERROR,
PV_STATUS_INVALID_ARGUMENT,
PV_STATUS_STOP_ITERATION,
PV_STATUS_KEY_ERROR,
PV_STATUS_INVALID_STATE,
PV_STATUS_RUNTIME_ERROR,
PV_STATUS_ACTIVATION_ERROR,
PV_STATUS_ACTIVATION_LIMIT_REACHED,
PV_STATUS_ACTIVATION_THROTTLED,
PV_STATUS_ACTIVATION_REFUSED
} pv_status_t;

Status code enum.


pv_status_to_string()

const char *pv_status_to_string(pv_status_t status);

Parameters

  • int32_t : Returned status code.

Returns

  • char * : String representation.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Rhino Speech-to-Intent — C API
  • pv_rhino_t
  • pv_rhino_init()
  • pv_rhino_delete()
  • pv_rhino_process()
  • pv_rhino_is_understood()
  • pv_rhino_get_intent()
  • pv_rhino_free_slots_and_values()
  • pv_rhino_reset()
  • pv_rhino_context_info()
  • pv_rhino_version()
  • pv_rhino_frame_length()
  • pv_sample_rate()
  • pv_status_t
  • pv_status_to_string()
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.