Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Leopard Speech-to-Text
React Native API


API Reference for the React Native Leopard SDK (npm)


Leopard

class Leopard { }

Class for the Leopard Speech-to-Text engine.


Leopard.create()

public static async create(
accessKey: string,
modelPath: string,
options: LeopardOptions = {}
): Promise<Leopard>

Leopard constructor.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • modelPath string : Path to the file containing model parameters (.pv). Can be either a path that is relative to the assets/resource folder or an absolute path to the file on device.
  • options LeopardOptions : Optional configuration arguments:
    • enableAutomaticPunctuation boolean : Whether to enable automatic punctuation.

Returns

  • Promise<Leopard>: An instance of Leopard platform.

Leopard.delete()

async delete()

Releases resources acquired by Leopard.


Leopard.sampleRate

get sampleRate()

Getter for audio sample rate accepted by Leopard.

Returns

  • number: Audio sample rate accepted by Leopard.

Leopard.version

get version()

Getter for version.

Returns

  • string: Current Leopard version.

Leopard.process()

async process(frame: number[]): Promise<LeopardTranscript>

Processes given audio data with the speech-to-text engine. The incoming audio needs to have a sample rate equal to .sampleRate and be 16-bit linearly-encoded. Leopard operates on single-channel audio.

Parameters

  • frame number[] : A frame of audio samples.

Returns

  • Promise<LeopardTranscript>: LeopardTranscript object which contains the transcription results of the engine.

Leopard.processFile()

async processFile(audioPath: string): Promise<string>

Processes an audio file with the speech-to-text engine.

Parameters

  • audioPath string : Absolute path to the audio file. The supported formats are: 3gp (AMR), FLAC, MP3, MP4/m4a (AAC), Ogg, WAV and WebM.

Returns

  • Promise<LeopardTranscript>: LeopardTranscript object which contains the transcription results of the engine.

LeopardError

class LeopardError extends Error { }

Exception thrown if an error occurs within Leopard Speech-to-Text engine.

Exceptions:

class LeopardActivationError extends LeopardError { }
class LeopardActivationLimitError extends LeopardError { }
class LeopardActivationRefusedError extends LeopardError { }
class LeopardActivationThrottledError extends LeopardError { }
class LeopardIOError extends LeopardError { }
class LeopardInvalidArgumentError extends LeopardError { }
class LeopardInvalidStateError extends LeopardError { }
class LeopardKeyError extends LeopardError { }
class LeopardMemoryError extends LeopardError { }
class LeopardRuntimeError extends LeopardError { }
class LeopardStopIterationError extends LeopardError { }

LeopardOptions

type LeopardOptions = {
enableAutomaticPunctuation?: boolean;
}

Class containing optional configuration parameters for Leopard.

  • enableAutomaticPunctuation boolean : Flag to enable automatic punctuation insertion.

LeopardTranscript

type LeopardTranscript = {
transcript: string;
words: LeopardWord[];
}

Class containing results from a Leopard process function.

  • transcript string : Inferred transcription.
  • words LeopardWord[] : Transcribed words and their associated metadata.

LeopardWord

type LeopardWord = {
word: string;
startSec: number;
endSec: number;
confidence: number;
}

Class containing results word transcribed by Leopard and their associated metadata.

  • word string : Transcribed word.
  • startSec number : Start of word in seconds.
  • endSec number : End of word in seconds.
  • confidenc number : Transcription confidence. It is a number within [0, 1].

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Leopard Speech-to-Text React Native API
  • Leopard
  • create()
  • delete()
  • sampleRate
  • version
  • process()
  • processFile()
  • LeopardError
  • LeopardOptions
  • LeopardTranscript
  • LeopardWord
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.