Picovoice Wordmark
Start Building
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 GoiOSJavaNVIDIA JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
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
AndroidCiOSNVIDIA JetsonLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSNVIDIA JetsonLinuxmacOSPythonRaspberry PiWebWindows
AndroidCPythoniOSWeb
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)
Introduction
AndroidC.NETFlutterlink to GoiOSNodejsPythonReact NativeRustUnityWeb
AndroidC.NETFlutterlink to GoiOSNodejsPythonReact NativeRustUnityWeb
FAQGlossary

Voice Processor
Web API

API Reference for the Voice Processor Web SDK (npmjs ).


PvEngine

type PvEngine = {
onmessage?: ((e: MessageEvent) => any) | null;
postMessage?: (e: any) => void;
worker?: {
onmessage?: ((e: MessageEvent) => any) | null;
postMessage?: (e: any) => void;
}
}

Type that represents an engine that can receive frames of audio by subscribing to WebVoiceProcessor.


WebVoiceProcessor

class WebVoiceProcessor { }

Class for capturing audio and delivering audio data to subscribing audio processing engines.


WebVoiceProcessor.audioContext

static get audioContext(): AudioContext | null

Gets the current audio context.


WebVoiceProcessor.isRecording

static get isRecording(): boolean

Flag to check if WebVoiceProcessor is currently recording.


WebVoiceProcessor.audioDump()

public static async audioDump(durationMs: number = 3000): Promise<Blob>

Record some sample raw signed 16-bit PCM data for some duration, then pack it as a Blob.

Parameters

  • durationMs number : Duration of the recording, in milliseconds.

Returns

  • Promise<Blob> : The audio data in Blob format, wrapped in a Promise.

WebVoiceProcessor.subscribe()

public static async subscribe(engines: PvEngine | PvEngine[]): Promise<void>

Subscribe one or more engines. A subscribed engine will receive audio frames via .postMessage({command: 'process', inputFrame: inputFrame}). Audio capture will start as soon as there is one or more engine subscribed.

Parameters

  • engines PvEngine | PvEngine[] : The engine(s) to subscribe.

WebVoiceProcessor.unsubscribe()

public static async unsubscribe(engines: PvEngine | PvEngine[]): Promise<void>

Unsubscribe one or more engines. The unsubscribed engines will no longer receive audio frames. Audio capture will stop as soon as there is no more engines subscribed.

Parameters

  • engines PvEngine | PvEngine[] : The engine(s) to unsubscribe.

WebVoiceProcessor.reset()

static async reset(): Promise<void>

Removes all engines and stops recording audio.


WebVoiceProcessor.setOptions()

static setOptions(options: WebVoiceProcessorOptions, forceUpdate = false): void

Set new WebVoiceProcessor options. If forceUpdate is not set to true, all engines must be unsubscribed and subscribed again in order for the recorder to take the new changes. Using forceUpdate might cause a small gap where audio frames are not received.

Parameters

  • options WebVoiceProcessorOptions : Audio configuration for recording.
  • forceUpdate boolean : Flag to force update recorder with new options.

WebVoiceProcessorOptions

type WebVoiceProcessorOptions = {
frameLength?: number;
outputSampleRate?: number;
deviceId?: string | null;
filterOrder?: number
};

Type containing the audio recording configuration use by WebVoiceProcessor.

Parameters

  • frameLength number : Number of samples per frame of audio (default: 512).
  • outputSampleRate number : Target sample rate of recorded audio (default: 16000).
  • deviceId string | null : Microphone id to use (can be fetched with mediaDevices.enumerateDevices).
  • filterOrder number : Filter order (default: 50).

WvpError

class WvpError extends Error { }

Class the represents errors produced by WebVoiceProcessor.


WvpMessageEvent

type WvpMessageEvent = {
command: 'process',
inputFrame: Int16Array
};

Class that represents the message an engine receives when a frame of audio is captured by WebVoiceProcessor.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Voice Processor Web API
  • PvEngine
  • WebVoiceProcessor
  • audioContext
  • isRecording
  • audioDump()
  • subscribe()
  • unsubscribe()
  • reset()
  • setOptions()
  • WebVoiceProcessorOptions
  • WvpError
  • WvpMessageEvent
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Koala Noise Suppression
  • Eagle Speaker RecognitionBETA
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
  • Orca Text-to-SpeechWAITLIST
  • Falcon Speaker DiarizationWAITLIST
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
Sales & Services
  • Consulting
  • Developer Plan
  • Enterprise Plan
  • Support Add-on
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.