WebRTC Audio Processing for Python
Python binding of WebRTC Audio Processing.
Requirements
- swig
- compile toolchain
- python
Build
There are two way to build the package.
-
using setup.py
git clone https://github.com/xiongyihui/python-webrtc-audio-processing.git
cd python-webrtc-audio-processing
git submodule init && git submodule update
python setup.py build
sudo python setup.py install
-
using Makefile
git clone https://github.com/xiongyihui/python-webrtc-audio-processing.git
cd python-webrtc-audio-processing
git submodule init && git submodule update
cd webrtc-audio-processing
./autogen.sh
./configure --with-pic
make
cd ../src
make
Usage
from webrtc_audio_processing import AudioProcessingModule as AP
ap = AP(enable_vad=True, enable_ns=True)
ap.set_stream_format(16000, 1)
ap.set_ns_level(1)
ap.set_vad_level(1)
audio_10ms = '\0' * 160 * 2
audio_out = ap.process_stream(audio_10ms)
print('voice: {}'.format(ap.has_voice()))