import argparse import numpy as np import wave def read_wav_int16(path: str): with wave.open(path, "rb") as wav: sample_width = wav.getsampwidth() if sample_width != 2: raise ValueError(f"{path} is {sample_width * 8}-bit PCM; expected 16-bit") sample_rate = wav.getframerate() channels = wav.getnchannels() frame_count = wav.getnframes() raw = wav.readframes(frame_count) samples = np.frombuffer(raw, dtype="