FA-81601 / MIDI event timing / Open access
Format 1 to format 0 track merge: track clocks chained end to end · case 01
The second track is placed after the first track's last event instead of starting at tick 0.
ROOT CAUSE
The running tick is initialised once for all tracks instead of per track.
THE FAILURE
The running tick is initialised once for all tracks instead of per track.
Unsuccessful approach: Starting each track at the previous end-of-track time still chains tracks sequentially.
Case contract
Input a list of tracks, each a list of [delta, event]. The event "eot" marks end of track and is not copied. Merge all events by absolute time; ties go to the lower track index, then original order. Output [delta, event] pairs followed by one final [delta, "eot"] at the latest end-of-track or last event time.
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
events = []
end = 0
tick = 0
for ti, track in enumerate(x):
for seq, (delta, ev) in enumerate(track):
tick += delta
if ev == 'eot':
end = max(end, tick)
continue
events.append((tick, ti, seq, ev))
events.sort()
out = []
prev = 0
for tick, ti, seq, ev in events:
out.append([tick - prev, ev])
prev = tick
end = max(end, prev)
out.append([end - prev, 'eot'])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])]]
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, 'a'], [10, 'b'], [5, 'c'], [20, 'eot']] | [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']] | Failed |
| oracle 1 | [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']] | [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']] | Passed |
| oracle 2 | [[10, 'z'], [10, 'a'], [0, 'eot']] | [[10, 'z'], [0, 'a'], [0, 'eot']] | Failed |
| oracle 3 | [[0, 'x'], [150, 'y'], [0, 'eot']] | [[0, 'x'], [50, 'y'], [50, 'eot']] | Failed |
| oracle 4 | [[0, 'x'], [55, 'y'], [0, 'eot']] | [[0, 'x'], [50, 'y'], [0, 'eot']] | Failed |
| oracle 5 | [[0, 'eot']] | [[0, 'eot']] | Passed |
| oracle 6 | [[0, 'eot']] | [[0, 'eot']] | Passed |
| oracle 7 | [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']] | [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']] | Passed |
SHA-256 / 55cff41f275ba5cc3fa4ca1b9446cb10eb4c3e3fc6cccb18821c896a7851970c
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
events = []
end = 0
for ti, track in enumerate(x):
tick = end
for seq, (delta, ev) in enumerate(track):
tick += delta
if ev == 'eot':
end = max(end, tick)
continue
events.append((tick, ti, seq, ev))
events.sort()
out = []
prev = 0
for tick, ti, seq, ev in events:
out.append([tick - prev, ev])
prev = tick
end = max(end, prev)
out.append([end - prev, 'eot'])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[0, 'x'], [100, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [50, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[0, 'tempo'], [0, 'eot']], [[0, 'n1'], [480, 'n2'], [0, 'eot']]], [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']]), ([[[0, 'x'], [5, 'eot']], [[50, 'y'], [0, 'eot']]], [[0, 'x'], [50, 'y'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])], [([[[0, 'a'], [10, 'b'], [0, 'eot']], [[5, 'c'], [20, 'eot']]], [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']]), ([[[10, 'z'], [0, 'eot']], [[10, 'a'], [0, 'eot']]], [[10, 'z'], [0, 'a'], [0, 'eot']]), ([[[3, 'p'], [3, 'q']], [[4, 'r']]], [[3, 'p'], [1, 'r'], [2, 'q'], [0, 'eot']]), ([[[0, 'eot']]], [[0, 'eot']]), ([], [[0, 'eot']]), ([[[5, 'm'], [5, 'n'], [0, 'eot']], [[5, 'k'], [0, 'eot']], [[7, 'j'], [30, 'eot']]], [[5, 'm'], [0, 'k'], [2, 'j'], [3, 'n'], [27, 'eot']]), ([[[0, 'b'], [0, 'a'], [0, 'eot']], [[0, 'c'], [0, 'eot']]], [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']]), ([[[20, 'late'], [0, 'eot']], [[1, 'early'], [2, 'eot']]], [[1, 'early'], [19, 'late'], [0, 'eot']])]]
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, 'a'], [10, 'b'], [5, 'c'], [20, 'eot']] | [[0, 'a'], [5, 'c'], [5, 'b'], [15, 'eot']] | Failed |
| oracle 1 | [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']] | [[0, 'tempo'], [0, 'n1'], [480, 'n2'], [0, 'eot']] | Passed |
| oracle 2 | [[10, 'z'], [10, 'a'], [0, 'eot']] | [[10, 'z'], [0, 'a'], [0, 'eot']] | Failed |
| oracle 3 | [[0, 'x'], [150, 'y'], [0, 'eot']] | [[0, 'x'], [50, 'y'], [50, 'eot']] | Failed |
| oracle 4 | [[0, 'x'], [55, 'y'], [0, 'eot']] | [[0, 'x'], [50, 'y'], [0, 'eot']] | Failed |
| oracle 5 | [[0, 'eot']] | [[0, 'eot']] | Passed |
| oracle 6 | [[0, 'eot']] | [[0, 'eot']] | Passed |
| oracle 7 | [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']] | [[0, 'b'], [0, 'a'], [0, 'c'], [0, 'eot']] | Passed |
SHA-256 / 3d964b990d9037c1954dd29ac039de3a1a081ac9914ebbb12b4213470fbc806b
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:04.447964+00:00.
Case digest / 3abe9bbc3f92d4322d87acde723b0ec476cb8b0f8c849016e076cd1c7ecae966