Koala Noise Suppression
C API
API Reference for the Koala C SDK.
pv_koala_t
Container representing the Koala Noise Suppression engine.
pv_koala_init()
Creates a Koala instance. Resources should be cleaned when you are done using the pv_koala_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.objectpv_koala_t * * : Constructed instance of Koala.
Returns
- pv_status_t : Status code.
pv_koala_delete()
Releases resources acquired by Koala.
Parameters
objectpv_koala_t * : Koala object.
pv_koala_process()
Processes a frame of the incoming audio stream and returns a frame of enhanced audio.
The output is not necessarily in sync with the input frame; instead, the output audio will contain the enhancement
result for audio that has been passed to previous calls of this function.
The total delay in samples can be obtained by pv_koala_delay_sample().
The number of samples per frame can be attained by calling pv_koala_frame_length().
The incoming audio needs to have a sample rate equal to pv_sample_rate() and be 16-bit
linearly-encoded.
Koala operates on single-channel audio.
Parameters
objectpv_koala_t * : Koala object.pcmint16_t : A frame of audio samples.enhanced_pcmint16_t : A frame of enhanced audio samples. Needs to point to an allocated block of memory of the same size as thepcminput argument.
Returns
- pv_status_t : Status code.
pv_koala_reset()
Finalizes the enhancement process and resets the internal state of the Koala object. Subsequent calls to
pv_koala_process() will not return any delayed samples from previous calls; that data will be
lost.
Instead, the result will be the same as if the Koala object were newly created.
Parameters
objectpv_koala_t * : Koala object.
Returns
- pv_status_t : Status code.
pv_koala_delay_sample()
Getter for the delay in samples. If the input and output of sequential calls to pv_koala_process are viewed as
two contiguous streams of audio data, this delay specifies the time shift between the input and output stream.
Parameters
objectpv_koala_t * : Koala object.delay_sampleint32_t * : Delay in samples.
Returns
- pv_status_t : Status code.
pv_koala_frame_length()
Getter for number of audio samples per frame.
Returns
- int32_t : Frame length.
pv_koala_version()
Getter for version.
Returns
- const char * : Koala version.
pv_sample_rate()
Audio sample rate accepted by Koala.
Returns
- int32_t : Sample rate.
pv_koala_list_hardware_devices()
Gets a list of hardware devices that can be specified when calling pv_koala_init().
Parameters
hardware_devicesconst char * * * : Array of available hardware devices. Devices are NULL terminated strings. The array must be freed usingpv_koala_free_hardware_devices().num_hardware_devicesint32_t * : The number of devices in thehardware_devicesarray.
Returns
- pv_status_t : Returned status code.
pv_koala_free_hardware_devices()
This function frees the memory allocated by pv_koala_list_hardware_devices().
Parameters
hardware_devicesconst char * * * : Array of available hardware devices allocated bypv_koala_list_hardware_devices().num_hardware_devicesint32_t * : The number of devices in thehardware_devicesarray.
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.