[Feature]: internal processing is 32 bit float but output is truncated to 16 bit integer - allow for 32 or 24 bit output
还没有人认领这个 Issue。
- #308 来自 @be-student —— 已关闭,未合并
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 55/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从 audio_separator/separator/common_separator.py 开始,然后跟踪 output_subtype 在 separator.py 以及 audio_separator/utils/cli.py 中的参数解析器里的传递过程。检查现有的 pydub 和 soundfile 路径如何处理 WAV 和 FLAC 输出,并验证配置的位深能够传递到 Separator。完成的标准是 24-bit 无损输出能够正常工作,同时现有的 16-bit 和有损格式行为保持不变。
由索引模型根据 Issue 内容生成。
描述
Description
Claude Code:
1. 24-bit PCM output support via soundfile
Files:
audio_separator\separator\common_separator.py—__init__()+write_audio_pydub()audio_separator\separator\separator.py—__init__()+ config dictaudio_separator\utils\cli.py— argument parser + Separator instantiation
Date: 2025-02-12
Problem:
Models output float32 (~24 bits of precision) but write_audio_pydub() truncates all output to int16 (16-bit) before writing. The existing write_audio_soundfile() path (--use_soundfile) has a bug where float data is assigned to an int16 interleave array without scaling by 32767, producing silent output. Documentation claimed 24-bit output but the library was always writing 16-bit.
Changes:
common_separator.py
Added output_subtype from config (after line ~85):
self.output_subtype = config.get("output_subtype", "PCM_16")
Added early-return soundfile path in write_audio_pydub() (before the int16 conversion):
# For WAV/FLAC with PCM_24, use soundfile directly (pydub can't do 24-bit)
file_format = stem_path.lower().split(".")[-1]
if self.output_subtype == "PCM_24" and file_format in ("wav", "flac"):
import soundfile as sf
sf.write(stem_path, stem_source, self.sample_rate, subtype="PCM_24")
self.logger.debug(f"Exported 24-bit {file_format.upper()} via soundfile to {stem_path}")
return
separator.py
Added output_subtype="PCM_16" parameter to __init__(), stored as self.output_subtype, and included in the config dict passed to architecture-specific separators.
cli.py
Added --output_subtype argument (default "PCM_16") and passed it to the Separator constructor.
Why: Preserves the full precision of model output. 24-bit PCM captures the float32 model output without the quantization noise from 16-bit truncation. The existing pydub int16 path remains untouched for 16-bit output and lossy formats (MP3, M4A, etc.).
Note: The broken write_audio_soundfile() path was not modified — instead, the fix uses soundfile.write() directly inside the existing write_audio_pydub() method with an early return for 24-bit lossless formats. This avoids the interleaving bugs in the soundfile path while keeping the change minimal.
Configuration: Controlled by separation_bit_depth in the [output_processing] section of UpMixery.ini. The value is passed to audio_separator_launcher.py via --bit-depth, which maps it to --output_subtype PCM_24 or PCM_16.
- 主要语言
- Python
- 星标
- 1.5k
- 派生
- 216
- 平均合并
- 1 小时
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nomadkaraoke/python-audio-separator 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 68/100
nomadkaraoke/python-audio-separator#292 · 2 条评论 ·
-
Confusing info in README可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 1/5 1 小时以内 新手友好度 65/100
nomadkaraoke/python-audio-separator#246 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 48/100
查看 nomadkaraoke/python-audio-separator 的全部 Issue
相似的 Issue
-
request_access
难度 1/5 1 小时以内 新手友好度 75/100
-
blocker bug
难度 2/5 1-3 小时 新手友好度 76/100
achisolomon/software-factory#305 ·
-
难度 2/5 1-3 小时 新手友好度 92/100
erkamyaman/rust-anything#963 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
commonmark/commonmark-spec#850 ·
-
documentation good first issue
难度 2/5 1-3 小时 新手友好度 78/100