Skip to main content

DeepFilterNet audio enhancement model for fasr

Project description

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 路径, 两种模式下的增强行为会保持一致。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fasr_enhancement_deepfilternet-0.5.8.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file fasr_enhancement_deepfilternet-0.5.8.tar.gz.

File metadata

  • Download URL: fasr_enhancement_deepfilternet-0.5.8.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for fasr_enhancement_deepfilternet-0.5.8.tar.gz
Algorithm Hash digest
SHA256 487eb3c5f57935a63bd2a2ebb129817e73026bfdab1ed7f88d0fea0ea0ef8e35
MD5 be9a60302f1ed789d7eb5549d8c3e1e5
BLAKE2b-256 6b4b6cf58ca82d433604edcc22b789587efa3934891c7233326098636af282cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page