Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

AudioVolumeConverter and AudioEchoConverter corrupt unsigned 8-bit PCM silence

Abierto
#2,933 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
numpy, python

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
4.5k
Forks
896
Merge medio
2 d 22 h
PR fusionados (30 d)
220

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/PyRIT

Todos los issues de microsoft/PyRIT

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.