Skip to main content

fasr-enhancement-deepfilternet

英文文档地址: README_EN.md

DeepFilterNet 音频增强插件。离线 enhance() 和流式 push_chunk() 现在都 使用 deepfilternet-rs 包,由它通过 PyO3 将官方 DeepFilterNet Rust runtime 暴露给 Python。

安装

pip install fasr-enhancement-deepfilternet

stream_backend = "rust" 由独立的 deepfilternet-rs 包提供。使用 deepfilternet-rs 预编译 wheel 时,目标机器不需要 Rust。

注册模型

注册名 类 适用场景
deepfilternet DeepFilterNetEnhancement 高质量离线与流式降噪

使用方式

from fasr.data import Waveform
from fasr_enhancement_deepfilternet import DeepFilterNetEnhancement

model = DeepFilterNetEnhancement(sample_rate=16000)
enhanced = model.enhance(Waveform(data=audio, sample_rate=16000))

流式使用:

from fasr.data import AudioChunk, Waveform
from fasr_enhancement_deepfilternet import DeepFilterNetEnhancement

model = DeepFilterNetEnhancement(sample_rate=16000, stream_backend="rust")
for enhanced_chunk in model.push_chunk(
    AudioChunk(
        stream_id="session-1",
        waveform=Waveform(data=chunk_audio, sample_rate=16000),
        is_last=False,
    )
):
    ...

Confection 配置

[enhancement_model]
@enhancement_models = "deepfilternet"
sample_rate = 16000
post_filter = true
compensate_delay = true
attenuation_limit_db = 100.0
stream_backend = "rust"
stream_log_level = "warn"
post_filter_beta = 0.0

参数

参数 类型 默认值 说明
sample_rate int 16000 输出给下游模型的采样率
deepfilter_sample_rate int 48000 DeepFilterNet Rust runtime 内部处理采样率
binary_path `str None` None
model_path `str None` None
post_filter bool true 是否启用 DeepFilterNet post-filter
compensate_delay bool true 是否传入 -D 补偿算法延迟
attenuation_limit_db float 100.0 降噪衰减上限,会传给 -a
timeout_seconds float 120.0 为兼容旧配置保留的废弃字段
stream_model_path `str None` None
stream_log_level `str None` "warn"
stream_backend "rust" "rust" 流式 backend。仅支持 deepfilternet-rs 提供的 rust backend
post_filter_beta float 0.0 流式 backend 支持时使用的 post-filter beta

Realtime 状态

当前插件支持一种流式 push_chunk() backend:

  • rust:使用 deepfilternet-rs,它通过 PyO3 封装官方 DeepFilterNet Rust DfTract runtime。

音频会在内部重采样到 backend 要求的采样率,处理完成后再重采样回 sample_rate 供下游 fasr VAD/ASR 使用。现在 batch 与 realtime 共用同一条 runtime 路径, 两种模式下的增强行为会保持一致。

Metadata

Release files for fasr-enhancement-deepfilternet 0.5.8

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

Source distribution (sdist)

Source distribution for fasr-enhancement-deepfilternet 0.5.8
File Size Uploaded
fasr_enhancement_deepfilternet-0.5.8.tar.gz 5.7 kB Details

Release files / fasr_enhancement_deepfilternet-0.5.8.tar.gz

Download URL fasr_enhancement_deepfilternet-0.5.8.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
487eb3c5f57935a63bd2a2ebb129817e73026bfdab1ed7f88d0fea0ea0ef8e35
BLAKE2b-256 checksum
How to use checksums
6b4b6cf58ca82d433604edcc22b789587efa3934891c7233326098636af282cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.5.8 This release

1 release file

0.5.7

1 release file

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