Eagle Speaker Recognition
C API
API Reference for the Eagle C SDK.
pv_eagle_profiler_t
Struct representing the profiler component of the Eagle Speaker Recognition engine.
pv_eagle_profiler_init()
Creates an instance of the profiler component of the Eagle Speaker Recognition engine. Resources should be cleaned when you are done using the pv_eagle_profiler_delete() function.
Parameters
access_keyconst char * : AccessKey obtained from Picovoice Console.model_pathconst char * : Absolute path to the file containing model parameters (.pv).devicechar * : String representation of the device (e.g., CPU or GPU) to use. If set tobest, the most suitable device is selected automatically. If set togpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument togpu:${GPU_INDEX}, where${GPU_INDEX}is the index of the target GPU. If set tocpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument tocpu:${NUM_THREADS}, where${NUM_THREADS}is the desired number of threads.min_enrollment_chunksint Minimum number of chunks to be processed before enroll returns 100%. The value should be a number greater than or equal to 1. A higher number results in more accurate profiles at the cost of needing more data to create the profile.voice_thresholdfloat Sensitivity threshold for detecting voice. The value should be a number within [0, 1]. A higher threshold increases detection confidence values at the cost of potentially missing frames of voice.objectpv_eagle_profiler_t * * : Constructed instance of the Eagle profiler.
Returns
- pv_status_t : Status code.
pv_eagle_profiler_delete()
Releases resources acquired by the Eagle profiler.
Parameters
objectpv_eagle_profiler_t * : Eagle profiler object.
pv_eagle_profiler_enroll()
Enrolls a speaker. This function should be called multiple times with different utterances of the same speaker
until percentage reaches 100.0. Any further enrollment can be used to improve the speaker voice profile.
The required frame length of audio samples can be obtained by calling pv_eagle_profiler_frame_length().
The audio data used for enrollment should satisfy the following requirements:
- only one speaker should be present in the audio
- the speaker should be speaking in a normal voice (i.e. not whispering or shouting)
- the audio should contain no speech from other speakers and no other sounds (e.g. music)
- it should be captured in a quiet environment with no background noise
Parameters
objectpv_eagle_profiler_t * : Eagle profiler object.pcmint16_t : A frame of audio samples. The number of samples per frame can be attained by callingpv_eagle_profiler_frame_length(). The incoming audio needs to have a sample rate equal topv_sample_rate()and be 16-bit linearly-encoded. Eagle operates on single-channel audio.percentagefloat : Percentage of enrollment progress. When this value reaches100.0, the enrollment process is complete.
Returns
- pv_status_t : Status code.
pv_eagle_profiler_flush()
Marks the end of the audio stream, flushes internal state of the object, and returns the percentage of enrollment completed.
Parameters
objectpv_eagle_profiler_t * : Eagle profiler object.percentagefloat : Percentage of enrollment progress. When this value reaches100.0, the enrollment process is complete.
Returns
- pv_status_t : Status code.
pv_eagle_profiler_frame_length()
Getter for number of audio samples per frame.
Returns
- int32_t : Frame length.
pv_eagle_profiler_export()
Exports the speaker profile to a buffer. The exported profile can be used in pv_eagle_init() or stored for later use.
Parameters
objectpv_eagle_profiler_t * : Eagle profiler object.speaker_profilevoid * : Buffer where the speaker profile will be stored. Must be pre-allocated with a size obtained by callingpv_eagle_profiler_export_size().
Returns
- pv_status_t : Status code.
pv_eagle_profiler_reset()
Resets the EagleProfiler object and removes all enrollment data. It must be called before enrolling a new speaker.
Parameters
objectpv_eagle_profiler_t * : Eagle profiler object.
Returns
- pv_status_t : Status code.
pv_eagle_t
Struct representing the recognizer component of the Eagle Speaker Recognition engine.
pv_eagle_init()
Creates an instance of the recognizer component of the Eagle Speaker Recognition engine. Resources should be cleaned when you are done using the pv_eagle_delete() function.
Parameters
access_keyconst char * : AccessKey obtained from Picovoice Console.model_pathconst char * : Absolute path to the file containing model parameters (.pv).devicechar * : String representation of the device (e.g., CPU or GPU) to use. If set tobest, the most suitable device is selected automatically. If set togpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument togpu:${GPU_INDEX}, where${GPU_INDEX}is the index of the target GPU. If set tocpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument tocpu:${NUM_THREADS}, where${NUM_THREADS}is the desired number of threads.voice_thresholdfloat Sensitivity threshold for detecting voice. The value should be a number within [0, 1]. A higher threshold increases detection confidence values at the cost of potentially missing frames of voice.objectpv_eagle_t * : Constructed instance of the Eagle engine.
Returns
- pv_status_t : Status code.
pv_eagle_delete()
Releases the resources acquired by the Eagle engine.
Parameters
objectpv_eagle_t * : Eagle object.
Returns
- pv_status_t : Status code.
pv_eagle_process()
Processes a frame of the incoming audio stream. The minimum number of required samples can be obtained by
calling pv_eagle_process_min_audio_length_samples().
Parameters
objectpv_eagle_t * : Eagle object.pcmint16_t : Audio data. The required sample rate can be attained by calling pv_sample_rate(). The required audio format is 16-bit linearly-encoded single-channel PCM. The minimum audio length required for enrollment can be attained by callingpv_eagle_process_min_audio_length_samples().num_speakersint32_t : Number of speakers to enroll.speaker_profilesvoid ** : Speaker profiles. This can be created using the EagleProfiler object and its related functions.num_samplesint32_t : Number of audio samples inpcm.scoresfloat ** : Similarity scores for each enrolled speaker. Must be pre-allocated with a size equal to the number of enrolled speakers. The scores are in the range [0, 1] with 1 being a perfect match.
Returns
- pv_status_t : Status code.
pv_eagle_process_min_audio_length_samples()
Gets the minimum length of the input pcm required by pv_eagle_process().
Parameters
objectpv_eagle_t * : Eagle object.
Returns
- pv_status_t : Status code.
pv_eagle_version()
Getter for version.
Returns
- const char * : Eagle version.
pv_eagle_list_hardware_devices()
Gets a list of hardware devices that can be specified when calling pv_eagle_init().
Parameters
hardware_devicesconst char * * * : Array of available hardware devices. Devices are NULL terminated strings. The array must be freed usingpv_eagle_free_hardware_devices().num_hardware_devicesint32_t * : The number of devices in thehardware_devicesarray.
Returns
- pv_status_t : Returned status code.
pv_eagle_free_hardware_devices()
This function frees the memory allocated by pv_eagle_list_hardware_devices().
Parameters
hardware_devicesconst char * * * : Array of available hardware devices allocated bypv_eagle_list_hardware_devices().num_hardware_devicesint32_t * : The number of devices in thehardware_devicesarray
pv_sample_rate()
Audio sample rate accepted by Eagle.
Returns
- int32_t : Sample rate.
pv_status_t
Status code enum.
pv_status_to_string()
Parameters
statusint32_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_stackconst 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_depthint32_t * : The number of messages in themessage_stackarray.
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_stackconst char * * * : Array of messages relating to the failure.