AudioVolumeConverter and AudioEchoConverter corrupt unsigned 8-bit PCM silence
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- numpy, python
调研方向
Start with the AudioVolumeConverter and AudioEchoConverter implementations and their public convert_async entry points. Reproduce the issue with the provided unsigned.wav setup, then compare the unsigned 8-bit handling with the existing signed PCM behavior. Done means both converters return eight uint8 silence samples with value 128 while preserving signed PCM behavior.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
AudioVolumeConverter and AudioEchoConverter perform amplitude arithmetic directly on unsigned 8-bit PCM values. In this format silence is encoded as 128, not 0. Scaling or summing the uncentered values introduces a DC offset, and echo creates a discontinuity at the delay boundary even for a completely silent input.
Both converters accept the WAV and return successfully. This is distinct from the non-finite parameter validation fixes in #2613 and #2566: all parameters and input samples here are valid and finite.
Steps/Code to Reproduce
Run from an environment with PyRIT installed:
import asyncio
import tempfile
from pathlib import Path
import numpy as np
from scipy.io import wavfile
from pyrit.converter import AudioEchoConverter, AudioVolumeConverter
from pyrit.memory import CentralMemory, SQLiteMemory
async def main_async():
with tempfile.TemporaryDirectory() as directory:
memory = SQLiteMemory(db_path=':memory:')
memory.results_path = directory
CentralMemory.set_memory_instance(memory)
try:
source = Path(directory) / 'unsigned.wav'
samples = np.full(8, 128, dtype=np.uint8)
wavfile.write(source, 8000, samples)
for converter in (AudioVolumeConverter(volume_factor=0.5), AudioEchoConverter(delay=0.0005, decay=0.5)):
result = await converter.convert_async(prompt=str(source))
rate, output = wavfile.read(result.output_text)
print(type(converter).__name__ + ':', output.dtype, output.tolist())
finally:
memory.dispose_engine()
asyncio.run(main_async())
Expected Results
All eight output samples remain uint8 value 128 (silence), for both volume scaling and echo. Amplitude processing must center unsigned PCM around its midpoint before applying the effect, then restore the midpoint and clip to the original range.
Actual Results
AudioVolumeConverter: uint8 [64, 64, 64, 64, 64, 64, 64, 64]
AudioEchoConverter: uint8 [128, 128, 128, 128, 192, 192, 192, 192]
The input is eight uint8 samples all equal to 128. Volume factor is 0.5; echo delay is four samples and decay is 0.5. Signed PCM should retain its existing behavior.
Versions
Linux, Python 3.12.3, PyRIT 1.2.0.dev0 at 8934a3c4, NumPy 2.5.3, SciPy 1.18.1. Reproduced locally through the public convert_async methods with real WAV files; no model or external service is used.
- 主要语言
- Python
- 星标
- 4.5k
- 派生
- 896
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 230
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/PyRIT 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 2 天内回复
-
Bug: triage GUI help wanted
难度 2/5 1-3 小时 新手友好度 86/100
microsoft/PyRIT#2868 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
mozilla/bedrock#17413 · 1 个 reaction ·
维护者通常 2 天内回复
-
instance instance add
难度 2/5 1-3 小时 新手友好度 68/100
searxng/searx-instances#943 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug tools
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
lance-format/lance#9655 ·
维护者通常 2 天内回复