Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Cheetah Speech-to-Text
Java API


API Reference for the Java Cheetah SDK (cheetah-java)

package: ai.picovoice.cheetah


Cheetah

public class Cheetah { }

Class for the Cheetah Speech-to-Text engine.

Cheetah must be initialized using the Builder() Class. Resources should be cleaned when you are done using the delete() function.


Cheetah.delete()

public void delete()

Releases resources acquired by Cheetah.


Cheetah.getFrameLength()

public int getFrameLength()

Getter for number of audio samples per frame.

Returns

  • int: Number of audio samples per frame.

Cheetah.getSampleRate()

public int getSampleRate()

Getter for required audio sample rate for PCM data.

Returns

  • int: Required audio sample rate for PCM data.

Cheetah.getVersion()

public String getVersion()

Getter for version.

Returns

  • String: Current Cheetah version.

Cheetah.process()

public CheetahTranscript process(short[] pcm) throws CheetahException

Processes a frame of audio and returns newly-transcribed text and a flag indicating if an endpoint has been detected. Upon detection of an endpoint, the client may invoke .flush() to retrieve any remaining transcription.

The number of samples per frame can be attained by calling .getFrameLength(). The incoming audio needs to have a sample rate equal to .getSampleRate() and be 16-bit linearly-encoded. Furthermore, Cheetah operates on single-channel audio.

Parameters

  • pcm short[] : A frame of audio samples.

Returns

  • CheetahTranscript: Inferred transcription object.

Throws

  • CheetahException: If there is an error while processing the audio frame.

Cheetah.flush()

public CheetahTranscript flush() throws CheetahException

Processes any remaining audio data and returns its transcription.

Returns

  • CheetahTranscript: Inferred transcription object.

Throws

  • CheetahException: If there is an error while processing the audio frame.

Cheetah.Builder

public static class Builder {
public Builder(String accessKey) { }
}

Builder for creating an instance of Cheetah with a mixture of default arguments.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.

Cheetah.Builder.build()

public Cheetah build() throws CheetahException

Creates an instance of Cheetah Speech-to-Text engine.

Returns

  • Cheetah: An instance of Cheetah Speech-to-Text engine.

Throws

  • CheetahException: If an error occurs while creating an instance of Cheetah Speech-to-Text engine.

Cheetah.Builder.setAccessKey()

public Cheetah.Builder setAccessKey(String accessKey)

Sets the AccessKey of the builder.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.

Returns

  • Cheetah.Builder: Modified Cheetah.Builder object.

Cheetah.Builder.setModelPath()

public Cheetah.Builder setModelPath(String modelPath)

Sets the model path of the builder.

Parameters

  • modelPath String : Absolute path to the file containing model parameters (.pv).

Returns

  • Cheetah.Builder: Modified Cheetah.Builder object.

Cheetah.Builder.setLibraryPath()

public Builder setLibraryPath(String libraryPath)

Sets the library path of the builder.

Parameters

  • libraryPath String : Absolute path to the native Cheetah library.

Returns

  • Cheetah.Builder: Modified Cheetah.Builder object.

Cheetah.Builder.setEndpointDuration()

public Cheetah.Builder setEndpointDuration(float endpointDuration)

Sets the endpoint duration of the builder. 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.

Parameters

  • endpointDuration float : Duration of endpoint in seconds.

Returns

  • Cheetah.Builder: Modified Cheetah.Builder object.

Cheetah.Builder.setEnableAutomaticPunctuation()

public Cheetah.Builder setEnableAutomaticPunctuation(boolean setEnableAutomaticPunctuation)

Setter for enabling automatic punctuation insertion.

Parameters

  • enableAutomaticPunctuation boolean : Set to true to enable automatic punctuation insertion.

Returns

  • Cheetah.Builder: Modified Cheetah.Builder object.

CheetahTranscript

public class CheetahTranscript { }

Class that contains Cheetah transcript data.


CheetahTranscript.getTranscript()

public string getTranscript() { }

Getter for transcript data.

Returns

  • string: Inferred transcription.

CheetahTranscript.getIsEndpoint()

public boolean getIsEndpoint() { }

Getter for isEndpoint flag.

Returns

  • boolean: If true, Cheetah detected a speech endpoint.

CheetahException

public class CheetahException extends Exception { }

Exception thrown if an error occurs within Cheetah Speech-to-Text engine.

Exceptions:

public class CheetahActivationException extends CheetahException { }
public class CheetahActivationLimitException extends CheetahException { }
public class CheetahActivationRefusedException extends CheetahException { }
public class CheetahActivationThrottledException extends CheetahException { }
public class CheetahIOException extends CheetahException { }
public class CheetahInvalidArgumentException extends CheetahException { }
public class CheetahInvalidStateException extends CheetahException { }
public class CheetahKeyException extends CheetahException { }
public class CheetahMemoryException extends CheetahException { }
public class CheetahRuntimeException extends CheetahException { }
public class CheetahStopIterationException extends CheetahException { }

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Cheetah Speech-to-Text Java API
  • Cheetah
  • delete()
  • getFrameLength()
  • getSampleRate()
  • getVersion()
  • process()
  • flush()
  • Cheetah.Builder
  • build()
  • setAccessKey()
  • setModelPath()
  • setLibraryPath()
  • setEndpointDuration()
  • setEnableAutomaticPunctuation()
  • CheetahTranscript
  • getTranscript()
  • getIsEndpoint()
  • CheetahException
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.