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.

Files for webrtcvad-wheels, version 2.0.10.post2
Filename, size File type Python version Upload date Hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-macosx_10_6_intel.whl (58.8 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-manylinux1_i686.whl (66.2 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-manylinux1_x86_64.whl (84.1 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-manylinux2010_i686.whl (66.2 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-manylinux2010_x86_64.whl (84.1 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27mu-manylinux1_i686.whl (66.3 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27mu-manylinux1_x86_64.whl (84.1 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27mu-manylinux2010_i686.whl (66.3 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27mu-manylinux2010_x86_64.whl (84.1 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-win32.whl (20.7 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp27-cp27m-win_amd64.whl (23.9 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-macosx_10_6_intel.whl (59.0 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-manylinux1_i686.whl (67.3 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-manylinux1_x86_64.whl (85.7 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-manylinux2010_i686.whl (67.3 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-manylinux2010_x86_64.whl (85.7 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-win32.whl (17.5 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp35-cp35m-win_amd64.whl (20.2 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-macosx_10_6_intel.whl (59.0 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-manylinux1_i686.whl (67.6 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-manylinux1_x86_64.whl (85.9 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-manylinux2010_i686.whl (67.6 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-manylinux2010_x86_64.whl (85.9 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-win32.whl (18.4 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp36-cp36m-win_amd64.whl (21.7 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-macosx_10_6_intel.whl (59.0 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-manylinux1_i686.whl (68.5 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-manylinux1_x86_64.whl (86.8 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-manylinux2010_i686.whl (68.5 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-manylinux2010_x86_64.whl (86.8 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-win32.whl (18.4 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp37-cp37m-win_amd64.whl (21.7 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-macosx_10_9_x86_64.whl (29.8 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-manylinux1_i686.whl (67.6 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-manylinux1_x86_64.whl (86.0 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-manylinux2010_i686.whl (67.6 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-manylinux2010_x86_64.whl (86.0 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-win32.whl (18.4 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad_wheels-2.0.10.post2-cp38-cp38-win_amd64.whl (21.7 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size webrtcvad-wheels-2.0.10.post2.tar.gz (68.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page