Octopus Speech-to-Index
C API
API Reference for the Octopus C SDK.
pv_octopus_t
Container representing the Octopus Speech-to-Index engine.
pv_octopus_match_t
Container representing a matched utterance.
pv_octopus_init()
Creates an Octopus instance. Resources should be cleaned when you are done using the pv_octopus_delete() function.
Parameters
access_key
const char * : AccessKey obtained from Picovoice Console.model_path
const char * : Absolute path to the file containing model parameters (.pv
).object
pv_octopus_t * * : Constructed instance of Octopus.
Returns
- pv_status_t : Status code.
pv_octopus_delete()
Releases resources acquired by Octopus.
Parameters
object
pv_octopus_t * : Picovoice object.
pv_octopus_index()
Indexes audio data. The audio needs to have a sample rate equal to pv_sample_rate()
and be 16-bit linearly-encoded. This function operates on single-channel audio.
Parameters
object
pv_octopus_t * : Octopus object.pcm
int16_t : Audio data.num_samples
int32_t : Number of audio samples to process.indices
void * * : Index metadata.num_indices_bytes
int32_t * : Size of index metadata in bytes.
Returns
- pv_status_t : Status code.
pv_octopus_index_file()
Indexes an audio file.
Parameters
object
pv_octopus_t * : Octopus object.path
const char * : Absolute path to the audio file.indices
void * * : Index metadata.num_indices_bytes
int32_t * : Size of index metadata in bytes.
Returns
- pv_status_t : Status code.
pv_octopus_search()
Searches index metadata for occurrences of a given phrase.
Parameters
object
pv_octopus_t * : Octopus object.indices
void * : Index metadata.num_indices_bytes
int32_t : Size of index metadata in bytes.phrase
const char * : Search phrase.matches
pv_octopus_match_t * * : Utterances matching the search phrase.num_matches
int32_t * : Numbers of matched utterances.
Returns
- pv_status_t : Status code.
pv_octopus_version()
Getter for version.
Returns
- const char * : Octopus version.
pv_sample_rate()
Audio sample rate accepted by Octopus.
Returns
- int32_t : Sample rate.
pv_status_t
Status code enum.
pv_status_to_string()
Parameters
status
int32_t : Status code.
Returns
- const char * : String representation of status code.
pv_get_error_stack()
If a function returns a failure (any pv_status_t other than PV_STATUS_SUCCESS
), this function can be
called to get a series of error messages related to the failure. This function can only be called only once per
failure status on another function. The memory for message_stack
must be freed using pv_free_error_stack
.
Regardless of the return status of this function, if message_stack
is not NULL
, then message_stack
contains valid memory. However, a failure status on this function indicates that future error messages
may not be reported.
Parameters
message_stack
const char * * * : Array of messages relating to the failure. Messages are NULL terminated strings. The array and messages must be freed usingpv_free_error_stack()
.message_stack_depth
int32_t * : The number of messages in themessage_stack
array.
Returns
- pv_status_t : Returned status code.
pv_free_error_stack()
This function frees the memory used by error messages allocated by pv_get_error_stack()
.
Parameters
message_stack
const char * * * : Array of messages relating to the failure.