"""Create peak-normalized listening copies of PCM16 or float32 capture WAVs. Usage: py tools/audio_preview.py out/audio/single-450-baseline Original files retain calibration; preview levels must not be compared by source. """ import argparse import math from pathlib import Path import struct import wave def preview(path, destination): data = path.read_bytes() if data[:4] != b"RIFF" or data[8:12] != b"WAVE": raise ValueError(f"Not a WAV: {path}") offset = 12 fmt = payload = None while offset + 8 <= len(data): tag, size = struct.unpack_from("<4sI", data, offset) chunk = data[offset + 8:offset + 8 + size] if tag == b"fmt ": fmt = struct.unpack_from("