Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeWeb
SummaryPicovoice CheetahAzure Real-Time Speech-to-TextAmazon Transcribe StreamingGoogle Streaming ASR
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice PorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeSafariWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidArduinoC.NETiOSLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSMicrocontrollerNode.jsPythonWeb
SummaryPicovoice CobraWebRTC VADSilero VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Cobra Voice Activity Detection
.NET API

API Reference for the Cobra .NET SDK (NuGet).


Cobra

public class Cobra : IDisposable { }

Class for the Cobra VAD engine.


Cobra.Cobra()

public Cobra(
string accessKey,
string device = null)

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

Parameters

  • accessKey str : AccessKey obtained from Picovoice Console.
  • device string : String representation of the device (e.g., CPU or GPU) to use. If set to best, the most suitable device is selected automatically. If set to gpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument to gpu:${GPU_INDEX}, where ${GPU_INDEX} is the index of the target GPU. If set to cpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument to cpu:${NUM_THREADS}, where ${NUM_THREADS} is the desired number of threads.

Returns

  • Cobra : An instance of Cobra VAD engine.

Throws

  • CobraException

Cobra.FrameLength

public Int32 FrameLength { get; private set; }

The number of audio samples per frame that Cobra accepts.


Cobra.SampleRate

public Int32 SampleRate { get; private set; }

The audio sample rate the Cobra accepts.


Cobra.Version

public string Version { get; private set; }

The Cobra library version string.


Cobra.GetAvailableDevices()

public static string[] GetAvailableDevices()

Retrieves a list of hardware devices that can be specified when constructing Cobra.

Returns

  • string[]: An array of available hardware devices.

Throws

  • CobraException: If an error occurs while retrieving the hardware devices.

Cobra.Dispose()

public void Dispose()

Releases resources acquired by Cobra.


Cobra.Process()

public float Process(short[] pcm)

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 .FrameLength. The incoming audio needs to have a sample rate equal to .SampleRate and be 16-bit linearly-encoded. Cobra operates on single-channel audio.

Parameters

  • pcm short[] : A frame of audio samples.

Returns

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

Throws

  • CobraException

CobraException

public class CobraException : Exception

Error thrown if an error occurs within Cobra VAD engine.

Exceptions

class CobraActivationException(CobraException)
class CobraActivationLimitException(CobraException)
class CobraActivationRefusedException(CobraException)
class CobraActivationThrottledException(CobraException)
class CobraIOException(CobraException)
class CobraInvalidArgumentException(CobraException)
class CobraInvalidStateException(CobraException)
class CobraKeyException(CobraException)
class CobraMemoryException(CobraException)
class CobraRuntimeException(CobraException)
class CobraStopIterationException(CobraException)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Cobra Voice Activity Detection .NET API
  • Cobra
  • Cobra.Cobra()
  • FrameLength
  • SampleRate
  • Version
  • GetAvailableDevices()
  • Dispose()
  • Process()
  • CobraException
Voice AI
  • picoLLM On-Device LLM
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.