FA-81466 / MIDI event timing / Open access
Absolute events to delta-time serialisation: leading silence dropped · case 01
A track whose first event is at tick 5 is serialised with a first delta of 0, removing the opening rest.
ROOT CAUSE
Deltas are measured from the earliest event instead of from tick 0.
VERIFIED REPAIR
Restore the initial delta origin step so that it reads `prev = 0`.
Unsuccessful approach: Measuring from the first listed event can even produce a negative first delta for unsorted input.
Case contract
Input a list of [tick, kind, note] with kind on or off in any order. Emit events sorted by tick; at equal ticks note-offs precede note-ons, and otherwise input order is kept. Each output is [delta from the previous emitted event (the first from tick 0), kind, note]. A negative tick returns 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):
return None
for e in x:
if e[0] < 0:
return None
order = sorted(range(len(x)), key=lambda i: (x[i][0], 0 if x[i][1] == 'off' else 1, i))
out = []
prev = min(e[0] for e in x) if x else 0
for i in order:
tick, kind, note = x[i]
out.append([tick - prev, kind, note])
prev = tick
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([], []), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[-1, 'on', 60]], None)], [([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[20, 'on', 64], [0, 'on', 60], [20, 'off', 60]], [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[20, 'on', 64], [0, 'on', 60], [20, 'off', 60]], [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([], []), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([], []), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])]]
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 | [[0, 'on', 60], [10, 'off', 60]] | [[0, 'on', 60], [10, 'off', 60]] | Passed |
| oracle 1 | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | Passed |
| oracle 2 | [[0, 'on', 60], [10, 'off', 60]] | [[5, 'on', 60], [10, 'off', 60]] | Failed |
| oracle 3 | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | Passed |
| oracle 4 | [[0, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | Failed |
| oracle 5 | [] | [] | Passed |
| oracle 6 | [[0, 'off', 60], [0, 'off', 61], [0, 'on', 60]] | [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]] | Failed |
| oracle 7 | None | None | Passed |
SHA-256 / c630143d9d1825be6af774b669ac03b7dd9b2b9213540e293b46a9906350eaef
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):
return None
for e in x:
if e[0] < 0:
return None
order = sorted(range(len(x)), key=lambda i: (x[i][0], 0 if x[i][1] == 'off' else 1, i))
out = []
prev = x[0][0] if x else 0
for i in order:
tick, kind, note = x[i]
out.append([tick - prev, kind, note])
prev = tick
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([], []), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[-1, 'on', 60]], None)], [([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[20, 'on', 64], [0, 'on', 60], [20, 'off', 60]], [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[20, 'on', 64], [0, 'on', 60], [20, 'off', 60]], [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([], []), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([], []), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])]]
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 | [[0, 'on', 60], [10, 'off', 60]] | [[0, 'on', 60], [10, 'off', 60]] | Passed |
| oracle 1 | [[-10, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | Failed |
| oracle 2 | [[0, 'on', 60], [10, 'off', 60]] | [[5, 'on', 60], [10, 'off', 60]] | Failed |
| oracle 3 | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | Passed |
| oracle 4 | [[0, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | Failed |
| oracle 5 | [] | [] | Passed |
| oracle 6 | [[0, 'off', 60], [0, 'off', 61], [0, 'on', 60]] | [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]] | Failed |
| oracle 7 | None | None | Passed |
SHA-256 / 7b55ffb2bf2d885458a74760de2498d6e7c38e8bcdb786a76616576e2c005eaa
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list):
return None
for e in x:
if e[0] < 0:
return None
order = sorted(range(len(x)), key=lambda i: (x[i][0], 0 if x[i][1] == 'off' else 1, i))
out = []
prev = 0
for i in order:
tick, kind, note = x[i]
out.append([tick - prev, kind, note])
prev = tick
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([], []), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[-1, 'on', 60]], None)], [([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[20, 'on', 64], [0, 'on', 60], [20, 'off', 60]], [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[20, 'on', 64], [0, 'on', 60], [20, 'off', 60]], [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]], [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]]), ([], []), ([[100, 'on', 60], [50, 'on', 61], [75, 'off', 61]], [[50, 'on', 61], [25, 'off', 61], [25, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])], [([[0, 'on', 60], [10, 'off', 60]], [[0, 'on', 60], [10, 'off', 60]]), ([[5, 'on', 60], [15, 'off', 60]], [[5, 'on', 60], [10, 'off', 60]]), ([[0, 'on', 60], [0, 'on', 64], [0, 'off', 59]], [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]]), ([], []), ([[7, 'off', 60], [7, 'on', 60], [7, 'off', 61]], [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]]), ([[-1, 'on', 60]], None), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]]), ([[12, 'on', 70]], [[12, 'on', 70]])]]
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 | [[0, 'on', 60], [10, 'off', 60]] | [[0, 'on', 60], [10, 'off', 60]] | Passed |
| oracle 1 | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | Passed |
| oracle 2 | [[5, 'on', 60], [10, 'off', 60]] | [[5, 'on', 60], [10, 'off', 60]] | Passed |
| oracle 3 | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | Passed |
| oracle 4 | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | Passed |
| oracle 5 | [] | [] | Passed |
| oracle 6 | [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]] | [[7, 'off', 60], [0, 'off', 61], [0, 'on', 60]] | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / a24828f1fd8268aa81c246e632a96c230c9ae29ce75331b1b8f8392d9be4c3ee
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:03.181115+00:00.
Case digest / 2813f2345eec3973bfa2ecbd634e24589e4d46daf1556fa3ba9a5f9b49b4e038