Skip to main content

Python interface to the Google WebRTC Voice Activity Detector (VAD) [released with binary wheels!]

Project description

https://travis-ci.org/wiseman/py-webrtcvad.svg?branch=master

py-webrtcvad-wheels

This is a python interface to the WebRTC Voice Activity Detector (VAD). It is compatible with Python 2 and Python 3. It is forked from wiseman/py-webrtcvad to provide releases with binary wheels.

A VAD classifies a piece of audio data as being voiced or unvoiced. It can be useful for telephony and speech recognition.

The VAD that Google developed for the WebRTC project is reportedly one of the best available, being fast, modern and free.

How to use it

  1. Install the webrtcvad module:

    pip install webrtcvad
  2. Create a Vad object:

    import webrtcvad
    vad = webrtcvad.Vad()
  3. Optionally, set its aggressiveness mode, which is an integer between 0 and 3. 0 is the least aggressive about filtering out non-speech, 3 is the most aggressive. (You can also set the mode when you create the VAD, e.g. vad = webrtcvad.Vad(3)):

    vad.set_mode(1)
  4. Give it a short segment (“frame”) of audio. The WebRTC VAD only accepts 16-bit mono PCM audio, sampled at 8000, 16000, 32000 or 48000 Hz. A frame must be either 10, 20, or 30 ms in duration:

    # Run the VAD on 10 ms of silence. The result should be False.
    sample_rate = 16000
    frame_duration = 10  # ms
    frame = b'\x00\x00' * int(sample_rate * frame_duration / 1000)
    print 'Contains speech: %s' % (vad.is_speech(frame, sample_rate)

See example.py for a more detailed example that will process a .wav file, find the voiced segments, and write each one as a separate .wav.

How to run unit tests

To run unit tests:

pip install -e ".[dev]"
python setup.py test

History

2.0.10

Fixed memory leak. Thank you, bond005!

2.0.9

Improved example code. Added WebRTC license.

2.0.8

Fixed Windows compilation errors. Thank you, xiongyihui!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webrtcvad-wheels-2.0.10.post2.tar.gz (68.0 kB view hashes)

Uploaded Source

Built Distributions

webrtcvad_wheels-2.0.10.post2-pp37-pypy37_pp73-win32.whl (18.5 kB view hashes)

Uploaded PyPy Windows x86

webrtcvad_wheels-2.0.10.post2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (27.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-pp36-pypy36_pp73-win32.whl (18.5 kB view hashes)

Uploaded PyPy Windows x86

webrtcvad_wheels-2.0.10.post2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (27.7 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-pp27-pypy_73-macosx_10_9_x86_64.whl (27.6 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp39-cp39-win_amd64.whl (21.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

webrtcvad_wheels-2.0.10.post2-cp39-cp39-win32.whl (18.5 kB view hashes)

Uploaded CPython 3.9 Windows x86

webrtcvad_wheels-2.0.10.post2-cp39-cp39-macosx_10_9_x86_64.whl (29.9 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp38-cp38-win_amd64.whl (21.7 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

webrtcvad_wheels-2.0.10.post2-cp38-cp38-win32.whl (18.4 kB view hashes)

Uploaded CPython 3.8 Windows x86

webrtcvad_wheels-2.0.10.post2-cp38-cp38-manylinux2010_x86_64.whl (86.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

webrtcvad_wheels-2.0.10.post2-cp38-cp38-manylinux2010_i686.whl (67.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

webrtcvad_wheels-2.0.10.post2-cp38-cp38-macosx_10_9_x86_64.whl (29.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp37-cp37m-win_amd64.whl (21.7 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

webrtcvad_wheels-2.0.10.post2-cp37-cp37m-win32.whl (18.4 kB view hashes)

Uploaded CPython 3.7m Windows x86

webrtcvad_wheels-2.0.10.post2-cp37-cp37m-manylinux2010_x86_64.whl (86.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

webrtcvad_wheels-2.0.10.post2-cp37-cp37m-manylinux2010_i686.whl (68.5 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

webrtcvad_wheels-2.0.10.post2-cp37-cp37m-macosx_10_9_x86_64.whl (29.8 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp37-cp37m-macosx_10_6_intel.whl (59.0 kB view hashes)

Uploaded CPython 3.7m macOS 10.6+ intel

webrtcvad_wheels-2.0.10.post2-cp36-cp36m-win_amd64.whl (21.7 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

webrtcvad_wheels-2.0.10.post2-cp36-cp36m-win32.whl (18.4 kB view hashes)

Uploaded CPython 3.6m Windows x86

webrtcvad_wheels-2.0.10.post2-cp36-cp36m-manylinux2010_x86_64.whl (85.9 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

webrtcvad_wheels-2.0.10.post2-cp36-cp36m-manylinux2010_i686.whl (67.6 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

webrtcvad_wheels-2.0.10.post2-cp36-cp36m-macosx_10_9_x86_64.whl (29.8 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp36-cp36m-macosx_10_6_intel.whl (59.0 kB view hashes)

Uploaded CPython 3.6m macOS 10.6+ intel

webrtcvad_wheels-2.0.10.post2-cp35-cp35m-win_amd64.whl (20.2 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

webrtcvad_wheels-2.0.10.post2-cp35-cp35m-win32.whl (17.5 kB view hashes)

Uploaded CPython 3.5m Windows x86

webrtcvad_wheels-2.0.10.post2-cp35-cp35m-manylinux2010_x86_64.whl (85.7 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

webrtcvad_wheels-2.0.10.post2-cp35-cp35m-manylinux2010_i686.whl (67.3 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ i686

webrtcvad_wheels-2.0.10.post2-cp35-cp35m-macosx_10_9_x86_64.whl (29.6 kB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp35-cp35m-macosx_10_6_intel.whl (59.0 kB view hashes)

Uploaded CPython 3.5m macOS 10.6+ intel

webrtcvad_wheels-2.0.10.post2-cp27-cp27mu-manylinux2010_x86_64.whl (84.1 kB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

webrtcvad_wheels-2.0.10.post2-cp27-cp27mu-manylinux2010_i686.whl (66.3 kB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ i686

webrtcvad_wheels-2.0.10.post2-cp27-cp27m-win_amd64.whl (23.9 kB view hashes)

Uploaded CPython 2.7m Windows x86-64

webrtcvad_wheels-2.0.10.post2-cp27-cp27m-win32.whl (20.7 kB view hashes)

Uploaded CPython 2.7m Windows x86

webrtcvad_wheels-2.0.10.post2-cp27-cp27m-manylinux2010_x86_64.whl (84.1 kB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

webrtcvad_wheels-2.0.10.post2-cp27-cp27m-manylinux2010_i686.whl (66.2 kB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ i686

webrtcvad_wheels-2.0.10.post2-cp27-cp27m-macosx_10_9_x86_64.whl (29.5 kB view hashes)

Uploaded CPython 2.7m macOS 10.9+ x86-64

webrtcvad_wheels-2.0.10.post2-cp27-cp27m-macosx_10_6_intel.whl (58.8 kB view hashes)

Uploaded CPython 2.7m macOS 10.6+ intel

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page