Cheetah - Go API
API Reference for the Cheetah Go SDK (pkg.go.dev)
cheetah.FrameLength
var FrameLength int
Number of audio samples per frame.
cheetah.SampleRate
var SampleRate int
Audio sample rate accepted by Cheetah.
cheetah.Version
var Version string
Cheetah version.
cheetah.Cheetah
type Cheetah struct
Struct for the Cheetah Speech-to-Text engine.
cheetah.Cheetah.AccessKey
var AccessKey string
AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
cheetah.Cheetah.ModelPath
var ModelPath string
Absolute path to the file containing model parameters.
cheetah.Cheetah.EndpointDuration
var EndpointDuration float32
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 0 to disable endpoint detection.
cheetah.Cheetah.Delete()
func (cheetah *Cheetah) Delete() error
Releases resources acquired by Cheetah.
Returns
error
: Error produced by the Cheetah SDK.nil
if no error was encountered.
cheetah.Cheetah.Flush()
func (cheetah *Cheetah) Flush() (string, error)
Marks the end of the audio stream, flushes internal state of the object, and returns any remaining transcribed text. Return any remaining transcribed text. If none is available then an empty string is returned.
Returns
string
: Any transcription text.error
: Error produced by the Cheetah SDK.nil
if no error was encountered.
cheetah.Cheetah.Init()
func (cheetah *Cheetah) Init() error
Init function for Cheetah. Must be called before attempting process.
Returns
error
: Error produced by the Cheetah SDK.nil
if no error was encountered.
cheetah.Cheetah.Process()
func (cheetah *Cheetah) Process(pcm []int16) (string, bool, error)
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.
Returns Any newly-transcribed speech (if none is available then an empty string is returned) and a flag indicating if
an endpoint has been detected.
Returns
string
: Any newly-transcribed speech.bool
: A flag indicating whether an endpoint has been detected.error
: Error produced by the Cheetah SDK.nil
if no error was encountered.
cheetah.NewCheetah()
func NewCheetah(accessKey string) Cheetah
Creates a Cheetah struct with default parameters.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
Returns
Cheetah
: An instance of Cheetah struct.
cheetah.CheetahError
type CheetahError struct
Custom error type for errors produced from the Cheetah Go SDK.
cheetah.CheetahError.Error()
func (e *CheetahError) Error() string
Formats the Cheetah error into a string.
Returns
string
: Formatted error string.
cheetah.PvStatus
type PvStatus struct
Status return codes from the Cheetah library. Possible values are:
const (SUCCESS PvStatus = 0OUT_OF_MEMORY PvStatus = 1IO_ERROR PvStatus = 2INVALID_ARGUMENT PvStatus = 3STOP_ITERATION PvStatus = 4KEY_ERROR PvStatus = 5INVALID_STATE PvStatus = 6RUNTIME_ERROR PvStatus = 7ACTIVATION_ERROR PvStatus = 8ACTIVATION_LIMIT_REACHED PvStatus = 9ACTIVATION_THROTTLED PvStatus = 10ACTIVATION_REFUSED PvStatus = 11)