import math, struct, wave
from pathlib import Path
rate, frames, tone = 48000, 57600, 440
samples = [round(0.2*32767*math.sin(2*math.pi*tone*n/rate)) for n in range(frames)]
def save(name, values, declared):
    with wave.open(str(Path(__file__).with_name(name)), 'wb') as output:
        output.setnchannels(1); output.setsampwidth(2); output.setframerate(declared)
        output.writeframes(struct.pack('<'+'h'*len(values), *values))
save('native-reference.wav', samples, 48000)
save('wrong-header.wav', samples, 16000)
# Decimation is valid for this single 440Hz test tone only, not a general speech resampler.
save('resampled16k.wav', samples[::3], 16000)
print('Author deterministic 440Hz sine PCM; not VoxCPM/TTS/speech output.')
