Skip to main content

DeepFilterNet-rs

Python bindings for the official DeepFilterNet Rust realtime runtime.

This package exposes a small PyO3 wrapper around DeepFilterNet's Rust DfTract streaming runtime. It is intended for realtime audio enhancement pipelines that need a Python API without shelling out to the deep-filter binary.

The required DeepFilterNet Rust runtime source is inlined under rust/src/deep_filter from upstream Rikorose/DeepFilterNet tag v0.5.6. The bundled default model now ships as Python package data under python/deepfilternet_rs/models. Builds do not depend on the upstream Git repository at compile time.

The package also includes a small deepfilternet command line tool for denoising common audio files through ffmpeg-based decode and encode steps.

Install

pip install deepfilternet-rs

When installing from source, a Rust toolchain is required because the package is built with maturin. Prebuilt wheels do not require Rust on the target machine.

Usage

import numpy as np
from deepfilternet_rs import DeepFilterNetRealtime

processor = DeepFilterNetRealtime(
    model_path=None,
    atten_lim=100.0,
    log_level="warn",
    compensate_delay=True,
    post_filter_beta=0.0,
)

audio = np.zeros(processor.frame_length, dtype=np.float32)
enhanced = processor.process_chunk(audio)
tail = processor.finalize()

When model_path=None, the Python package automatically resolves the bundled default model file from deepfilternet_rs.models and passes its path into the Rust runtime.

CLI

deepfilternet input.wav output.wav

The CLI accepts common input formats that ffmpeg can decode, such as WAV, FLAC, MP3, and M4A. Audio is automatically converted to mono 48kHz before running the DeepFilterNet model, and the output format follows the destination file extension.

Optional runtime parameters mirror the Python API defaults:

deepfilternet input.wav output.wav \
  --model-path custom_model.tar.gz \
  --atten-lim 100.0 \
  --log-level warn \
  --compensate-delay \
  --post-filter-beta 0.0 \
  --min-db-thresh -15.0 \
  --max-db-erb-thresh 35.0 \
  --max-db-df-thresh 35.0

Parameter tuning notes:

  • --atten-lim: controls how aggressively extra attenuation is allowed. Lower values usually keep more room tone and background ambience, but noise may remain more obvious. Higher values push stronger suppression. 100.0 is the least restrictive default.
  • --post-filter-beta: controls extra residual-noise cleanup after the main model pass. 0.0 is the most natural starting point. Raising it can make noisy clips sound cleaner, but if it is too high, speech may become thinner, duller, or slightly watery.
  • --compensate-delay: enabled by default and recommended for normal file output. It removes the model delay so the result lines up better with the source timing. Turning it off is mostly useful for debugging or low-level alignment experiments.
  • --log-level: now controls both the Rust runtime logger and ffmpeg -v .... Use warn or error for normal runs. Use info or debug when you want more diagnostics. trace is intentionally very noisy and may print large amounts of model-loading and graph-parsing output.
  • --model-path: leave unset to use the bundled default model. Set it when you want to test or ship a different official DeepFilterNet model package.
  • --min-db-thresh, --max-db-erb-thresh, --max-db-df-thresh: advanced SNR threshold parameters passed directly to the underlying DeepFilterNet runtime. They affect when different decoder paths remain active across noisier or cleaner regions. These are useful for controlled experiments and model tuning, but they are much easier to mis-tune than --atten-lim or --post-filter-beta, so most users should leave them at their defaults.

Current CLI constraints:

  • ffmpeg must be installed and available on PATH.
  • Input and output formats are limited to what the local ffmpeg build supports.
  • The model still runs internally at mono 48000 Hz.

API

DeepFilterNetRealtime

Constructor arguments:

Argument Type Default Description
model_path `str None` None
atten_lim float 100.0 Attenuation limit in dB. 100.0 means no explicit limit.
log_level `str None` None
compensate_delay bool True Drop initial algorithmic-delay samples from output.
post_filter_beta float 0.0 Post-filter beta. 0.0 disables the post-filter.
min_db_thresh float -15.0 Advanced local SNR threshold for the decoder DNN path.
max_db_erb_thresh float 35.0 Advanced upper SNR threshold for the ERB decoder path.
max_db_df_thresh float 35.0 Advanced upper SNR threshold for the DF decoder path.

Properties:

Property Description
sample_rate Backend processing sample rate. Official DeepFilterNet models use 48000 Hz.
frame_length Frame length in samples. Official DeepFilterNet models use 480 samples.

Methods:

