Cheetah Speech-to-Text
React API
API Reference for the Cheetah React SDK (npmjs).
useCheetah()
React Hook for Cheetah speech-to-text engine.
Returns
resultObject | null : Any newly-transcribed speech and a flag indicating if a transcription is complete.result.transcriptstring : A string value representing newly-transcribed speech. If none is available, an empty string is returned.result.wordsCheetahWord[]| undefined : A list of transcribed words with their associated metadata. Will be undefined, unless processing with annotations.result.isCompleteboolean | undefined : A flag representing whether the current result represents an endpoint (a chunk of audio after an utterance without any speech in it).isLoadedboolean : A state indicating whether the engine is initialized successfully.isListeningboolean : A state indicating whether thewebVoiceProcessoris passing audio to the engine.errorError | null : An Error object containing details about the error.init(...) => Promise<void> : A method to initializeCheetahgiven the arguments. Seeinit.start(...) => Promise<void> : A method to start recording and processing audio. Seestart.startAnnotated(...) => Promise<void> : A method to start recording and processing audio with annotations. SeestartAnnotated.stop() => Promise<void> : A method to stop recording and processing audio. Seestop.release() => Promise<void> : Releases resources acquired byuseCheetah. Seerelease.
init()
Initializes useCheetah hook. Sets isLoaded to true.
Parameters
accessKeystring : AccessKey obtained from Picovoice Console.modelCheetahModel : Object containing Cheetah model.optionsCheetahOptions : Optional configuration arguments.
start()
Start recording and processing audio. If started, isListening is set to true.
startAnnotated()
Start recording and processing audio with annotations. If started, isListening is set to true.
stop()
Stop recording and processing audio. Sets isListening to false. Will resolve its promise after the flushed frame is returned.
release()
Releases resources acquired by the useCheetah.