FA-81761 / MIDI event timing / Open access
Time Signature meta event decoding: metronome click left in MIDI clocks · case 01
The click interval is reported as 24 instead of 480 ticks at 480 ppq.
ROOT CAUSE
The cc field (MIDI clocks per click) is returned without converting clocks to ticks.
THE FAILURE
The cc field (MIDI clocks per click) is returned without converting clocks to ticks.
Unsuccessful approach: Dividing ppq by 24 before multiplying loses precision when ppq is not a multiple of 24.
Case contract
Input [bytes, ppq]. bytes must be FF 58 04 nn dd cc bb with nn > 0, dd <= 6 and bb > 0. The denominator is 2**dd; the metronome click is cc MIDI clocks (24 per quarter) converted to ticks as ppq*cc//24; the bar length in ticks is ppq*4*nn//denominator. Return [nn, denominator, click_ticks, bar_ticks] or None.
Why this case matters
MIDI sequencers, file readers and synth drivers depend on exact event ordering and tick/time arithmetic.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 2:
return None
data, ppq = x
if len(data) != 7 or data[0] != 0xFF or data[1] != 0x58 or data[2] != 4:
return None
nn, dd, cc, bb = data[3:7]
if nn == 0 or dd > 6 or bb == 0 or ppq <= 0:
return None
den = 2 ** dd
click = cc
bar = ppq * 4 * nn // den
return [nn, den, click, bar]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[255, 88, 4, 4, 2, 24, 8], 480], [4, 4, 480, 1920]), ([[255, 88, 4, 3, 2, 24, 8], 100], [3, 4, 100, 300]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 8], 0], None), ([[255, 88, 4, 0, 2, 24, 8], 480], None), ([[255, 88, 4, 4, 7, 24, 8], 480], None), ([[255, 88, 5, 4, 2, 24, 8], 480], None), ([[255, 88, 3, 4, 2, 24, 8], 480], None)], [([[255, 88, 4, 4, 2, 24, 8], 480], [4, 4, 480, 1920]), ([[255, 88, 4, 6, 3, 36, 8], 480], [6, 8, 720, 1440]), ([[255, 88, 4, 7, 3, 12, 8], 90], [7, 8, 45, 315]), ([[255, 88, 5, 4, 2, 24, 8], 480], None), ([[255, 88, 3, 4, 2, 24, 8], 480], None), ([[255, 89, 4, 4, 2, 24, 8], 480], None), ([[255, 88, 4, 4, 2, 24, 0], 480], None), ([[255, 88, 4, 9, 3, 18, 8], 100], [9, 8, 75, 450])], [([[255, 88, 4, 4, 2, 24, 8], 480], [4, 4, 480, 1920]), ([[255, 88, 4, 6, 3, 36, 8], 480], [6, 8, 720, 1440]), ([[255, 88, 4, 3, 2, 24, 8], 100], [3, 4, 100, 300]), ([[255, 88, 4, 7, 3, 12, 8], 90], [7, 8, 45, 315]), ([[255, 88, 4, 5, 4, 6, 8], 90], [5, 16, 22, 112]), ([[255, 88, 4, 2, 1, 48, 8], 96], [2, 2, 192, 384]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 0], 480], None)], [([[255, 88, 4, 3, 2, 24, 8], 100], [3, 4, 100, 300]), ([[255, 88, 4, 7, 3, 12, 8], 90], [7, 8, 45, 315]), ([[255, 88, 4, 5, 4, 6, 8], 90], [5, 16, 22, 112]), ([[255, 88, 4, 2, 1, 48, 8], 96], [2, 2, 192, 384]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 8], 0], None), ([[255, 88, 4, 9, 3, 18, 8], 100], [9, 8, 75, 450]), ([[255, 88, 4, 4, 0, 96, 8], 120], [4, 1, 480, 1920])], [([[255, 88, 4, 5, 4, 6, 8], 90], [5, 16, 22, 112]), ([[255, 88, 4, 2, 1, 48, 8], 96], [2, 2, 192, 384]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 8], 0], None), ([[255, 88, 4, 0, 2, 24, 8], 480], None), ([[255, 88, 4, 4, 7, 24, 8], 480], None), ([[255, 88, 4, 9, 3, 18, 8], 100], [9, 8, 75, 450]), ([[255, 88, 4, 4, 0, 96, 8], 120], [4, 1, 480, 1920])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 0 | [4, 4, 24, 1920] | [4, 4, 480, 1920] | Failed |
| oracle 1 | [3, 4, 24, 300] | [3, 4, 100, 300] | Failed |
| oracle 2 | [3, 16, 6, 67] | [3, 16, 22, 67] | Failed |
| oracle 3 | None | None | Passed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 002a8daf61b75c880d2f2c141657c344013606ba1dd37543781998bc2600a8cc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 2:
return None
data, ppq = x
if len(data) != 7 or data[0] != 0xFF or data[1] != 0x58 or data[2] != 4:
return None
nn, dd, cc, bb = data[3:7]
if nn == 0 or dd > 6 or bb == 0 or ppq <= 0:
return None
den = 2 ** dd
click = ppq // 24 * cc
bar = ppq * 4 * nn // den
return [nn, den, click, bar]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[255, 88, 4, 4, 2, 24, 8], 480], [4, 4, 480, 1920]), ([[255, 88, 4, 3, 2, 24, 8], 100], [3, 4, 100, 300]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 8], 0], None), ([[255, 88, 4, 0, 2, 24, 8], 480], None), ([[255, 88, 4, 4, 7, 24, 8], 480], None), ([[255, 88, 5, 4, 2, 24, 8], 480], None), ([[255, 88, 3, 4, 2, 24, 8], 480], None)], [([[255, 88, 4, 4, 2, 24, 8], 480], [4, 4, 480, 1920]), ([[255, 88, 4, 6, 3, 36, 8], 480], [6, 8, 720, 1440]), ([[255, 88, 4, 7, 3, 12, 8], 90], [7, 8, 45, 315]), ([[255, 88, 5, 4, 2, 24, 8], 480], None), ([[255, 88, 3, 4, 2, 24, 8], 480], None), ([[255, 89, 4, 4, 2, 24, 8], 480], None), ([[255, 88, 4, 4, 2, 24, 0], 480], None), ([[255, 88, 4, 9, 3, 18, 8], 100], [9, 8, 75, 450])], [([[255, 88, 4, 4, 2, 24, 8], 480], [4, 4, 480, 1920]), ([[255, 88, 4, 6, 3, 36, 8], 480], [6, 8, 720, 1440]), ([[255, 88, 4, 3, 2, 24, 8], 100], [3, 4, 100, 300]), ([[255, 88, 4, 7, 3, 12, 8], 90], [7, 8, 45, 315]), ([[255, 88, 4, 5, 4, 6, 8], 90], [5, 16, 22, 112]), ([[255, 88, 4, 2, 1, 48, 8], 96], [2, 2, 192, 384]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 0], 480], None)], [([[255, 88, 4, 3, 2, 24, 8], 100], [3, 4, 100, 300]), ([[255, 88, 4, 7, 3, 12, 8], 90], [7, 8, 45, 315]), ([[255, 88, 4, 5, 4, 6, 8], 90], [5, 16, 22, 112]), ([[255, 88, 4, 2, 1, 48, 8], 96], [2, 2, 192, 384]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 8], 0], None), ([[255, 88, 4, 9, 3, 18, 8], 100], [9, 8, 75, 450]), ([[255, 88, 4, 4, 0, 96, 8], 120], [4, 1, 480, 1920])], [([[255, 88, 4, 5, 4, 6, 8], 90], [5, 16, 22, 112]), ([[255, 88, 4, 2, 1, 48, 8], 96], [2, 2, 192, 384]), ([[255, 88, 4, 3, 4, 6, 8], 90], [3, 16, 22, 67]), ([[255, 88, 4, 4, 2, 24, 8], 0], None), ([[255, 88, 4, 0, 2, 24, 8], 480], None), ([[255, 88, 4, 4, 7, 24, 8], 480], None), ([[255, 88, 4, 9, 3, 18, 8], 100], [9, 8, 75, 450]), ([[255, 88, 4, 4, 0, 96, 8], 120], [4, 1, 480, 1920])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("oracle %d" % i, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 0 | [4, 4, 480, 1920] | [4, 4, 480, 1920] | Passed |
| oracle 1 | [3, 4, 96, 300] | [3, 4, 100, 300] | Failed |
| oracle 2 | [3, 16, 18, 67] | [3, 16, 22, 67] | Failed |
| oracle 3 | None | None | Passed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 5494a37856587994805d19af74dfaea78248eb4627a47ac2c6bd165d18657ec3
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic bounded teaching model with a stipulated toy contract; it is not a complete Standard MIDI File or MIDI 1.0/2.0 implementation. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:50:05.885752+00:00.
Case digest / 8bd675a7618544d6d684177c5f9a41354da67a15cb83977e2f363479fada2ff9