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
Python API


API Reference for the Python Cheetah SDK (PyPI).


pvcheetah.create()

def create(
access_key: str,
model_path: Optional[str] = None,
library_path: Optional[str] = None,
endpoint_duration_sec: Optional[float] = None,
enable_automatic_punctuation: bool = False) -> Cheetah

Factory method for Cheetah Speech-to-Text engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • library_path Optional[str] : Absolute path to Cheetah's dynamic library.
  • model_path Optional[str] : Absolute path to the file containing model parameters.
  • endpoint_duration_sec Optional[float] : 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 to None to disable endpoint detection.
  • enable_automatic_punctuation bool : Set to True to enable automatic punctuation insertion.

Returns

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

Throws

  • CheetahError

pvcheetah.Cheetah

class Cheetah(object)

Class for the Cheetah Speech-to-Text engine. Cheetah 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.


pvcheetah.Cheetah.version

self.version: str

The version string of the Cheetah library.


pvcheetah.Cheetah.frame_length

self.frame_length: int

The number of audio samples per frame that Cheetah accepts.


pvcheetah.Cheetah.sample_rate

self.sample_rate: int

The audio sample rate the Cheetah accepts.


pvcheetah.Cheetah.__init__()

def __init__(
self,
access_key: str,
model_path: str
library_path: str,
endpoint_duration_sec: Optional[float] = 1.0,
enable_automatic_punctuation: bool = False) -> Cheetah

__init__ method for Cheetah Speech-to-Text engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • model_path str : Absolute path to the file containing model parameters.
  • library_path str : Absolute path to Cheetah's dynamic library.
  • endpoint_duration_sec float : Duration of endpoint in seconds.
  • enable_automatic_punctuation bool : Set to True to enable automatic punctuation insertion.

Returns

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

Throws

  • CheetahError

pvcheetah.Cheetah.delete()

def delete(self)

Releases resources acquired by Cheetah.


pvcheetah.Cheetah.process()

def process(self, pcm: Sequence[int]) -> Tuple[str, bool]

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 .frame_length. The incoming audio needs to have a sample rate equal to .sample_rate and be 16-bit linearly-encoded. Furthermore, Cheetah operates on single-channel audio.

Parameters

  • pcm Sequence[int] : A frame of audio samples.

Returns

  • Tuple[str, bool] : Any newly-transcribed speech (if none is available then an empty string is returned) and a flag indicating if an endpoint has been detected.

Throws

  • CheetahError

pvcheetah.Cheetah.flush()

def flush(self) -> str

Marks the end of the audio stream, flushes internal state of the object, and returns any remaining transcribed text.

Returns

  • str : Any remaining transcribed text. If none is available then an empty string is returned.

Throws

  • CheetahError

pvcheetah.CheetahError

class CheetahError(Exception)

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

Exceptions

class CheetahActivationError(CheetahError)
class CheetahActivationLimitError(CheetahError)
class CheetahActivationRefusedError(CheetahError)
class CheetahActivationThrottledError(CheetahError)
class CheetahIOError(CheetahError)
class CheetahInvalidArgumentError(CheetahError)
class CheetahInvalidStateError(CheetahError)
class CheetahKeyError(CheetahError)
class CheetahMemoryError(CheetahError)
class CheetahRuntimeError(CheetahError)
class CheetahStopIterationError(CheetahError)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Cheetah Speech-to-Text Python API
  • pvcheetah.create()
  • pvcheetah.Cheetah
  • version
  • frame_length
  • sample_rate
  • __init__()
  • delete()
  • process()
  • flush()
  • pvcheetah.CheetahError
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.