pvcobrademo


Namepvcobrademo JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://github.com/Picovoice/cobra
SummaryCobra voice activity detection (VAD) engine demos.
upload_time2024-01-30 23:32:43
maintainer
docs_urlNone
authorPicovoice
requires_python>=3.5
license
keywords voice activity detection engine vad
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cobra Voice Activity Detection engine

Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)

This package contains demos and commandline utilities for processing real-time audio (i.e. microphone) and audio files
using Cobra voice activity detection engine.

## Cobra

Cobra is a highly accurate and lightweight voice activity detection (VAD) engine.

## Compatibility

- Python 3.7+
- Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), Raspberry Pi, NVIDIA Jetson (Nano), and BeagleBone.

## 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`.

## Installation


```console
sudo pip3 install pvcobrademo
```

## Usage

### Microphone Demo

The Microphone demo opens an audio stream from a microphone and detects voice activities. The following opens the default microphone:

```console
cobra_demo_mic --access_key {AccessKey}
```

where `{AccessKey}` is an AccessKey which should be obtained from [Picovoice Console](https://console.picovoice.ai/). It is possible that the default audio input device recognized by `pvrecorder` is not the one being used. There are a couple of debugging facilities baked into the demo application to solve this. First, type the following into the console:

```console
cobra_demo_mic --show_audio_devices
```

It provides information about various audio input devices on the box. On a Linux box, this is the console output:

```
'index': '0', 'name': 'HDA Intel PCH: ALC892 Analog (hw:0,0)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '2'
'index': '1', 'name': 'HDA Intel PCH: ALC892 Alt Analog (hw:0,2)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '2'
'index': '2', 'name': 'HDA NVidia: HDMI 0 (hw:1,3)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '3', 'name': 'HDA NVidia: HDMI 1 (hw:1,7)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '4', 'name': 'HDA NVidia: HDMI 2 (hw:1,8)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '5', 'name': 'HDA NVidia: HDMI 3 (hw:1,9)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '6', 'name': 'HDA NVidia: HDMI 0 (hw:2,3)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '7', 'name': 'HDA NVidia: HDMI 1 (hw:2,7)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '8', 'name': 'HDA NVidia: HDMI 2 (hw:2,8)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '9', 'name': 'HDA NVidia: HDMI 3 (hw:2,9)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '10', 'name': 'Logitech USB Headset: Audio (hw:3,0)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '1'
'index': '11', 'name': 'sysdefault', 'defaultSampleRate': '48000.0', 'maxInputChannels': '128'
'index': '12', 'name': 'front', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '13', 'name': 'surround21', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '14', 'name': 'surround40', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '15', 'name': 'surround41', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '16', 'name': 'surround50', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '17', 'name': 'surround51', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '18', 'name': 'surround71', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'
'index': '19', 'name': 'pulse', 'defaultSampleRate': '44100.0', 'maxInputChannels': '32'
'index': '20', 'name': 'dmix', 'defaultSampleRate': '48000.0', 'maxInputChannels': '0'
'index': '21', 'name': 'default', 'defaultSampleRate': '44100.0', 'maxInputChannels': '32'
``` 

It can be seen that the last device (index 21) is considered default. But on this machine, a headset is being used as 
the input device which has an index of 10. After finding the correct index the demo application can be invoked as below:

```console
cobra_demo_mic --access_key {AccessKey} --audio_device_index 10
```

If the problem persists we suggest storing the recorded audio into a file for inspection. This can be achieved by:

```console
cobra_demo_mic --access_key {AccessKey} --audio_device_index 10 --output_path ~/test.wav
```

If after listening to stored file there is no apparent problem detected please open an issue.

### File Demo

It allows testing Cobra on a corpus of audio files. The demo is mainly useful for quantitative performance
benchmarking. It accepts 16kHz audio files. Cobra processes a single-channel audio stream if a stereo file is
provided it only processes the first (left) channel. The following processes a file looking for voice activities:

```console
cobra_demo_file --access_key {AccessKey} --input_audio_path ${AUDIO_PATH}
```
where `{AccessKey}` is an AccessKey which should be obtained from [Picovoice Console](https://console.picovoice.ai/). The threshold of the engine can be tuned using the `threshold` input argument:

```console
cobra_demo_file --access_key {AccessKey} --input_audio_path ${AUDIO_PATH} \
 --threshold 0.9
```

Threshold is a floating point number within `[0, 1]`. A higher threshold reduces the miss rate at the cost of increased false alarm rate.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Picovoice/cobra",
    "name": "pvcobrademo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "voice activity detection engine,VAD",
    "author": "Picovoice",
    "author_email": "hello@picovoice.ai",
    "download_url": "https://files.pythonhosted.org/packages/52/d5/6322daa2d7d9ff3c06875d3ccadc4a092333c1cc33bc34f4c8dfbbe9451f/pvcobrademo-2.0.2.tar.gz",
    "platform": null,
    "description": "# Cobra Voice Activity Detection engine\n\nMade in Vancouver, Canada by [Picovoice](https://picovoice.ai)\n\nThis package contains demos and commandline utilities for processing real-time audio (i.e. microphone) and audio files\nusing Cobra voice activity detection engine.\n\n## Cobra\n\nCobra is a highly accurate and lightweight voice activity detection (VAD) engine.\n\n## Compatibility\n\n- Python 3.7+\n- Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), Raspberry Pi, NVIDIA Jetson (Nano), and BeagleBone.\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## Installation\n\n\n```console\nsudo pip3 install pvcobrademo\n```\n\n## Usage\n\n### Microphone Demo\n\nThe Microphone demo opens an audio stream from a microphone and detects voice activities. The following opens the default microphone:\n\n```console\ncobra_demo_mic --access_key {AccessKey}\n```\n\nwhere `{AccessKey}` is an AccessKey which should be obtained from [Picovoice Console](https://console.picovoice.ai/). It is possible that the default audio input device recognized by `pvrecorder` is not the one being used. There are a couple of debugging facilities baked into the demo application to solve this. First, type the following into the console:\n\n```console\ncobra_demo_mic --show_audio_devices\n```\n\nIt provides information about various audio input devices on the box. On a Linux box, this is the console output:\n\n```\n'index': '0', 'name': 'HDA Intel PCH: ALC892 Analog (hw:0,0)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '2'\n'index': '1', 'name': 'HDA Intel PCH: ALC892 Alt Analog (hw:0,2)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '2'\n'index': '2', 'name': 'HDA NVidia: HDMI 0 (hw:1,3)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '3', 'name': 'HDA NVidia: HDMI 1 (hw:1,7)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '4', 'name': 'HDA NVidia: HDMI 2 (hw:1,8)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '5', 'name': 'HDA NVidia: HDMI 3 (hw:1,9)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '6', 'name': 'HDA NVidia: HDMI 0 (hw:2,3)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '7', 'name': 'HDA NVidia: HDMI 1 (hw:2,7)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '8', 'name': 'HDA NVidia: HDMI 2 (hw:2,8)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '9', 'name': 'HDA NVidia: HDMI 3 (hw:2,9)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '10', 'name': 'Logitech USB Headset: Audio (hw:3,0)', 'defaultSampleRate': '44100.0', 'maxInputChannels': '1'\n'index': '11', 'name': 'sysdefault', 'defaultSampleRate': '48000.0', 'maxInputChannels': '128'\n'index': '12', 'name': 'front', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '13', 'name': 'surround21', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '14', 'name': 'surround40', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '15', 'name': 'surround41', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '16', 'name': 'surround50', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '17', 'name': 'surround51', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '18', 'name': 'surround71', 'defaultSampleRate': '44100.0', 'maxInputChannels': '0'\n'index': '19', 'name': 'pulse', 'defaultSampleRate': '44100.0', 'maxInputChannels': '32'\n'index': '20', 'name': 'dmix', 'defaultSampleRate': '48000.0', 'maxInputChannels': '0'\n'index': '21', 'name': 'default', 'defaultSampleRate': '44100.0', 'maxInputChannels': '32'\n``` \n\nIt can be seen that the last device (index 21) is considered default. But on this machine, a headset is being used as \nthe input device which has an index of 10. After finding the correct index the demo application can be invoked as below:\n\n```console\ncobra_demo_mic --access_key {AccessKey} --audio_device_index 10\n```\n\nIf the problem persists we suggest storing the recorded audio into a file for inspection. This can be achieved by:\n\n```console\ncobra_demo_mic --access_key {AccessKey} --audio_device_index 10 --output_path ~/test.wav\n```\n\nIf after listening to stored file there is no apparent problem detected please open an issue.\n\n### File Demo\n\nIt allows testing Cobra on a corpus of audio files. The demo is mainly useful for quantitative performance\nbenchmarking. It accepts 16kHz audio files. Cobra processes a single-channel audio stream if a stereo file is\nprovided it only processes the first (left) channel. The following processes a file looking for voice activities:\n\n```console\ncobra_demo_file --access_key {AccessKey} --input_audio_path ${AUDIO_PATH}\n```\nwhere `{AccessKey}` is an AccessKey which should be obtained from [Picovoice Console](https://console.picovoice.ai/). The threshold of the engine can be tuned using the `threshold` input argument:\n\n```console\ncobra_demo_file --access_key {AccessKey} --input_audio_path ${AUDIO_PATH} \\\n --threshold 0.9\n```\n\nThreshold is a floating point number within `[0, 1]`. A higher threshold reduces the miss rate at the cost of increased false alarm rate.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Cobra voice activity detection (VAD) engine demos.",
    "version": "2.0.2",
    "project_urls": {
        "Homepage": "https://github.com/Picovoice/cobra"
    },
    "split_keywords": [
        "voice activity detection engine",
        "vad"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f9fdd57f6f83677a078c224541e290b16d9d66aff745d0254c8e2f6713cfb32",
                "md5": "7d54cb8f2491f7fdb33a0fc9a480a528",
                "sha256": "55088abe5264bb9aa323fb4c20bd2e436dc96093be3e38a41697ec150702c296"
            },
            "downloads": -1,
            "filename": "pvcobrademo-2.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d54cb8f2491f7fdb33a0fc9a480a528",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 10755,
            "upload_time": "2024-01-30T23:32:41",
            "upload_time_iso_8601": "2024-01-30T23:32:41.629686Z",
            "url": "https://files.pythonhosted.org/packages/0f/9f/dd57f6f83677a078c224541e290b16d9d66aff745d0254c8e2f6713cfb32/pvcobrademo-2.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52d56322daa2d7d9ff3c06875d3ccadc4a092333c1cc33bc34f4c8dfbbe9451f",
                "md5": "25132e24c4b99b8e325b104e7740c480",
                "sha256": "3ddbfe191be5bd2cfeaadee4e586b34e8deecb3b6a73080b770fecc6fbcd55be"
            },
            "downloads": -1,
            "filename": "pvcobrademo-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "25132e24c4b99b8e325b104e7740c480",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 11175,
            "upload_time": "2024-01-30T23:32:43",
            "upload_time_iso_8601": "2024-01-30T23:32:43.399998Z",
            "url": "https://files.pythonhosted.org/packages/52/d5/6322daa2d7d9ff3c06875d3ccadc4a092333c1cc33bc34f4c8dfbbe9451f/pvcobrademo-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-30 23:32:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Picovoice",
    "github_project": "cobra",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pvcobrademo"
}
        
Elapsed time: 0.17732s