Koala Noise Suppression
Python API
API Reference for the Python Koala SDK (PyPI).
pvkoala.create()
Factory method for Koala Noise Suppression engine.
Parameters
access_keystr : AccessKey obtained from Picovoice Console.model_pathOptional[str] : Absolute path to the file containing model parameters.deviceOptional[str] : 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.library_pathOptional[str] : Absolute path to Koala's dynamic library.
Returns
Koala: An instance of Koala Noise Suppression engine.
Throws
pvkoala.available_devices()
Lists all available devices that Koala can use for inference. Each entry in the list can be the device argument
of create() factory method or Koala constructor.
Parameters
library_pathOptional[str] : Absolute path to Koala's dynamic library. If not set it will be set to the default location.
Returns
- Sequence[str]: List of all available devices that Koala can use for inference.
Throws
pvkoala.Koala
Class for the Koala Noise Suppression engine.
Koala can be initialized either using the module level create() function
or directly using the class __init__() method.
Resources should be cleaned when you are done using the delete() method.
pvkoala.Koala.version
The version string of the Koala library.
pvkoala.Koala.frame_length
The number of audio samples per frame that Koala accepts.
pvkoala.Koala.sample_rate
The audio sample rate the Koala accepts.
pvkoala.Koala.delay_sample
Delay in samples. If the input and output of consecutive calls to process() are viewed as two contiguous streams of audio data, this delay specifies the time shift between the input and output stream.
pvkoala.Koala.__init__()
__init__ method for Koala Noise Suppression engine.
Parameters
access_keystr : AccessKey obtained from Picovoice Console.model_pathstr : Absolute path to the file containing model parameters.devicestr : 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.library_pathstr : Absolute path to Koala's dynamic library.
Returns
Koala: An instance of Koala Noise Suppression engine.
Throws
pvkoala.Koala.delete()
Releases resources acquired by Koala.
pvkoala.Koala.process()
Processes a frame of audio and returns delayed enhanced audio.
The number of samples per frame can be attained from frame_length. The incoming audio needs to have a sample rate equal to sample_rate and be 16-bit linearly-encoded. Koala operates on single-channel audio. Consecutive calls to process() must provide consecutive frames of audio from the same source, unless reset() has been called in between.
The output is not directly the enhanced version of the input PCM, but corresponds to samples that were given in previous calls to process(). The delay in samples between the start time of the input frame and the start time of the output frame can be attained from delay_sample.
Parameters
pcmSequence[int] : A frame of audio samples.
Returns
Sequence[int]: A frame of enhanced audio samples, stored as a sequence of 16-bit linearly-encoded integers.
Throws
pvkoala.Koala.reset()
Marks the end of the audio stream and resets the internal state of the object. Call this function in between calls to process that do not provide consecutive frames of audio.
Throws
pvkoala.list_hardware_devices()
Lists all available devices that Koala can use for inference. Each entry in the list can be the device argument
of create() factory method or Koala constructor.
Internal method. The higher level pvkoala.available_devices() should be used instead.
Parameters
library_pathstr : Absolute path to Koala's dynamic library.
Returns
- Sequence[str]: List of all available devices that Koala can use for inference.
Throws
pvkoala.KoalaError
Error thrown if an error occurs within Koala Noise Suppression engine.
Exceptions