Python bindings of speexdsp noise suppression library
Project description
Python bindings of speexdsp noise suppression library
Modified from https://github.com/xiongyihui/speexdsp-python
You can use it in Noise reduction model training as said in Personalized PercepNet: Real-time, Low-complexity Target Voice Separation and Enhancement.
Use a VAD and lightweight denoiser (SpeexDSP1) to eliminate the stationary noise before using this data for training.
Requirements
- swig
- compile toolchain
- python
- libspeexdsp-dev
Build
sudo apt install libspeexdsp-dev
sudo apt install swig
python setup.py install
Get started
"""Acoustic Noise Suppression for wav files."""
import wave
import sys
from speexdsp_ns import NoiseSuppression
if len(sys.argv) < 3:
print('Usage: {} near.wav out.wav'.format(sys.argv[0]))
sys.exit(1)
frame_size = 256
near = wave.open(sys.argv[1], 'rb')
if near.getnchannels() > 1:
print('Only support mono channel')
sys.exit(2)
out = wave.open(sys.argv[2], 'wb')
out.setnchannels(near.getnchannels())
out.setsampwidth(near.getsampwidth())
out.setframerate(near.getframerate())
print('near - rate: {}, channels: {}, length: {}'.format(
near.getframerate(),
near.getnchannels(),
near.getnframes() / near.getframerate()))
noise_suppression = NoiseSuppression.create(frame_size, near.getframerate())
in_data_len = frame_size
in_data_bytes = frame_size * 2
while True:
in_data = near.readframes(in_data_len)
if len(in_data) != in_data_bytes:
break
in_data = noise_suppression.process(in_data)
out.writeframes(in_data)
near.close()
out.close()
or
python examples/main.py in.wav out.wav
Noise suppression as show in figure below:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 161.6 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2c73c2f132212fecfff52a689594f925453ff521fec336411149256aedcd819 |
|
MD5 | 7dfcdd5bb33fcbd44fd357fa6f79df8b |
|
BLAKE2b-256 | 7b14d9fd843472f82853643c4ae09835c76bfb19ce7e712586cfc1318030503f |
File details
Details for the file speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 158.2 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09cf0a8f9530fca1f203f53808b074d247b9083df323199bd9d150f70af08338 |
|
MD5 | f355d0589bb5b26164d74f60711838c0 |
|
BLAKE2b-256 | a07e1b7f7f021736c671b18d69f6f561d5556fd3a5369c94d9c458b4a8fb2e13 |
File details
Details for the file speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 159.9 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 986ed698264eab2e9c775382739fd7a6b6800b589594b037062f53928b87ea3f |
|
MD5 | d58ebe2df5d3a0ae6265001886ef584a |
|
BLAKE2b-256 | 39cbb5c16a514950908d2d9201580946973a84d77ea887eb48fdabdc97f13d6d |
File details
Details for the file speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 156.8 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8f47dd7996b7fceee36f983118500a42963541c0701ab16543ad35dc7a351db |
|
MD5 | a383e6ac81830882397505c44220900a |
|
BLAKE2b-256 | 6e16ab9442ab375407d1a6130fd1a55686eef24cbeec6223f7b5bd358b68c776 |
File details
Details for the file speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 158.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3598bd36312335fe2178dc4734a38e82a322fd9c60ea28577ccec9850b8719c |
|
MD5 | c358db37acd3f621e030c6e67737ea37 |
|
BLAKE2b-256 | 60325db7f15f3fb43160cafd9dd9f46ed1047e9d4fb509f13c0079a42a4f7ca3 |
File details
Details for the file speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 155.5 kB
- Tags: CPython 3.10, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f79b253d44772c40bd2dd3a953d65fa8baf3509a8b468d14cf9e469c7a59bbf9 |
|
MD5 | 607e73df3850acc61753359bae2c7519 |
|
BLAKE2b-256 | 92d932383636d57848ab28151657e14f1dc4d437585a3bea90a613bc6af601df |
File details
Details for the file speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 158.5 kB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 754fbdf30d219a84714fc77406e8ea6a9b5528641493494dddd2554a8dbb7f88 |
|
MD5 | da546ffd077bab0ee370f4596d731c45 |
|
BLAKE2b-256 | 29a6f3149a64305da8f13f77edf22ddcf03151e0b7f1089d63bf43eff0b15d09 |
File details
Details for the file speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 155.4 kB
- Tags: CPython 3.9, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2b93df63a9f230f110101d08207f338bb93de3022d94fccd49ad7de768490c1 |
|
MD5 | ec5e35e4632e26eb89c06c753f841d87 |
|
BLAKE2b-256 | 56cb6623e3f60ab91253479ece529ed6a427a29b64e2c1ebfb61ebfbdd04968f |
File details
Details for the file speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 159.2 kB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bb7c3d26ac921cb4aa628b2b9345a4ade55ce54fd7980bd514355ff8708fab6 |
|
MD5 | 6ecd224a61c075f57918b5e06a467b20 |
|
BLAKE2b-256 | 93da5ed5ffc2b7fcc768957be7c1d899dddc3067990d18d5f0dd744742e95d59 |
File details
Details for the file speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 156.1 kB
- Tags: CPython 3.8, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75b0db25b7bf91dc77dafb614a05cff7518d5a23f94a3245ca3200636db1d873 |
|
MD5 | 18d9290519c2d007c0e7e96263db6624 |
|
BLAKE2b-256 | 2a18456448055a88ef177f7b2c9022fafabe05bc0e4179857efe31487c8619ca |
File details
Details for the file speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 157.4 kB
- Tags: CPython 3.7m, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68d14e0457f419b7d663c3316d46116b50b85fc97e3340ab2f15a2131b195b86 |
|
MD5 | 3afcf0ca97d104622bc6bacd509bded1 |
|
BLAKE2b-256 | 247a89c6f400b92903ef8f28f6e078a1b5f9deb7ad64b0903d7dacff73c7b829 |
File details
Details for the file speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 154.1 kB
- Tags: CPython 3.7m, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60702b11a5e250fbd554bf48a932c34d700ac1952190503c8420019aa054a707 |
|
MD5 | e9ff7d7c70c9a8743aee611efc634845 |
|
BLAKE2b-256 | f73126cfc9ca4a3483ef1a1deb9ebe44c0871f6deeebe7cf53a2d3aee2671e05 |