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
Web API


API Reference for the Leopard Web SDK(leopard-web)


Leopard

class Leopard {}

Class for the Leopard Speech-to-Text engine.


Leopard.create()

static async function create(
accessKey: string,
model: LeopardModel,
options: LeopardOptions = {}
): Promise<Leopard>

Creates an instance of Leopard Speech-to-Text engine using '.pv' file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

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

Returns

  • Leopard : An instance of the Leopard engine.

Leopard.process()

async function process(pcm: Int16Array): Promise<LeopardTranscript>

Processes audio. The required sample rate can be retrieved from '.sampleRate'. The audio needs to be 16-bit linearly-encoded. Furthermore, the engine operates on single-channel audio.

Parameters

  • pcm Int16Array : Audio data.

Returns

  • LeopardTranscript : The inferred transcript with metadata.

Leopard.release()

async function release(): Promise<void>

Releases resources acquired by the Leopard Web SDK.


Leopard.sampleRate

get sampleRate(): number

Audio sample rate accepted by Leopard.


Leopard.version

get version(): string

Leopard version string.


LeopardModel

type LeopardModel = {
base64?: string;
publicPath?: string;
customWritePath?: string;
forceWrite?: boolean;
version?: number;
}

Leopard model type.

  • base64 string: The model file (.pv) in base64 string to initialize Leopard.
  • publicPath string: The model file (.pv) path relative to the public directory.
  • customWritePath string : Custom path to save the model in storage. Set to a different name to use multiple models across leopard instances.
  • forceWrite boolean : Flag to overwrite the model in storage even if it exists.
  • version number : Version of the model file. Increment to update the model file in storage.

LeopardOptions

type LeopardOptions = {
enableAutomaticPunctuation?: boolean;
}

Leopard options type.

  • enableAutomaticPunctuation boolean : Flag to enable automatic punctuation insertion.

LeopardTranscript

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

Leopard transcript type.

  • transcript string : Inferred transcript of process.
  • words LeopardWord[] : Metadata of the transcript.

LeopardWord

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

Leopard metadata type.

  • word string : A word in the transcript.
  • startSec number : Position in seconds where the word starts.
  • endSec number : Position in seconds where the word ends.
  • confidence number : Number between 0 and 1, indication the confidence level of the word.

LeopardWorker

class LeopardWorker {}

A class for creating new instances of the LeopardWorker.


LeopardWorker.create()

static async create(
accessKey: string,
model: LeopardModel,
options: LeopardOptions = {},
): Promise<LeopardWorker>

Creates an instance of LeopardWorker using '.pv' file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

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

Returns

  • LeopardWorker : An instance of LeopardWorker.

LeopardWorker.process()

async function process(
pcm: Int16Array,
options: { transfer?: boolean, transferCallback?: (data: Int16Array) => void }
): Promise<LeopardTranscript>

Processes audio. The required sample rate can be retrieved from '.sampleRate'. The audio needs to be 16-bit linearly-encoded. Furthermore, the engine operates on single-channel audio.

Parameters

  • pcm Int16Array : Audio data.
  • options Object : Optional process arguments.
  • options.transfer boolean : Optional flag to indicate if the buffer should be transferred or not. If set to true, input buffer array will be transferred to the worker.
  • options.transferCallback (pcm: Int16Array) => void : Optional callback containing a new Int16Array with contents from pcm. Use this callback to get the input pcm when using transfer.

Returns

  • LeopardTranscript : The inferred transcript with metadata.

LeopardWorker.release()

async function release(): Promise<void>

Releases resources acquired by the Leopard Web SDK.


LeopardWorker.terminate()

async function terminate(): Promise<void>

Force terminates the instance of LeopardWorker.


LeopardWorker.sampleRate

get sampleRate(): number

Audio sample rate accepted by Leopard.


LeopardWorker.version

get version(): string

Leopard version string.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Leopard Speech-to-Text Web API
  • Leopard
  • create()
  • process()
  • release()
  • sampleRate
  • version
  • LeopardModel
  • LeopardOptions
  • LeopardTranscript
  • LeopardWord
  • LeopardWorker
  • create()
  • process()
  • release()
  • terminate()
  • sampleRate
  • version
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.