Koala Noise Suppression
Web API
API Reference for the Koala Web SDK (npm).
Koala
Class for the Koala Noise Suppression engine.
Koala.create()
Creates an instance of the Koala Noise Suppression engine.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.processCallback
(enhancedPcm: Int16Array) => void : User-defined callback invoked when a frame of audio is processed.model
KoalaModel : Koala model options.options
KoalaOptions : Optional configuration arguments.
Returns
Koala
: An instance of the Koala engine.
Koala.process()
Processes a frame of audio. The required sample rate can be retrieved from sampleRate
and the length of frame
(number of audio samples per frame) can be retrieved from frameLength
.
The audio must be single-channel and 16-bit linearly-encoded.
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 delaySample
.
Parameters
pcm
Int16Array : A frame of audio samples.
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.
Koala.release()
Releases resources acquired by the Koala Web SDK.
Koala.frameLength
Number of audio samples per frame.
Koala.sampleRate
Audio sample rate accepted by Koala.
Koala.version
Koala version string.
Koala.delaySample
Koala delay in samples.
KoalaModel
Koala model type.
base64
string: The model file (.pv
) in base64 string to initialize Koala.publicPath
string: The model file (.pv
) path relative to the public directory.customWritePath
string : Custom path to save the model in storage. Set to a different name to use multiple models acrosskoala
instances.forceWrite
boolean : Flag to overwrite the model in storage even if it exists.version
number : Version of the model file. Increment to update the model file in storage.
KoalaOptions
Koala options type.
processErrorCallback
boolean : User-defined callback invoked if any error happens while processing the audio stream. Its only input argument is the error message.
KoalaWorker
A class for running the Koala Noise Suppression engine as a web worker thread.
KoalaWorker.create()
Creates an instance of KoalaWorker
.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.processCallback
(enhancedPcm: Int16Array) => void : User-defined callback invoked when a frame of audio is processed.model
KoalaModel : Koala model options.options
KoalaOptions : Optional configuration arguments.
Returns
KoalaWorker
: An instance ofKoalaWorker
.
KoalaWorker.process()
Processes a frame of audio. The required sample rate can be retrieved from 'sampleRate' and the length of frame (number of audio samples per frame) can be retrieved from 'frameLength'. The audio must be single-channel and 16-bit linearly-encoded.
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 delaySample
.
Parameters
pcm
Int16Array : A frame of audio samples.
KoalaWorker.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.
KoalaWorker.release()
Releases resources acquired by the Koala Web SDK.
KoalaWorker.terminate()
Force terminates the instance of KoalaWorker
.
KoalaWorker.frameLength
Number of audio samples per frame.
KoalaWorker.sampleRate
Audio sample rate accepted by Koala.
KoalaWorker.version
Koala version string.
Koala.delaySample
Koala delay in samples.