Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
.. image:: https://travis-ci.org/wiseman/py-webrtcvad.svg?branch=master :target: https://travis-ci.org/wiseman/py-webrtcvad
This is a python interface to the WebRTC Voice Activity Detector (VAD). It is compatible with Python 2 and Python 3.
A VAD <https://en.wikipedia.org/wiki/Voice_activity_detection>
_
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 <https://webrtc.org/>
_
project is reportedly one of the best available, being fast, modern
and free.
Install the webrtcvad module::
pip install webrtcvad
Create a Vad
object::
import webrtcvad vad = webrtcvad.Vad()
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)
Give it a short segment ("frame") of audio. The WebRTC VAD only accepts 16-bit mono PCM audio, sampled at 8000, 16000, or 32000 Hz. A frame must be either 10, 20, or 30 ms in duration::
sample_rate = 16000 frame_duration = 10 # ms frame = b'\x00\x00' * (sample_rate * frame_duration / 1000) print 'Contains speech: %s' % (vad.is_speech(frame, sample_rate)
See example.py <https://github.com/wiseman/py-webrtcvad/blob/master/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.
To run unit tests::
pip install -e ".[dev]"
python setup.py test
FAQs
Python interface to the Google WebRTC Voice Activity Detector (VAD)
We found that webrtcvad demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.