mirror of
https://github.com/isod89/sloop-fm1.git
synced 2026-12-06 04:44:22 +01:00
18 lines
571 B
Python
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")
|