speexdsp for python
Requirements
- swig
- compile toolchain
- python
- libspeexdsp-dev
Build
There are two ways to build the package.
-
using setup.py
sudo apt install libspeexdsp-dev git clone https://github.com/xiongyihui/speexdsp-python.git cd speexdsp-python python setup.py install -
using Makefile
git clone https://github.com/xiongyihui/speexdsp-python.git cd speexdsp-python/src make
Get started
"""Acoustic Echo Cancellation for wav files."""
import wave
import sys
from speexdsp import EchoCanceller
if len(sys.argv) < 4:
print('Usage: {} near.wav far.wav out.wav'.format(sys.argv[0]))
sys.exit(1)
frame_size = 256
near = wave.open(sys.argv[1], 'rb')
far = wave.open(sys.argv[2], 'rb')
if near.getnchannels() > 1 or far.getnchannels() > 1:
print('Only support mono channel')
sys.exit(2)
out = wave.open(sys.argv[3], '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()))
print('far - rate: {}, channels: {}'.format(far.getframerate(), far.getnchannels()))
echo_canceller = EchoCanceller.create(frame_size, 2048, near.getframerate())
in_data_len = frame_size
in_data_bytes = frame_size * 2
out_data_len = frame_size
out_data_bytes = frame_size * 2
while True:
in_data = near.readframes(in_data_len)
out_data = far.readframes(out_data_len)
if len(in_data) != in_data_bytes or len(out_data) != out_data_bytes:
break
in_data = echo_canceller.process(in_data, out_data)
out.writeframes(in_data)
near.close()
far.close()
out.close()
Metadata
Release files for speexdsp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| speexdsp-0.1.1.tar.gz | 4.4 kB | Without provenance | Details for speexdsp-0.1.1.tar.gz |
Release files / speexdsp-0.1.1.tar.gz
| Download URL | speexdsp-0.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0d0851ea15de30ed2fd314d403bff4963cba99b840252e22e35b980b664bc0e
|
|
BLAKE2b-256 checksum How to use checksums |
71e7da5a9559bfbdc6cbd0f3f4510477722af3509a2b418072ba627eb1b66999
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for speexdsp 0.1.1
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.