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
AndroidCiOSPythonWeb
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
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
Python API


API Reference for the Cobra Python SDK (PyPI ).


pvcobra.create()

def create(
access_key: str,
library_path: Optional[str] = None) -> Cobra

Factory method for the Cobra voice activity detection (VAD) engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console .
  • library_path Optional[str] : Absolute path to Cobra's dynamic library. If not set, it will be set to the default location.

Returns

  • Cobra : An instance of Cobra VAD engine.

pvcobra.Cobra

class Cobra(object)

Class for the Cobra VAD engine. Cobra can be initialized either using the module level create() function or directly using the class __init__() method. Resources should be cleaned when you are done using the delete() method.


pvcobra.Cobra.frame_length

self.frame_length: int

The number of audio samples per frame that Cobra accepts.


pvcobra.Cobra.sample_rate

self.sample_rate: int

The audio sample rate the Cobra accepts.


pvcobra.Cobra.version

self.version: str

The Cobra library version string.


pvcobra.Cobra.__init__()

def __init__(
self,
access_key: str,
library_path: str) -> Cobra

__init__ method for Cobra VAD engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console .
  • library_path str : Absolute path to Cobra's dynamic library.

Returns

  • Cobra : An instance of Cobra VAD engine.

Throws

  • CobraError

pvcobra.Cobra.delete()

def delete(self)

Releases resources acquired by Cobra.


pvcobra.Cobra.process()

def process(self, pcm: List[int]) -> float

Processes a frame of the incoming audio stream and emits the detection result. The required number of samples-per-frame can be obtained by calling .frame_length. The incoming audio needs to have a sample rate equal to .sample_rate and be 16-bit linearly-encoded. Cobra operates on single-channel audio.

Parameters

  • pcm List[int] : A frame of audio samples.

Returns

  • float : Probability of voice activity. It is a floating-point number within [0, 1].

Throws

  • CobraError

pvcobra.CobraError

class CobraError(Exception)

Error thrown if an error occurs within Cobra VAD engine.

Exceptions

class CobraActivationError(CobraError)
class CobraActivationLimitError(CobraError)
class CobraActivationRefusedError(CobraError)
class CobraActivationThrottledError(CobraError)
class CobraIOError(CobraError)
class CobraInvalidArgumentError(CobraError)
class CobraInvalidStateError(CobraError)
class CobraKeyError(CobraError)
class CobraMemoryError(CobraError)
class CobraRuntimeError(CobraError)
class CobraStopIterationError(CobraError)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Cobra Voice Activity Detection Python API
  • pvcobra.create()
  • pvcobra.Cobra
  • frame_length
  • sample_rate
  • version
  • __init__()
  • delete()
  • process()
  • pvcobra.CobraError
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.