# Cobra Voice Activity Detection Engine
Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
Cobra is a highly accurate and lightweight voice activity detection (VAD) engine.
## Compatibility
- Python 3.9+
- Runs on Linux (x86_64), macOS (x86_64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).
## Installation
```console
pip3 install pvcobra
```
## AccessKey
Cobra requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Cobra SDKs.
You can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.
Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.
## Usage
Create an instance of the engine
```python
import pvcobra
handle = pvcobra.create(access_key=${AccessKey})
```
Replace `${AccessKey}` with your AccessKey obtained from [Picovoice Console](https://console.picovoice.ai/). `handle` is
an instance of Cobra.
When initialized, the valid sample rate is given by `handle.sample_rate`. Expected frame length (number of audio samples
in an input array) is `handle.frame_length`. The engine accepts 16-bit linearly-encoded PCM and operates on
single-channel audio.
```python
def get_next_audio_frame():
pass
while True:
voice_probability = handle.process(get_next_audio_frame())
```
When done, resources have to be released explicitly:
```python
handle.delete()
```
## Demos
[pvcobrademo](https://pypi.org/project/pvcobrademo/) provides command-line utilities for processing real-time
audio (i.e. microphone) and files using Cobra.
Raw data
{
"_id": null,
"home_page": "https://github.com/Picovoice/cobra",
"name": "pvcobra",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "voice activity detection engine, VAD",
"author": "Picovoice",
"author_email": "hello@picovoice.ai",
"download_url": "https://files.pythonhosted.org/packages/d5/a2/790e0839a3040e6f1bccf4bca01efc67a96ce5e9af36c974a697f6ad7b22/pvcobra-2.0.5.tar.gz",
"platform": null,
"description": "# Cobra Voice Activity Detection Engine\n\nMade in Vancouver, Canada by [Picovoice](https://picovoice.ai)\n\nCobra is a highly accurate and lightweight voice activity detection (VAD) engine.\n\n## Compatibility\n\n- Python 3.9+\n- Runs on Linux (x86_64), macOS (x86_64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).\n\n## Installation\n\n```console\npip3 install pvcobra\n```\n\n## AccessKey\n\nCobra requires a valid Picovoice `AccessKey` at initialization. `AccessKey` acts as your credentials when using Cobra SDKs.\nYou can get your `AccessKey` for free. Make sure to keep your `AccessKey` secret.\nSignup or Login to [Picovoice Console](https://console.picovoice.ai/) to get your `AccessKey`.\n\n## Usage\n\nCreate an instance of the engine\n\n```python\nimport pvcobra\n\nhandle = pvcobra.create(access_key=${AccessKey})\n```\nReplace `${AccessKey}` with your AccessKey obtained from [Picovoice Console](https://console.picovoice.ai/). `handle` is\nan instance of Cobra.\n\nWhen initialized, the valid sample rate is given by `handle.sample_rate`. Expected frame length (number of audio samples\nin an input array) is `handle.frame_length`. The engine accepts 16-bit linearly-encoded PCM and operates on\nsingle-channel audio.\n\n```python\ndef get_next_audio_frame():\n pass\n\nwhile True:\n voice_probability = handle.process(get_next_audio_frame())\n```\n\nWhen done, resources have to be released explicitly:\n\n```python\nhandle.delete()\n```\n\n## Demos\n\n[pvcobrademo](https://pypi.org/project/pvcobrademo/) provides command-line utilities for processing real-time\naudio (i.e. microphone) and files using Cobra.\n",
"bugtrack_url": null,
"license": null,
"summary": "Cobra voice activity detection (VAD) engine",
"version": "2.0.5",
"project_urls": {
"Homepage": "https://github.com/Picovoice/cobra"
},
"split_keywords": [
"voice activity detection engine",
" vad"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "cd8b4483ba6a2a868e1c6c4471dfb167d45238c98811cb3e6198143f2093cea7",
"md5": "d0e8a11f097151417d43d51983751f3c",
"sha256": "2decb5b436f0ac26f4706c26086cc636a235249aabe5243c45a50d5c3df9c08b"
},
"downloads": -1,
"filename": "pvcobra-2.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d0e8a11f097151417d43d51983751f3c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 1947613,
"upload_time": "2025-02-05T23:59:40",
"upload_time_iso_8601": "2025-02-05T23:59:40.031312Z",
"url": "https://files.pythonhosted.org/packages/cd/8b/4483ba6a2a868e1c6c4471dfb167d45238c98811cb3e6198143f2093cea7/pvcobra-2.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d5a2790e0839a3040e6f1bccf4bca01efc67a96ce5e9af36c974a697f6ad7b22",
"md5": "fad370f4d697481489a1a31a102b9c6b",
"sha256": "4faa6a1aa507c440aa710fb150996b13e56760ecfc223777285c189bf0ee6320"
},
"downloads": -1,
"filename": "pvcobra-2.0.5.tar.gz",
"has_sig": false,
"md5_digest": "fad370f4d697481489a1a31a102b9c6b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 1948923,
"upload_time": "2025-02-05T23:59:42",
"upload_time_iso_8601": "2025-02-05T23:59:42.473836Z",
"url": "https://files.pythonhosted.org/packages/d5/a2/790e0839a3040e6f1bccf4bca01efc67a96ce5e9af36c974a697f6ad7b22/pvcobra-2.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-05 23:59:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Picovoice",
"github_project": "cobra",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pvcobra"
}