Cheetah Speech-to-Text
iOS API
API Reference for the iOS Cheetah SDK (Cocoapod)
Cheetah
Class for the Cheetah Speech-to-Text engine.
Resources should be cleaned when you are done using the delete()
function.
Cheetah.init()
init
method for Cheetah Speech-to-Text engine with a mixture of arguments.
Parameters
accessKey
String : The AccessKey obtained from Picovoice Console.modelPath
String : Absolute path to file containing model parameters (.pv
).endpointDuration
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 duration to 0 to disable this. Default is 1 second.enableAutomaticPunctuation
Bool : Set totrue
to enable automatic punctuation insertion.
Throws
CheetahError
: If an error occurs while creating an instance of Cheetah Speech-to-Text engine.
Parameters
accessKey
String : The AccessKey obtained from Picovoice Console.modelURL
URL : URL to file containing model parameters (.pv
).endpointDuration
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 duration to 0 to disable this. Default is 1 second.enableAutomaticPunctuation
Bool : Set totrue
to enable automatic punctuation insertion.
Throws
CheetahError
: If an error occurs while creating an instance of Cheetah Speech-to-Text engine.
Cheetah.delete()
Releases resources acquired by the Cheetah engine.
Cheetah.process()
Process a frame of audio with the Cheetah Speech-to-Text engine.
Parameters
pcm
[Int16] : The number of samples per frame can be attained by callingCheetah.frameLength
. The incoming audio needs to have a sample rate equal toCheetah.sampleRate
and be 16-bit linearly-encoded. Furthermore, Cheetah operates on single-channel audio.
Returns
- (String, bool) : Tuple of 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
: If there is an error while processing the audio frame.
Cheetah.flush()
Marks the end of the audio stream, flushes internal state of the object, and returns any remaining transcribed text.
Returns
- String : Any remaining transcribed text. If none is available then an empty string is returned.
Throws
CheetahError
: If there is an error while processing.
Cheetah.frameLength
The number of audio samples per frame.
Cheetah.sampleRate
Audio sample rate accepted by Cheetah.
Cheetah.version
Current Cheetah version.
CheetahError
Error thrown if an error occurs within Cheetah Speech-to-Text engine.