Files
JIANT/tests/pitch.py
T
kurogedelic 5684e187b0 Felucca 0.8-beta source
Firmware, update loader, build tools, assets, web installer and editor,
host tests. Four tracks (three synth parts and a drum track), user presets
with live editor sync (protocol v2), editor protocol v3 (tracks), the
command-line installer tools/fm1_install.py.
2026-10-03 16:06:39 +09: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")