dpdfnet
CPU-only ONNX inference package for DPDFNet speech enhancement.
Installation
pip install dpdfnet
Requirements
- Python
>=3.11 - OS support for
soundfile/libsndfile
Runtime dependencies are installed automatically:
numpylibrosasoundfileonnxruntimefilelocktqdm
Supported Models
8 kHz models
| Model | Native sample rate | Notes |
|---|---|---|
dpdfnet2_8khz |
8 kHz | Low-bandwidth DPDFNet-2 |
dpdfnet8_8khz |
8 kHz | Low-bandwidth DPDFNet-8 |
16 kHz models
| Model | Native sample rate | Notes |
|---|---|---|
baseline |
16 kHz | Fastest 16 kHz model |
dpdfnet2 |
16 kHz | Balanced 16 kHz model |
dpdfnet4 |
16 kHz | Higher-quality 16 kHz model |
dpdfnet8 |
16 kHz | Highest-quality 16 kHz model |
48 kHz models
| Model | Native sample rate | Notes |
|---|---|---|
dpdfnet2_48khz_hr |
48 kHz | High-resolution DPDFNet-2 |
dpdfnet8_48khz_hr |
48 kHz | High-resolution DPDFNet-8 |
Supported Audio Formats
The following input formats are supported out of the box (via soundfile/libsndfile):
| Format | Extensions |
|---|---|
| WAV | .wav |
| FLAC | .flac |
| Ogg Vorbis | .ogg |
| AIFF | .aiff, .aif |
| AU/SND | .au, .snd |
MP3 and other compressed formats require the optional pydub dependency and
ffmpeg on your PATH:
pip install 'dpdfnet[mp3]'
# also install ffmpeg, e.g.:
# Ubuntu/Debian: sudo apt install ffmpeg
# macOS: brew install ffmpeg
# Windows: https://ffmpeg.org/download.html
Once installed, these additional formats are supported:
| Format | Extensions |
|---|---|
| MP3 | .mp3 |
| AAC / M4A | .aac, .m4a |
| WMA | .wma |
| Opus | .opus |
Output is always written as PCM16 .wav regardless of the input format.
CLI
Show help:
dpdfnet --help
Commands:
dpdfnet models
- List supported models and local availability.
dpdfnet enhance <input> <output.wav> [--model <name>] [--attn-limit-db DB] [-v|--verbose]
- Enhance one audio file (any supported format; output is always
.wav).
dpdfnet enhance-dir <input_dir> <output_dir> [--model <name>] [--workers N] [--attn-limit-db DB] [-v|--verbose]
- Enhance all supported audio files in a directory (non-recursive).
- Files are processed concurrently;
--workerssets the thread count (default: CPU count).
dpdfnet download [model] [--force|--refresh] [-q|--quiet | -v|--verbose]
- Download all models when
modelis omitted, or one model when provided.
CLI examples:
# Enhance one file
dpdfnet enhance noisy.wav enhanced.wav --model dpdfnet4 --attn-limit-db 12
# Enhance a directory (uses all CPU cores by default)
dpdfnet enhance-dir ./noisy_wavs ./enhanced_wavs --model dpdfnet2 --attn-limit-db 12
# Enhance a directory with a fixed worker count
dpdfnet enhance-dir ./noisy_wavs ./enhanced_wavs --model dpdfnet2 --workers 4 --attn-limit-db 12
# Download models
dpdfnet download
dpdfnet download dpdfnet8
dpdfnet download dpdfnet2_8khz
dpdfnet download dpdfnet4 --force
Python API
Top-level exports:
dpdfnet.enhancedpdfnet.enhance_filedpdfnet.available_modelsdpdfnet.download
In-memory enhancement:
import soundfile as sf
import dpdfnet
audio, sr = sf.read("noisy.wav")
enhanced = dpdfnet.enhance(audio, sample_rate=sr, model="dpdfnet4", attn_limit_db=12)
sf.write("enhanced.wav", enhanced, sr)
Enhance one file:
import dpdfnet
out_path = dpdfnet.enhance_file("noisy.wav", model="dpdfnet2", attn_limit_db=12)
print(out_path)
Model listing:
import dpdfnet
for row in dpdfnet.available_models():
print(row["name"], row["ready"], row["cached"])
Download models via API:
import dpdfnet
dpdfnet.download()
dpdfnet.download("dpdfnet4")
dpdfnet.download("dpdfnet2_8khz")
Real-time Microphone Enhancement
Install sounddevice (not included in dpdfnet dependencies):
pip install sounddevice
StreamEnhancer processes audio chunk-by-chunk, preserving RNN state across
calls. Any chunk size works; enhanced samples are returned as soon as enough
data has accumulated for the first model frame (20 ms).
import numpy as np
import sounddevice as sd
import dpdfnet
INPUT_SR = 48000
# Use one model hop (10 ms) as the block size so process() returns
# exactly one hop's worth of enhanced audio on every callback.
BLOCK_SIZE = int(INPUT_SR * 0.010) # 480 samples at 48 kHz
enhancer = dpdfnet.StreamEnhancer(model="dpdfnet2_48khz_hr")
def callback(indata, outdata, frames, time, status):
mono_in = indata[:, 0] if indata.ndim > 1 else indata.ravel()
enhanced = enhancer.process(mono_in, sample_rate=INPUT_SR)
n = min(len(enhanced), frames)
outdata[:n, 0] = enhanced[:n]
if n < frames:
outdata[n:] = 0.0 # silence while the first window accumulates
with sd.Stream(
samplerate=INPUT_SR,
blocksize=BLOCK_SIZE,
channels=1,
dtype="float32",
callback=callback,
):
print("Enhancing microphone input - press Ctrl+C to stop")
try:
while True:
sd.sleep(100)
except KeyboardInterrupt:
pass
# Optional: drain the final partial window at the end of a recording
tail = enhancer.flush()
Notes:
Latency - the first enhanced output arrives after one full model window (~20 ms) has been buffered. All subsequent blocks are returned with ~10 ms additional delay. Sample rate -
StreamEnhancerresamples internally. Pass your device's native rate assample_rate; the return value is at the same rate. Block size - usingBLOCK_SIZE = int(SR * 0.010)(one model hop) gives one enhanced block per callback. Other sizes also work but may produce empty returns while the buffer fills. Multiple streams - create a separateStreamEnhancerper stream. Callenhancer.reset()between independent audio segments to clear RNN state.
Links
- Homepage: https://github.com/ceva-ip/DPDFNet
- Issues: https://github.com/ceva-ip/DPDFNet/issues
Metadata
Release files for dpdfnet 0.6.0
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 |
|---|---|---|---|---|
| dpdfnet-0.6.0.tar.gz | 33.4 kB | Without provenance | Details for dpdfnet-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dpdfnet-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for dpdfnet-0.6.0-py3-none-any.whl |
Total release size: 59.3 kB
Release files / dpdfnet-0.6.0.tar.gz
| Download URL | dpdfnet-0.6.0.tar.gz |
|---|---|
| Size | 33.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40f493f120116baecd9c7656a1ddc1b43ee10b070b247525c99d9d6c0f7d5bef
|
|
BLAKE2b-256 checksum How to use checksums |
3eb5c0fd83685de86e543968c2cac1fc86c329c946656a83f12400af462c204c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / dpdfnet-0.6.0-py3-none-any.whl
| Download URL | dpdfnet-0.6.0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
457b10879808d7b259312f2128a26b5defb16aa3095536b4af0d55a263e3fd06
|
|
BLAKE2b-256 checksum How to use checksums |
f3573eb73faf0aefde25701f5e01315e77bbcbaf4e165651dba3efb936e11c55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for dpdfnet 0.6.0
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.