Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
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 NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Cobra Voice Activity Detection
Android API

API Reference for the Android Cobra SDK (cobra-android)

package: ai.picovoice.cobra


Cobra

public class Cobra { }

Class for the Cobra VAD engine.

Cobra must be initialized using the constructor. Resources should be cleaned when you are done using the delete() function.


Cobra.Cobra()

public Cobra(String accessKey) throws CobraException

Constructor for the Cobra VAD engine.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.

Returns

  • Cobra : Returns an instance of Cobra.

Throws

  • CobraException: If an error occurs while creating an instance of Cobra VAD engine.

Cobra.getFrameLength()

public int getFrameLength();

Getter for required number of audio samples per frame.

Returns

  • int : Required number of audio samples per frame.

Cobra.getSampleRate()

public int getSampleRate();

Getter for required audio sample rate

Returns

  • int : Required audio sample rate.

Cobra.getVersion()

public String getVersion();

Getter for Cobra version.

Returns

  • String : Cobra version.

Cobra.delete()

public void delete();

Releases resources acquired by Cobra.


Cobra.process()

public float process(short[] pcm) throws CobraException

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 .getFrameLength(). The incoming audio needs to have a sample rate equal to .getSampleRate() 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: If an error occurs while processing.

CobraException

public class CobraException extends Exception { }

Exception thrown if an error occurs within Cobra VAD engine.

Exceptions

public class CobraActivationException extends CobraException { }
public class CobraActivationLimitException extends CobraException { }
public class CobraActivationRefusedException extends CobraException { }
public class CobraActivationThrottledException extends CobraException { }
public class CobraIOException extends CobraException { }
public class CobraInvalidArgumentException extends CobraException { }
public class CobraInvalidStateException extends CobraException { }
public class CobraKeyException extends CobraException { }
public class CobraMemoryException extends CobraException { }
public class CobraRuntimeException extends CobraException { }
public class CobraStopIterationException extends CobraException { }

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Cobra Voice Activity Detection Android API
  • Cobra
  • Cobra()
  • getFrameLength()
  • getSampleRate()
  • getVersion()
  • delete()
  • process()
  • CobraException
Voice AI
  • 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
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
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.