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 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)
FAQGlossary

Cobra Voice Activity Detection
Web API


API Reference for the Cobra Web SDK (npm ).


Cobra

class Cobra {}

Class for the Cobra VAD engine.


Cobra.create()

static async function create(
accessKey: string,
voiceProbabilityCallback: (voiceProbability: number) => void,
options: CobraOptions = {}
): Promise<Cobra>

Creates an instance of the Cobra voice activity detection (VAD) engine.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console .
  • voiceProbabilityCallback (voiceProbability: number) => void : User-defined callback invoked when a frame of audio is processed. The callback provides a single parameter 'voiceProbability': a floating-point number within [0, 1].
  • options CobraOptions : Optional configuration arguments.

Returns

  • Cobra : An instance of the Cobra engine.

Cobra.process()

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

Processes a frame of audio. The required sample rate can be retrieved from 'sampleRate' and the length of frame (number of audio samples per frame) can be retrieved from 'frameLength'. The audio must be single-channel and 16-bit linearly-encoded.

The voice probability result will be supplied via the voiceProbabilityCallback that was passed into Cobra.create().

Parameters

  • pcm Int16Array : A frame of audio samples.

Cobra.release()

async function release(): Promise<void>

Releases resources acquired by the Cobra Web SDK.


Cobra.frameLength

get framelength(): number

Number of audio samples per frame.


Cobra.sampleRate

get sampleRate(): number

Audio sample rate accepted by Cobra.


Cobra.version

get version(): string

Cobra version string.


CobraOptions

type CheetahOptions = {
processErrorCallback?: (error: string) => void
}

Cobra options type.

  • processErrorCallback boolean : User-defined callback invoked if any error happens while processing the audio stream. Its only input argument is the error message. NOTE: This is only used by CobraWorker.

CobraWorker

class CobraWorker {}

A class for running the Cobra VAD engine as a web worker thread.


CobraWorker.create()

static async function create(
accessKey: string,
voiceProbabilityCallback: (voiceProbability: number) => void,
options: CobraOptions = {}
): Promise<CobraWorker>

Creates an instance of CobraWorker.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console .
  • voiceProbabilityCallback (voiceProbability: number) => void : User-defined callback invoked when a frame of audio is processed. The callback provides a single parameter 'voiceProbability': a floating-point number within [0, 1].
  • options CobraOptions : Optional configuration arguments.

Returns

  • CobraWorker : An instance of CobraWorker.

CobraWorker.process()

async function process(pcm: Int16Array): void

Processes a frame of audio. The required sample rate can be retrieved from 'sampleRate' and the length of frame (number of audio samples per frame) can be retrieved from 'frameLength'. The audio must be single-channel and 16-bit linearly-encoded.

The voice probability result will be supplied via the voiceProbabilityCallback that was passed into CobraWorker.create().

Parameters

  • pcm Int16Array : A frame of audio samples.

CobraWorker.release()

async function release(): Promise<void>

Releases resources acquired by the Cobra Web SDK.


CobraWorker.terminate()

async function terminate(): Promise<void>

Force terminates the instance of CobraWorker.


CobraWorker.frameLength

get frameLength(): number

Number of audio samples per frame.


CobraWorker.sampleRate

get sampleRate(): number

Audio sample rate accepted by Cobra.


CobraWorker.version

get version(): string

Cobra version string.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Cobra Voice Activity Detection Web API
  • Cobra
  • create()
  • process()
  • release()
  • frameLength
  • sampleRate
  • version
  • CobraOptions
  • CobraWorker
  • create()
  • process()
  • release()
  • terminate()
  • frameLength
  • sampleRate
  • version
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Enterprise Support Add-on
  • Developer
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.