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.7.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.7-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_enhancement_dtln-0.5.7.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","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.7.tar.gz
Algorithm Hash digest
SHA256 4d3b568c7f9d350eb1508829355145d795b647597ba054e62f06bfbadf8ba74b
MD5 b1bd70629cc0172dda0739b222d83eb9
BLAKE2b-256 e25083b82d5e40def0da87565a451699502c3f47dfb951ea174a193332a7fe8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fasr_enhancement_dtln-0.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 232ecbd0ff7f25c8c73ef7aeddb741f48a8aa3bc691b8329a340cc8f4151bd02
MD5 d125fb94edc4308032f6f375d95ea60d
BLAKE2b-256 077722e9e3b79dc0936ea7641afe7544125b6f06606517171e4d924b10fa12e2

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