dguard-vad


Namedguard-vad JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-12-10 11:12:33
maintainerNone
docs_urlNone
authorZhao Sheng
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Dguard VAD

Based on [Silero VAD](https://github.com/snakers4/silero-vad) and [RnNoise](https://github.com/werman/noise-suppression-for-voice).

## Installation

```bash
pip install dguard_vad==0.1.0
```
or
```bash
git clone http://ai.lyxxkj.com.cn:3001/zhaosheng/dguard_vad.git
cd dguard_vad
pip install -e .
```
The model files will not be downloaded automatically.
You need to download them manually and put them in the right place.(Default: `$$DGUARD_MODEL_PATH/dguard_vad.onnx`)
> $DGUARD_MODEL_PATH is an environment variable that used in all dgurad* projects.



## Usage

1. `VAD` class
```python
from dguard_vad import VAD
SR = 16000
WAV_PATH = "../data/test_16k.wav"
vad = VAD(SR)
# Use get_speech_timestamps to get 
# start and end timestamps of speech segments
timestamps = vad.get_speech_timestamps(WAV_PATH)
for _ in timestamps:
    print(_)

# You shuold get the following output:
# {'segment': 0, 'start': 26560, 'end': 48704}
# {'segment': 1, 'start': 71616, 'end': 106048}
# {'segment': 2, 'start': 149952, 'end': 185920}

# Use get_speech_probs to get probabilities for each chunk
probs = vad.get_speech_probs(WAV_PATH)
for _ in probs:
    print(_)
# You shuold get the following output:
# 0.02
# 0.01
# 0.01
# 0.01
# 0.0
```

2. `VAD` class with noise suppression
You just need to set `denoise=True` when initializing `VAD` class.
```python
vad = VAD(SR, denoise=True)
```
Please note that: func:`get_speech_probs` may not work well with noise suppression.

3. `VADIterator` class
Please refer to `ws_app/ws_server.py` for more details.



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dguard-vad",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Zhao Sheng",
    "author_email": "zhaosheng@nuaa.edu.cn",
    "download_url": "https://files.pythonhosted.org/packages/61/76/973ab1f56550a89e66f362737c40d2c1cb331f1a1c23e6272cc27045cf5d/dguard_vad-0.1.1.tar.gz",
    "platform": null,
    "description": "# Dguard VAD\n\nBased on [Silero VAD](https://github.com/snakers4/silero-vad) and [RnNoise](https://github.com/werman/noise-suppression-for-voice).\n\n## Installation\n\n```bash\npip install dguard_vad==0.1.0\n```\nor\n```bash\ngit clone http://ai.lyxxkj.com.cn:3001/zhaosheng/dguard_vad.git\ncd dguard_vad\npip install -e .\n```\nThe model files will not be downloaded automatically.\nYou need to download them manually and put them in the right place.(Default: `$$DGUARD_MODEL_PATH/dguard_vad.onnx`)\n> $DGUARD_MODEL_PATH is an environment variable that used in all dgurad* projects.\n\n\n\n## Usage\n\n1. `VAD` class\n```python\nfrom dguard_vad import VAD\nSR = 16000\nWAV_PATH = \"../data/test_16k.wav\"\nvad = VAD(SR)\n# Use get_speech_timestamps to get \n# start and end timestamps of speech segments\ntimestamps = vad.get_speech_timestamps(WAV_PATH)\nfor _ in timestamps:\n    print(_)\n\n# You shuold get the following output:\n# {'segment': 0, 'start': 26560, 'end': 48704}\n# {'segment': 1, 'start': 71616, 'end': 106048}\n# {'segment': 2, 'start': 149952, 'end': 185920}\n\n# Use get_speech_probs to get probabilities for each chunk\nprobs = vad.get_speech_probs(WAV_PATH)\nfor _ in probs:\n    print(_)\n# You shuold get the following output:\n# 0.02\n# 0.01\n# 0.01\n# 0.01\n# 0.0\n```\n\n2. `VAD` class with noise suppression\nYou just need to set `denoise=True` when initializing `VAD` class.\n```python\nvad = VAD(SR, denoise=True)\n```\nPlease note that: func:`get_speech_probs` may not work well with noise suppression.\n\n3. `VADIterator` class\nPlease refer to `ws_app/ws_server.py` for more details.\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b778e514f42875e6efbacb24b100ef1845d190c2634327805caa6ccf234d9f13",
                "md5": "6f42e09e3d7ce952448b0971c903c1a8",
                "sha256": "f8933a6dc0a6f386c5fad8715d6c1706256df857e7ecaf0fdad39c97e7f5971e"
            },
            "downloads": -1,
            "filename": "dguard_vad-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6f42e09e3d7ce952448b0971c903c1a8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10944,
            "upload_time": "2024-12-10T11:12:27",
            "upload_time_iso_8601": "2024-12-10T11:12:27.219842Z",
            "url": "https://files.pythonhosted.org/packages/b7/78/e514f42875e6efbacb24b100ef1845d190c2634327805caa6ccf234d9f13/dguard_vad-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6176973ab1f56550a89e66f362737c40d2c1cb331f1a1c23e6272cc27045cf5d",
                "md5": "11bc6907994ada472e735699633f168d",
                "sha256": "437bb97c0aaf3e59feff63de540af236f3991966e365792295ce1ae790a8f97b"
            },
            "downloads": -1,
            "filename": "dguard_vad-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "11bc6907994ada472e735699633f168d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10769,
            "upload_time": "2024-12-10T11:12:33",
            "upload_time_iso_8601": "2024-12-10T11:12:33.303757Z",
            "url": "https://files.pythonhosted.org/packages/61/76/973ab1f56550a89e66f362737c40d2c1cb331f1a1c23e6272cc27045cf5d/dguard_vad-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-10 11:12:33",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dguard-vad"
}
        
Elapsed time: 0.33821s