Skip to main content

DTLN audio enhancement model for fasr

Project description

fasr-enhancement-dtln

英文文档地址: README_EN.md

DTLN 音频增强插件。该插件内置 model_1.onnxmodel_2.onnx,并通过 统一的 EnhancementModel 接口同时提供离线 enhance() 和流式 push_chunk() 降噪能力。

安装

pip install fasr-enhancement-dtln

注册模型

注册名 适用场景
dtln DTLNEnhancement 轻量 CPU 离线与实时降噪

使用方式

from fasr.data import Waveform
from fasr_enhancement_dtln import DTLNEnhancement

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

流式用法:

from fasr.data import AudioChunk, Waveform
from fasr_enhancement_dtln import DTLNEnhancement

model = DTLNEnhancement(sample_rate=16000)
for enhanced_chunk in model.push_chunk(
    AudioChunk(
        stream_id="demo",
        waveform=Waveform(data=audio, sample_rate=16000),
        is_last=True,
    )
):
    print(enhanced_chunk.waveform.data.shape)

Confection 配置

[enhancement_model]
@enhancement_models = "dtln"
sample_rate = 16000
providers = ["CPUExecutionProvider"]
intra_op_num_threads = 1
inter_op_num_threads = 1

参数

参数 类型 默认值 说明
sample_rate int 16000 输出采样率
model_1_path str | None None 可选覆盖内置 stage-1 ONNX 模型路径
model_2_path str | None None 可选覆盖内置 stage-2 ONNX 模型路径
providers list[str] ["CPUExecutionProvider"] ONNX Runtime providers
intra_op_num_threads int >= 1 1 显式设置 ORT intra-op 线程数,服务端推荐开启以避免默认绑核告警
inter_op_num_threads int >= 1 1 显式设置 ORT inter-op 线程数,服务端推荐开启以避免默认绑核告警
dtln_sample_rate int 16000 DTLN 内部采样率,当前仅支持 16 kHz

Realtime 状态

当前版本同时支持离线 enhance() 和流式 push_chunk()。两条路径共享同一套 512-sample block / 128-sample hop 的状态化 DTLN 推理循环,以优先保证 batch 与 streaming 输出的一致性。

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_dtln-0.5.8.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fasr_enhancement_dtln-0.5.8-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_enhancement_dtln-0.5.8.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • 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_dtln-0.5.8.tar.gz
Algorithm Hash digest
SHA256 a28476ede62379872cf17b7de54924003514a7a5db26e372b791b29b57916aca
MD5 baaaaca951d8eb49419c523b64b5f59c
BLAKE2b-256 b1172ac28cd8f4b5fcd602376b6ea9926dfff454e9760f8c8f77a76701e95922

See more details on using hashes here.

File details

Details for the file fasr_enhancement_dtln-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: fasr_enhancement_dtln-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • 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_dtln-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4d83b64a2fb3adb0dbf7cd4bc2f5b91b548175ad569a2ba389b468093e20f2db
MD5 b09f41a248773414a9d8a1dd3fee530b
BLAKE2b-256 f228f07289b477bb8e6d273811c1529b3da713757f9c5a43fcb8d2e8d4bde72b

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