Typedefs | Functions
include/pv_rhino.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "picovoice.h"
Include dependency graph for include/pv_rhino.h:

Go to the source code of this file.

Typedefs

typedef struct pv_rhino pv_rhino_t
 

Functions

PV_API pv_status_t pv_rhino_context_info (const pv_rhino_t *object, const char **context_info)
 
PV_API void pv_rhino_delete (pv_rhino_t *object)
 
PV_API int32_t pv_rhino_frame_length (void)
 
PV_API pv_status_t pv_rhino_free_slots_and_values (const pv_rhino_t *object, const char **slots, const char **values)
 
PV_API 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)
 
PV_API pv_status_t pv_rhino_init (const char *access_key, const char *model_path, const char *context_path, float sensitivity, bool require_endpoint, pv_rhino_t **object)
 
PV_API pv_status_t pv_rhino_is_understood (const pv_rhino_t *object, bool *is_understood)
 
PV_API pv_status_t pv_rhino_process (pv_rhino_t *object, const int16_t *pcm, bool *is_finalized)
 
PV_API pv_status_t pv_rhino_reset (pv_rhino_t *object)
 
const PV_API char * pv_rhino_version (void)
 

Typedef Documentation

◆ pv_rhino_t

typedef struct pv_rhino pv_rhino_t

Forward declaration for Rhino Speech-to-Intent engine. It directly infers the user's intent from spoken commands in real-time. Rhino processes incoming audio in consecutive frames and indicates if the inference is finalized. When finalized, the inferred intent can be retrieved as structured data in the form of an intent string and pairs of slots and values. 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. Rhino operates on single-channel audio.

Definition at line 34 of file include/pv_rhino.h.

Function Documentation

◆ pv_rhino_context_info()

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

Getter for context information.

Parameters
objectSpeech-to-Intent object.
[out]context_infoContext information.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT' on failure.

◆ pv_rhino_delete()

PV_API void pv_rhino_delete ( pv_rhino_t object)

Destructor.

Parameters
objectSpeech-to-Intent object.

◆ pv_rhino_frame_length()

PV_API int32_t pv_rhino_frame_length ( void  )

Getter for number of audio samples per frame.

Returns
Frame length.

◆ 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 shouldn't free these resources via standard C library 'free()'.

Parameters
objectSpeech-to-Intent object.
slotsSlots.
valuesSlot values.
Returns
Returns 'PV_STATUS_INVALID_ARGUMENT' on failure.

◆ pv_rhino_get_intent()

PV_API 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
objectSpeech-to-Intent object.
[out]intentInferred intent.
[out]num_slotsNumber of slots.
[out]slotsArray of inferred slots. Its memory needs to be freed by calling 'pv_rhino_free_slots_and_values()'.
[out]valuesArray of inferred slot values. Its memory needs to be freed by calling 'pv_rhino_free_slots_and_values()'.
Returns
State code. Returns 'PV_STATUS_INVALID_ARGUMENT', 'PV_STATUS_INVALID_STATE', or 'PV_STATUS_OUT_OF_MEMORY' on failure.

◆ 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,
bool  require_endpoint,
pv_rhino_t **  object 
)

Constructor.

Parameters
access_keyAccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
model_pathAbsolute path to file containing model parameters.
context_pathAbsolute 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.
sensitivityInference 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.
require_endpointIf set to true, Rhino requires an endpoint (chunk of silence) before finishing inference.
[out]objectConstructed Speech-to-Intent object.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT', 'PV_STATUS_IO_ERROR', or 'PV_STATUS_OUT_OF_MEMORY' on failure.

◆ 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
objectSpeech-to-Intent object.
[out]is_understoodFlag indicating if the spoken command is understood.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT' on failure.

◆ pv_rhino_process()

PV_API 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()' should be called to check if the spoken command is considered valid.

Parameters
objectSpeech-to-Intent object.
pcmA frame of audio samples. 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. Rhino operates on single-channel audio.
[out]is_finalizedFlag indicating if the inference is finalized.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT' or 'PV_STATUS_OUT_OF_MEMORY' on failure.

◆ pv_rhino_reset()

PV_API 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
objectSpeech-to-Intent object.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT' on failure.

◆ pv_rhino_version()

const PV_API char* pv_rhino_version ( void  )

Getter for version.

Returns
Version.


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:00