Cobra Voice Activity Detection
C API
API Reference for the Cobra C SDK .
pv_cobra_t
Container representing the Cobra VAD engine.
pv_cobra_init()
Creates a Cobra instance. Resources should be cleaned when you are done using the pv_cobra_delete() function.
Parameters
access_key
const char * : AccessKey obtained from Picovoice Console .object
pv_cobra_t * * : Constructed instance of Cobra.
Returns
- pv_status_t : Status code.
pv_cobra_delete()
Releases resources acquired by Cobra.
Parameters
object
pv_cobra_t * : Picovoice object.
pv_cobra_process()
Processes a frame of the incoming audio stream and emits the probability of voice activity.
The number of samples per frame can be attained by calling pv_cobra_frame_length()
. The incoming audio needs to have a sample rate equal to pv_sample_rate()
and be 16-bit linearly-encoded. Cobra operates on single-channel audio.
Parameters
object
pv_cobra_t * : Cobra object.pcm
int16_t : A frame of audio samples.is_voiced
float * : Probability of voice activity. It is a floating-point number within [0, 1].
Returns
- pv_status_t : Status code.
pv_cobra_frame_length()
Getter for number of audio samples per frame.
Returns
- int32_t : Frame length.
pv_cobra_version()
Getter for version.
Returns
- const char * : Cobra version.
pv_sample_rate()
Audio sample rate accepted by Cobra.
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.