Method Description
process_chunk(audio) Process a one-dimensional float32 numpy array and return enhanced float32 samples. The input can be any length; incomplete frames are buffered.
finalize() Flush buffered samples with zero padding and close the processor.
close() Clear buffers and close the processor without flushing.

Release

Publishing is handled by GitHub Actions. Create a GitHub release or run the release workflow manually after configuring the PYPI_API_TOKEN repository secret.

Metadata

Release files for deepfilternet-rs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deepfilternet-rs 0.1.1
File Size Uploaded
deepfilternet_rs-0.1.1.tar.gz 8.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for deepfilternet-rs 0.1.1
File
deepfilternet_rs-0.1.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
deepfilternet_rs-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
deepfilternet_rs-0.1.1-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
deepfilternet_rs-0.1.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
deepfilternet_rs-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
deepfilternet_rs-0.1.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
deepfilternet_rs-0.1.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
deepfilternet_rs-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
deepfilternet_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 132.7 MB

Release files / deepfilternet_rs-0.1.1.tar.gz

Download URL deepfilternet_rs-0.1.1.tar.gz
Size 8.1 MB
Tags Source
SHA-256 checksum
How to use checksums
35151a5d179fa9367318b5d781c4dd5e9a16a9558fdca9ed29fee1480ff5db2f
BLAKE2b-256 checksum
How to use checksums
91d4c8f4afafcab2a854de5fbc86438d9d8221ad52802422c0fb95bb700a92c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp312-cp312-win_amd64.whl

Download URL deepfilternet_rs-0.1.1-cp312-cp312-win_amd64.whl
Size 13.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
6e3c1f7c49fc8f84e01cff684be5db204c946185c312030b379f9cfa265662c6
BLAKE2b-256 checksum
How to use checksums
9874bd67b0101c73e9d5b77b2038802b0659c6eaa8fe6b9432ef7ebcdd4924be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL deepfilternet_rs-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 14.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
45bd825ab1ae06476fa2dd23b7dc222d64f42691cff9e9f1c0bbdc9b48ab5b43
BLAKE2b-256 checksum
How to use checksums
ad1e290210cf2ac3bdc1a083244d72f3b0149eaf01476e950893ddc4fd5bac27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp312-cp312-macosx_11_0_arm64.whl

Download URL deepfilternet_rs-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Size 13.4 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cf89f5ec91fc3ef465468849e3f6462fb9e711a3ee9cf5912e12c70f5cc931b4
BLAKE2b-256 checksum
How to use checksums
0faffe92f508eef5431514b878d9886f9d1d429f2272f4f9ef7fadc6e6a1c1e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp311-cp311-win_amd64.whl

Download URL deepfilternet_rs-0.1.1-cp311-cp311-win_amd64.whl
Size 13.4 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
1263047154d06dc1b6eb4a6fcd6c80309336c9f7cfe668a0ddf318212ac0776c
BLAKE2b-256 checksum
How to use checksums
48fe913b2cef6502ec0551bf4731b12a96a93b6e4848611a441d79e65799f527
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL deepfilternet_rs-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 14.7 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
16c6e6fcaca50a58d9b67df10a23e34ca6679467457db673ca2760a83758c7c3
BLAKE2b-256 checksum
How to use checksums
1972139b4f6263a00723160ec3ae80e79cdde1e6ba27c12aa08de7f2c162aeaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL deepfilternet_rs-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Size 13.4 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c492a69736378154d147859eeffde97272f6b470d9782f528adeafab8ef2c457
BLAKE2b-256 checksum
How to use checksums
3575b54d481e38b867e9a7053a559bb620aafb734d61a6c9d742645c97009492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp310-cp310-win_amd64.whl

Download URL deepfilternet_rs-0.1.1-cp310-cp310-win_amd64.whl
Size 13.4 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
b7c14b97b9b77453e6b39ab6156b2f1445a81901f064e2724c009c273bc5596f
BLAKE2b-256 checksum
How to use checksums
bf18465a2cdc50207066d0832e154c6eba92ceb5fa50e880b4170c58780d38ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL deepfilternet_rs-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 14.7 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9a2b6fe08fc51138153c6e81c28f1b272d8a6c41db09077cf7f0e560f0696313
BLAKE2b-256 checksum
How to use checksums
58f114aa600e75c841fad36aa5b65d2cbee6763894ba96213db23ff07dc52f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / deepfilternet_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl

Download URL deepfilternet_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Size 13.4 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ca113f052dc91049132eb56318f4060693b2178992880fc51dd563765dc8f12c
BLAKE2b-256 checksum
How to use checksums
07d17f6c3da9997f7b0b30d676d2a21cd61aae178577167bd0ded10690d60b85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

10 release files

0.1.0

10 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page