Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
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()
Voice AI
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.