Files
clipper-fm1/tests/pitch.py
T
2026-10-04 11:08:49 -04:00

18 lines
571 B
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
"""YIN pitch of hostsim renders (4000 samples from 0.25 s, the held note).
tests/pitch.py build/host/render.wav ...
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tools"))
from sampleio import read_any_wav, yin # noqa: E402
for f in sys.argv[1:]:
sr, x = read_any_wav(Path(f))
a = int(0.25 * sr)
print(f"{f}: {yin(x[a:a + 4000], sr, interpolate=False):.1f} Hz")