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:
Metadata
Release files for speexdsp-ns 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 1.9 MB
Release files / speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 161.6 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c2c73c2f132212fecfff52a689594f925453ff521fec336411149256aedcd819
|
|
BLAKE2b-256 checksum How to use checksums |
7b14d9fd843472f82853643c4ae09835c76bfb19ce7e712586cfc1318030503f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_aarch64.whl
| Download URL | speexdsp_ns-0.1.2-cp312-cp312-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 158.2 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
09cf0a8f9530fca1f203f53808b074d247b9083df323199bd9d150f70af08338
|
|
BLAKE2b-256 checksum How to use checksums |
a07e1b7f7f021736c671b18d69f6f561d5556fd3a5369c94d9c458b4a8fb2e13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 159.9 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
986ed698264eab2e9c775382739fd7a6b6800b589594b037062f53928b87ea3f
|
|
BLAKE2b-256 checksum How to use checksums |
39cbb5c16a514950908d2d9201580946973a84d77ea887eb48fdabdc97f13d6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_aarch64.whl
| Download URL | speexdsp_ns-0.1.2-cp311-cp311-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 156.8 kB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
a8f47dd7996b7fceee36f983118500a42963541c0701ab16543ad35dc7a351db
|
|
BLAKE2b-256 checksum How to use checksums |
6e16ab9442ab375407d1a6130fd1a55686eef24cbeec6223f7b5bd358b68c776
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 158.6 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f3598bd36312335fe2178dc4734a38e82a322fd9c60ea28577ccec9850b8719c
|
|
BLAKE2b-256 checksum How to use checksums |
60325db7f15f3fb43160cafd9dd9f46ed1047e9d4fb509f13c0079a42a4f7ca3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_aarch64.whl
| Download URL | speexdsp_ns-0.1.2-cp310-cp310-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 155.5 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
f79b253d44772c40bd2dd3a953d65fa8baf3509a8b468d14cf9e469c7a59bbf9
|
|
BLAKE2b-256 checksum How to use checksums |
92d932383636d57848ab28151657e14f1dc4d437585a3bea90a613bc6af601df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 158.5 kB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
754fbdf30d219a84714fc77406e8ea6a9b5528641493494dddd2554a8dbb7f88
|
|
BLAKE2b-256 checksum How to use checksums |
29a6f3149a64305da8f13f77edf22ddcf03151e0b7f1089d63bf43eff0b15d09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_aarch64.whl
| Download URL | speexdsp_ns-0.1.2-cp39-cp39-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 155.4 kB |
| Tags | CPython 3.9 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
c2b93df63a9f230f110101d08207f338bb93de3022d94fccd49ad7de768490c1
|
|
BLAKE2b-256 checksum How to use checksums |
56cb6623e3f60ab91253479ece529ed6a427a29b64e2c1ebfb61ebfbdd04968f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl
| Download URL | speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 159.2 kB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
8bb7c3d26ac921cb4aa628b2b9345a4ade55ce54fd7980bd514355ff8708fab6
|
|
BLAKE2b-256 checksum How to use checksums |
93da5ed5ffc2b7fcc768957be7c1d899dddc3067990d18d5f0dd744742e95d59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_aarch64.whl
| Download URL | speexdsp_ns-0.1.2-cp38-cp38-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 156.1 kB |
| Tags | CPython 3.8 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
75b0db25b7bf91dc77dafb614a05cff7518d5a23f94a3245ca3200636db1d873
|
|
BLAKE2b-256 checksum How to use checksums |
2a18456448055a88ef177f7b2c9022fafabe05bc0e4179857efe31487c8619ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_x86_64.whl
| Download URL | speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 157.4 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
68d14e0457f419b7d663c3316d46116b50b85fc97e3340ab2f15a2131b195b86
|
|
BLAKE2b-256 checksum How to use checksums |
247a89c6f400b92903ef8f28f6e078a1b5f9deb7ad64b0903d7dacff73c7b829
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Release files / speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_aarch64.whl
| Download URL | speexdsp_ns-0.1.2-cp37-cp37m-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 154.1 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
60702b11a5e250fbd554bf48a932c34d700ac1952190503c8420019aa054a707
|
|
BLAKE2b-256 checksum How to use checksums |
f73126cfc9ca4a3483ef1a1deb9ebe44c0871f6deeebe7cf53a2d3aee2671e05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.2
|
Security for speexdsp-ns 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.