Package ai.picovoice.cheetah
Class Cheetah
- java.lang.Object
-
- ai.picovoice.cheetah.Cheetah
-
public class Cheetah extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCheetah.Builder
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLIBRARY_PATHstatic java.lang.StringMODEL_PATH
-
Constructor Summary
Constructors Constructor Description Cheetah(java.lang.String accessKey, java.lang.String libraryPath, java.lang.String modelPath, float endpointDurationSec)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Releases resources acquired by Cheetah.CheetahTranscriptflush()Processes any remaining audio data and returns its transcription.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 Cheetah version.CheetahTranscriptprocess(short[] pcm)Processes given audio data and returns its transcription.
-
-
-
Constructor Detail
-
Cheetah
public Cheetah(java.lang.String accessKey, java.lang.String libraryPath, java.lang.String modelPath, float endpointDurationSec) throws CheetahExceptionConstructor.- Parameters:
accessKey- AccessKey obtained from Picovoice Console.libraryPath- Absolute path to the native Cheetah library.modelPath- Absolute path to the file containing model parameters.endpointDuration- Duration of endpoint in seconds. A speech endpoint is detected when there is a chunk of audio (with a duration specified herein) after an utterance without any speech in it. Set duration to 0 to disable this. Default is 1 second in the Builder.- Throws:
CheetahException- if there is an error while initializing Cheetah.
-
-
Method Detail
-
delete
public void delete()
Releases resources acquired by Cheetah.
-
process
public CheetahTranscript process(short[] pcm) throws CheetahException
Processes given audio data and returns its transcription.- Parameters:
pcm- A frame of audio samples. The number of samples per frame can be attained by callinggetFrameLength(). The incoming audio needs to have a sample rate equal togetSampleRate()and be 16-bit linearly-encoded. Furthermore, Cheetah operates on single channel audio only.- Returns:
- Inferred transcription.
- Throws:
CheetahException- if there is an error while processing the audio frame.
-
flush
public CheetahTranscript flush() throws CheetahException
Processes any remaining audio data and returns its transcription.- Returns:
- Inferred transcription.
- Throws:
CheetahException- 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 Cheetah version.- Returns:
- Cheetah version.
-
-