import wave from pathlib import Path import numpy as np from midnight_static.mixer import SAMPLE_RATE, mix_crude_broadcast, write_mono_wav def test_crude_mixer_writes_louder_longer_output(tmp_path: Path): dialogue_path = tmp_path / "dialogue.wav" output_path = tmp_path / "mix.wav" seconds = np.arange(SAMPLE_RATE, dtype=np.float32) / SAMPLE_RATE dialogue = np.sin(2 * np.pi * 330 * seconds).astype(np.float32) * 0.2 write_mono_wav(dialogue_path, dialogue) mix_crude_broadcast(dialogue_path, output_path) assert output_path.exists() with wave.open(str(output_path), "rb") as wav_file: assert wav_file.getnchannels() == 1 assert wav_file.getframerate() == SAMPLE_RATE assert wav_file.getnframes() > SAMPLE_RATE