• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cbits/H07-Jan-2017-6,7633,505

webrtcvad.egg-info/H03-May-2022-8564

LICENSEH A D07-Jan-20172.7 KiB5644

MANIFEST.inH A D07-Jan-201771 54

PKG-INFOH A D07-Jan-20173.3 KiB8564

README.rstH A D07-Jan-20171.8 KiB6141

example.pyH A D07-Jan-20173.3 KiB10185

setup.cfgH A D07-Jan-201759 64

setup.pyH A D07-Jan-20172.8 KiB8963

test_webrtcvad.pyH A D07-Jan-20173.7 KiB10795

webrtcvad.pyH A D07-Jan-2017976 3223

README.rst

1.. image:: https://travis-ci.org/wiseman/py-webrtcvad.svg?branch=master
2    :target: https://travis-ci.org/wiseman/py-webrtcvad
3
4py-webrtcvad
5============
6
7This is a python interface to the WebRTC Voice Activity Detector
8(VAD).  It is compatible with Python 2 and Python 3.
9
10A `VAD <https://en.wikipedia.org/wiki/Voice_activity_detection>`_
11classifies a piece of audio data as being voiced or unvoiced. It can
12be useful for telephony and speech recognition.
13
14The VAD that Google developed for the `WebRTC <https://webrtc.org/>`_
15project is reportedly one of the best available, being fast, modern
16and free.
17
18How to use it
19-------------
20
210. Install the webrtcvad module::
22
23    pip install webrtcvad
24
251. Create a ``Vad`` object::
26
27    import webrtcvad
28    vad = webrtcvad.Vad()
29
302. Optionally, set its aggressiveness mode, which is an integer
31   between 0 and 3. 0 is the least aggressive about filtering out
32   non-speech, 3 is the most aggressive. (You can also set the mode
33   when you create the VAD, e.g. ``vad = webrtcvad.Vad(3)``)::
34
35    vad.set_mode(1)
36
373. Give it a short segment ("frame") of audio. The WebRTC VAD only
38   accepts 16-bit mono PCM audio, sampled at 8000, 16000, or 32000 Hz.
39   A frame must be either 10, 20, or 30 ms in duration::
40
41    # Run the VAD on 10 ms of silence. The result should be False.
42    sample_rate = 16000
43    frame_duration = 10  # ms
44    frame = b'\x00\x00' * (sample_rate * frame_duration / 1000)
45    print 'Contains speech: %s' % (vad.is_speech(frame, sample_rate)
46
47
48See `example.py
49<https://github.com/wiseman/py-webrtcvad/blob/master/example.py>`_ for
50a more detailed example that will process a .wav file, find the voiced
51segments, and write each one as a separate .wav.
52
53
54How to run unit tests
55---------------------
56
57To run unit tests::
58
59    pip install -e ".[dev]"
60    python setup.py test
61