Picovoice Wordmark
Start Free
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice CheetahAzure Real-Time Speech-to-TextAmazon Transcribe StreamingGoogle Streaming ASRMoonshine StreamingVosk StreamingWhisper.cpp Streaming
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice OrcaChatterbox-TTS-TurboKokoro-TTSKitten-TTS-Nano-0.8-INT8Pocket-TTSNeu-TTS-Nano-Q4-GGUFPiper-TTSSoprano-TTSSupertonic-TTS-2ESpeak-NG
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrain
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice PorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidArduinoC.NETiOSLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSMicrocontrollerNode.jsPythonWeb
SummaryPicovoice CobraWebRTC VADSilero VAD
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Leopard Speech-to-Text
React API

API Reference for the Leopard React SDK (npmjs).


useLeopard()

function useLeopard(): {
result: LeopardTranscript | null;
isLoaded: boolean;
error: Error | null;
init: (
accessKey: string,
model: LeopardModel,
options?: LeopardOptions,
) => Promise<void>;
processFile: (file: File) => Promise<void>;
startRecording: (maxRecordingSec?: number) => Promise<void>;
stopRecording: () => Promise<void>;
isRecording: boolean;
recordingElapsedSec: number;
release: () => Promise<void>;
}

React Hook for Leopard speech-to-text engine.

Returns

  • result LeopardTranscript | null : A state containing the transcript result value.
  • isLoaded boolean : A state indicating whether the engine has initialized successfully.
  • error Error | null : An Error object containing details about the error.
  • init (...) => Promise<void> : A method to initialize Leopard given the arguments. See init.
  • processFile (...) => Promise<void> : A method to process audio files. See processFile.
  • startRecording (...) => Promise<void> : A method to start recording audio. See startRecording.
  • stopRecording () => Promise<void> : A method to stop recording audio and begin processing. See stopRecording.
  • isRecording boolean : A state indicating whether webVoiceProcessor is passing audio to the engine.
  • recordingElapsedSec number : The amount of time (in seconds) elapsed while recording.
  • release () => Promise<void> : Releases resources acquired by useLeopard. See release.

init()

async function init(
accessKey: string,
model: LeopardModel,
options: LeopardOptions = {},
): Promise<void>

Initializes useLeopard hook. Sets isLoaded to true.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • model LeopardModel : Object containing Leopard model.
  • options LeopardOptions : Optional configuration arguments.

processFile()

async function processFile(
file: File
): Promise<void>

Processes an audio file, which should be provided as a File object with a MIME type of audio and encoded in linear PCM format.

Parameters

  • file File : File object with the MIME type = audio.

startRecording()

async function startRecording(
maxRecordingSec: number = 120
): Promise<void>

Start recording audio. If started, isRecording is set to true.

Parameters

  • maxRecordingSec number : Optional configuration argument to set the maximum time in seconds Leopard is able to record. If unspecified, a default value of 120 will be used. This is to prevent unbounded memory usage.

stopRecording()

async function stopRecording(): Promise<void>

Stop recording audio and begin processing the buffered audio. Sets isRecording to false.

release()

function release(): Promise<void>

Releases resources acquired by the useLeopard. Sets isLoaded and isRecording to false, recordingElapsedSec to 0, and error to null.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Leopard Speech-to-Text React API
  • useLeopard()
  • init()
  • processFile()
  • startRecording()
  • stopRecording()
  • release()
© 2019-2026 Picovoice Inc.PrivacyTerms