energy-vad


Nameenergy-vad JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryIntents for Home Assistant
upload_time2024-07-18 19:54:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7.0
licenseMIT
keywords home assistant intent recognition
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Energy VAD

Simple energy-based voice activity detector (VAD) with no external dependencies.

Energy threshold is calibrated from initial audio, or can be set manually.

## Installation

``` sh
pip install energy-vad
```

## Example

``` python
import wave
from energy_vad import EnergyVad

vad = EnergyVad()

with wave.open("test.wav", "rb") as wav_file:
    assert wav_file.getframerate() == 16000
    assert wav_file.getsampwidth() == 2
    assert wav_file.getnchannels() == 1
    
    chunk = wav_file.readframes(vad.samples_per_chunk)
    while len(chunk) == vad.bytes_per_chunk:
        result = vad.process_chunk(chunk)
        if result is None:
            # calibrating
            pass
        elif result:
            # speech
            print("!", end="")
        else:
            # silence
            print(".", end="")

        chunk = wav_file.readframes(vad.samples_per_chunk)
        
print("")
print("Energy threshold:", vad.threshold)

# Clear calibrated threshold
vad.reset_calibration()
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "energy-vad",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7.0",
    "maintainer_email": null,
    "keywords": "home, assistant, intent, recognition",
    "author": null,
    "author_email": "The Home Assistant Authors <hello@home-assistant.io>",
    "download_url": "https://files.pythonhosted.org/packages/04/1f/add776bfa7ece604aa0b4ae113b134cfbb2ad17705ac49832defdd3d14ee/energy_vad-1.0.0.tar.gz",
    "platform": "any",
    "description": "# Energy VAD\n\nSimple energy-based voice activity detector (VAD) with no external dependencies.\n\nEnergy threshold is calibrated from initial audio, or can be set manually.\n\n## Installation\n\n``` sh\npip install energy-vad\n```\n\n## Example\n\n``` python\nimport wave\nfrom energy_vad import EnergyVad\n\nvad = EnergyVad()\n\nwith wave.open(\"test.wav\", \"rb\") as wav_file:\n    assert wav_file.getframerate() == 16000\n    assert wav_file.getsampwidth() == 2\n    assert wav_file.getnchannels() == 1\n    \n    chunk = wav_file.readframes(vad.samples_per_chunk)\n    while len(chunk) == vad.bytes_per_chunk:\n        result = vad.process_chunk(chunk)\n        if result is None:\n            # calibrating\n            pass\n        elif result:\n            # speech\n            print(\"!\", end=\"\")\n        else:\n            # silence\n            print(\".\", end=\"\")\n\n        chunk = wav_file.readframes(vad.samples_per_chunk)\n        \nprint(\"\")\nprint(\"Energy threshold:\", vad.threshold)\n\n# Clear calibrated threshold\nvad.reset_calibration()\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Intents for Home Assistant",
    "version": "1.0.0",
    "project_urls": {
        "Source Code": "https://github.com/rhasspy/energy-vad"
    },
    "split_keywords": [
        "home",
        " assistant",
        " intent",
        " recognition"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c7cf5df8c919694b5df73e9a800b3bafdf301132c9189c468c18a1fef80a0e2",
                "md5": "5b23d0aed90389db388c47ab74e24a97",
                "sha256": "8f17faabfdd47b51f1abbe246180313fa124af9372b09b897072b4d4270e3b9b"
            },
            "downloads": -1,
            "filename": "energy_vad-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b23d0aed90389db388c47ab74e24a97",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.0",
            "size": 3868,
            "upload_time": "2024-07-18T19:54:40",
            "upload_time_iso_8601": "2024-07-18T19:54:40.305248Z",
            "url": "https://files.pythonhosted.org/packages/3c/7c/f5df8c919694b5df73e9a800b3bafdf301132c9189c468c18a1fef80a0e2/energy_vad-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "041fadd776bfa7ece604aa0b4ae113b134cfbb2ad17705ac49832defdd3d14ee",
                "md5": "8724dfc43e079d2c4ae310dead5f5c2c",
                "sha256": "27e390e7280577de4a3c6541e8aeaff0ae2b3cb834f58c8e3b10b25a95e0f755"
            },
            "downloads": -1,
            "filename": "energy_vad-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8724dfc43e079d2c4ae310dead5f5c2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.0",
            "size": 4139,
            "upload_time": "2024-07-18T19:54:41",
            "upload_time_iso_8601": "2024-07-18T19:54:41.821714Z",
            "url": "https://files.pythonhosted.org/packages/04/1f/add776bfa7ece604aa0b4ae113b134cfbb2ad17705ac49832defdd3d14ee/energy_vad-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-18 19:54:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rhasspy",
    "github_project": "energy-vad",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "energy-vad"
}
        
Elapsed time: 0.30713s