diff --git a/tools/test_fixed_key_voicing.py b/tools/test_fixed_key_voicing.py index af65739..fa4e20c 100644 --- a/tools/test_fixed_key_voicing.py +++ b/tools/test_fixed_key_voicing.py @@ -37,7 +37,8 @@ CASES = [ ("G", 7, 10, "C", (43, 48, 52, 55, 60, 64)), ("G", 7, 13, "D", (42, 45, 50, 57, 62, 66)), ("G", 7, 16, "Em", (40, 47, 52, 55, 59, 64)), - ("G", 7, 19, "#Fm", (42, 49, 54, 58, 61, 66)), + # 键 19 出厂是小三:C 调 IV 的 Fm 行再 +1 + ("G", 7, 19, "#Fm", (42, 49, 54, 57, 61, 66)), # D I = C 调 II 行;F# I = F 调 I 行全体 +1 ("D", 2, 1, "D", (42, 45, 50, 57, 62, 66)), ("F#", 6, 1, "F#", (42, 49, 54, 58, 61, 66)), @@ -55,8 +56,9 @@ def last_string_note(text: str, string_n: int) -> int | None: def main() -> int: fails = 0 print("=== 固定调六弦音高 RTT ===", flush=True) - with open_session(reset=False) as sess: + with open_session(reset=True) as sess: sess.cmd("tone pick f", settle=1.0) + sess.cmd("log level E", settle=0.3) sess.cmd("chord key 23", settle=0.3) sess.cmd("chord key 0", settle=0.2) cur_xp = None @@ -69,10 +71,19 @@ def main() -> int: print(f"\n-- {key_name} {chord} key={key} xp={xp}", flush=True) for s in range(6, 0, -1): expect = int(notes[6 - s]) - n0 = len(sess.lines) - sess.cmd(f"string {s}", settle=0.12) - sess.cmd(f"string {s} off", settle=0.05) - got = last_string_note("\n".join(sess.lines[n0:]), s) + got = None + for _try in range(4): + n0 = len(sess.lines) + sess.cmd(f"string {s}", settle=0.02) + deadline = time.monotonic() + 0.6 + while time.monotonic() < deadline: + got = last_string_note("\n".join(sess.lines[n0:]), s) + if got is not None: + break + sess.pump(0.04) + if got is not None: + break + sess.cmd(f"string {s} off", settle=0.02) ok = got == expect if not ok: fails += 1