FA-81456 / MIDI event timing / Open access
Absolute events to delta-time serialisation: deltas written as absolute ticks · case 01
Every event after the first carries its absolute tick as a delta, so playback drifts later and later.
ROOT CAUSE
The previous-event tick is never advanced after emitting an event.
VERIFIED REPAIR
Restore the delta base update step so that it reads `out.append([tick - prev, kind, note]) prev = tick`.
Unsuccessful approach: Advancing the previous tick before computing the delta makes every delta zero.
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 = 0
for i in order:
tick, kind, note = x[i]
out.append([tick - prev, kind, note])
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]]), ([[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]]), ([], []), ([[-1, 'on', 60]], None)], [([[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]]), ([[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]]), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])], [([[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]]), ([[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]])], [([[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]]), ([], []), ([[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]]), ([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[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), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])]]
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], [10, 'on', 62]] | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | Failed |
| oracle 2 | [[5, 'on', 60], [15, 'off', 60]] | [[5, 'on', 60], [10, 'off', 60]] | Failed |
| oracle 3 | [[0, 'on', 60], [20, 'off', 60], [20, 'on', 64]] | [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]] | Failed |
| oracle 4 | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | Passed |
| oracle 5 | [[3, 'on', 1], [3, 'on', 2], [3, 'on', 3]] | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | Failed |
| oracle 6 | [] | [] | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / a0a79dab940237688ea93ee14bd1e391e3109a9b3c77cb4b388a72ae914d54ea
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 = 0
for i in order:
tick, kind, note = x[i]
prev = tick
out.append([tick - prev, kind, note])
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]]), ([[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]]), ([], []), ([[-1, 'on', 60]], None)], [([[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]]), ([[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]]), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])], [([[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]]), ([[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]])], [([[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]]), ([], []), ([[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]]), ([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[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), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])]]
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], [0, 'off', 60]] | [[0, 'on', 60], [10, 'off', 60]] | Failed |
| oracle 1 | [[0, 'on', 60], [0, 'off', 60], [0, 'on', 62]] | [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]] | Failed |
| oracle 2 | [[0, 'on', 60], [0, 'off', 60]] | [[5, 'on', 60], [10, 'off', 60]] | Failed |
| oracle 3 | [[0, 'on', 60], [0, 'off', 60], [0, 'on', 64]] | [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]] | Failed |
| oracle 4 | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | Passed |
| oracle 5 | [[0, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | Failed |
| oracle 6 | [] | [] | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 4c5a965c3c5f1a6dabb5dd34e13c79823a02b9f1c7586bd16c0c794a002cc207
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]]), ([[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]]), ([], []), ([[-1, 'on', 60]], None)], [([[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]]), ([[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]]), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])], [([[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]]), ([[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]])], [([[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]]), ([], []), ([[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]]), ([[10, 'on', 62], [10, 'off', 60], [0, 'on', 60]], [[0, 'on', 60], [10, 'off', 60], [0, 'on', 62]]), ([[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), ([[30, 'on', 60], [30, 'off', 60], [40, 'off', 60]], [[30, 'off', 60], [0, 'on', 60], [10, 'off', 60]])]]
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, 'on', 60], [20, 'off', 60], [0, 'on', 64]] | [[0, 'on', 60], [20, 'off', 60], [0, 'on', 64]] | Passed |
| oracle 4 | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | [[0, 'off', 59], [0, 'on', 60], [0, 'on', 64]] | Passed |
| oracle 5 | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | [[3, 'on', 1], [0, 'on', 2], [0, 'on', 3]] | Passed |
| oracle 6 | [] | [] | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 28f9c35620142d03a6d8cfbc41c1a4f18b6ca7bcd346184ab8b8287552d450f7
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.141009+00:00.
Case digest / 5f0625d96c351f0b45c06d5db222aeea4b2d031ad4ead5a76792fe52ed3b2db7