Package ai.picovoice.koala
Class Koala
- java.lang.Object
-
- ai.picovoice.koala.Koala
-
public class Koala extends java.lang.ObjectAndroid binding for Koala Noise Suppression engine.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKoala.BuilderBuilder for creating an instance of Koala with a mixture of default arguments.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Releases resources acquired by Koala.intgetDelaySample()Getter for Koala delaySample.intgetFrameLength()Getter for required number of audio samples per frame.intgetSampleRate()Getter for required audio sample rate for PCM data.java.lang.StringgetVersion()Getter for Koala version.short[]process(short[] pcm)Processes given audio data and returns delayed enhanced audio.voidreset()Resets Koala into a state as if it had just been newly created.static voidsetSdk(java.lang.String sdk)
-
-
-
Method Detail
-
setSdk
public static void setSdk(java.lang.String sdk)
-
delete
public void delete()
Releases resources acquired by Koala.
-
process
public short[] process(short[] pcm) throws KoalaExceptionProcesses given audio data and returns delayed enhanced audio.- Parameters:
pcm- A frame of audio samples. The number of samples per frame can be obtained by callinggetFrameLength(). The incoming audio needs to have a sample rate equal togetSampleRate()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, unlessreset()has been called in between.- Returns:
- A frame of enhanced audio samples, stored as a sequence of 16-bit linearly-encoded integers.
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 obtained fromgetDelaySample(). - Throws:
KoalaException- if there is an error while processing the audio frame.
-
reset
public void reset() throws KoalaExceptionResets Koala into a state as if it had just been newly created. Call this function in between calls to#process()that do not provide consecutive frames of audio.- Throws:
KoalaException- if there is an error while processing the audio frame.
-
getFrameLength
public int getFrameLength()
Getter for required number of audio samples per frame.- Returns:
- Required number of audio samples per frame.
-
getSampleRate
public int getSampleRate()
Getter for required audio sample rate for PCM data.- Returns:
- Required audio sample rate for PCM data.
-
getVersion
public java.lang.String getVersion()
Getter for Koala version.- Returns:
- Koala version.
-
getDelaySample
public int getDelaySample() throws KoalaExceptionGetter for Koala delaySample.- Returns:
- Koala process delay in number of samples.
- Throws:
KoalaException
-
-