FA-81671 / MIDI event timing / Open access
Sustain pedal note-off deferral: overlapping re-strike overwrites the earlier note · case 01
Striking a note again while its key is still down loses the first instance entirely.
ROOT CAUSE
Only pedal-held notes are closed on re-strike; a still-pressed note has its start overwritten.
THE FAILURE
Only pedal-held notes are closed on re-strike; a still-pressed note has its start overwritten.
Unsuccessful approach: Dropping the close entirely loses every re-struck instance, including pedal-held ones.
Case contract
Input time-ordered events [tick, kind, value]: kind on/off with a note number, or cc64 with a controller value (pedal down when value >= 64). A note-off while the pedal is down is deferred until the pedal goes up. Re-striking a note that is still sounding ends the previous instance at the new tick. Notes still sounding at the end end at the last event tick. Return sorted [note, start, end] triples.
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
down = False
sounding = {}
held = set()
done = []
last = 0
for tick, kind, value in x:
last = max(last, tick)
if kind == 'cc64':
now_down = value >= 64
if down and not now_down:
for n in sorted(held):
done.append([n, sounding.pop(n), tick])
held = set()
down = now_down
elif kind == 'on':
if value in held:
done.append([value, sounding.pop(value), tick])
held.discard(value)
sounding[value] = tick
elif kind == 'off':
if value not in sounding:
continue
if down:
held.add(value)
else:
done.append([value, sounding.pop(value), tick])
else:
return None
for n in sorted(sounding):
done.append([n, sounding[n], last])
done.sort()
return done
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 60], [10, 'off', 60]], [[60, 0, 10]]), ([[0, 'cc64', 127], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 20]]), ([[0, 'cc64', 64], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 63]], [[60, 0, 20]]), ([[0, 'cc64', 63], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 10]]), ([[0, 'cc64', 100], [0, 'on', 60], [5, 'off', 60], [8, 'on', 60], [12, 'cc64', 0], [30, 'off', 60]], [[60, 0, 8], [60, 8, 30]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'on', 60], [0, 'on', 64], [7, 'off', 64]], [[60, 0, 7], [64, 0, 7]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]])], [([[0, 'cc64', 63], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 10]]), ([[0, 'cc64', 100], [0, 'on', 60], [1, 'on', 64], [5, 'off', 60], [6, 'off', 64], [8, 'on', 60], [12, 'cc64', 0]], [[60, 0, 8], [60, 8, 12], [64, 1, 12]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'on', 60], [0, 'on', 64], [7, 'off', 64]], [[60, 0, 7], [64, 0, 7]]), ([[0, 'cc64', 127], [0, 'on', 60], [4, 'off', 60], [9, 'on', 62]], [[60, 0, 9], [62, 9, 9]]), ([[0, 'cc64', 1], [0, 'on', 60], [3, 'off', 60], [9, 'cc64', 0]], [[60, 0, 3]]), ([[0, 'pb', 0]], None), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])], [([[0, 'cc64', 100], [0, 'on', 60], [5, 'off', 60], [8, 'on', 60], [12, 'cc64', 0], [30, 'off', 60]], [[60, 0, 8], [60, 8, 30]]), ([[0, 'cc64', 100], [0, 'on', 60], [1, 'on', 64], [5, 'off', 60], [6, 'off', 64], [8, 'on', 60], [12, 'cc64', 0]], [[60, 0, 8], [60, 8, 12], [64, 1, 12]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'cc64', 1], [0, 'on', 60], [3, 'off', 60], [9, 'cc64', 0]], [[60, 0, 3]]), ([[0, 'pb', 0]], None), ([], []), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])], [([[0, 'on', 60], [10, 'off', 60]], [[60, 0, 10]]), ([[0, 'cc64', 127], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 20]]), ([[0, 'cc64', 64], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 63]], [[60, 0, 20]]), ([[0, 'cc64', 100], [0, 'on', 60], [5, 'off', 60], [8, 'on', 60], [12, 'cc64', 0], [30, 'off', 60]], [[60, 0, 8], [60, 8, 30]]), ([[0, 'cc64', 100], [0, 'on', 60], [1, 'on', 64], [5, 'off', 60], [6, 'off', 64], [8, 'on', 60], [12, 'cc64', 0]], [[60, 0, 8], [60, 8, 12], [64, 1, 12]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])], [([[0, 'on', 60], [10, 'off', 60]], [[60, 0, 10]]), ([[0, 'cc64', 127], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 20]]), ([[0, 'cc64', 64], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 63]], [[60, 0, 20]]), ([[0, 'cc64', 63], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 10]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'on', 60], [0, 'on', 64], [7, 'off', 64]], [[60, 0, 7], [64, 0, 7]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])]]
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 | [[60, 0, 10]] | [[60, 0, 10]] | Passed |
| oracle 1 | [[60, 0, 20]] | [[60, 0, 20]] | Passed |
| oracle 2 | [[60, 0, 20]] | [[60, 0, 20]] | Passed |
| oracle 3 | [[60, 0, 10]] | [[60, 0, 10]] | Passed |
| oracle 4 | [[60, 0, 8], [60, 8, 30]] | [[60, 0, 8], [60, 8, 30]] | Passed |
| oracle 5 | [[60, 5, 9]] | [[60, 0, 5], [60, 5, 9]] | Failed |
| oracle 6 | [[60, 0, 7], [64, 0, 7]] | [[60, 0, 7], [64, 0, 7]] | Passed |
| oracle 7 | [[50, 1, 5], [50, 5, 12], [52, 2, 12]] | [[50, 1, 5], [50, 5, 12], [52, 2, 12]] | Passed |
SHA-256 / ab35fd3770ecf4b8dc9b55a7eb071cd0c7609886a0efee736e9d47fbc2a84a2e
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
down = False
sounding = {}
held = set()
done = []
last = 0
for tick, kind, value in x:
last = max(last, tick)
if kind == 'cc64':
now_down = value >= 64
if down and not now_down:
for n in sorted(held):
done.append([n, sounding.pop(n), tick])
held = set()
down = now_down
elif kind == 'on':
if value in sounding:
held.discard(value)
sounding[value] = tick
elif kind == 'off':
if value not in sounding:
continue
if down:
held.add(value)
else:
done.append([value, sounding.pop(value), tick])
else:
return None
for n in sorted(sounding):
done.append([n, sounding[n], last])
done.sort()
return done
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 'on', 60], [10, 'off', 60]], [[60, 0, 10]]), ([[0, 'cc64', 127], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 20]]), ([[0, 'cc64', 64], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 63]], [[60, 0, 20]]), ([[0, 'cc64', 63], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 10]]), ([[0, 'cc64', 100], [0, 'on', 60], [5, 'off', 60], [8, 'on', 60], [12, 'cc64', 0], [30, 'off', 60]], [[60, 0, 8], [60, 8, 30]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'on', 60], [0, 'on', 64], [7, 'off', 64]], [[60, 0, 7], [64, 0, 7]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]])], [([[0, 'cc64', 63], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 10]]), ([[0, 'cc64', 100], [0, 'on', 60], [1, 'on', 64], [5, 'off', 60], [6, 'off', 64], [8, 'on', 60], [12, 'cc64', 0]], [[60, 0, 8], [60, 8, 12], [64, 1, 12]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'on', 60], [0, 'on', 64], [7, 'off', 64]], [[60, 0, 7], [64, 0, 7]]), ([[0, 'cc64', 127], [0, 'on', 60], [4, 'off', 60], [9, 'on', 62]], [[60, 0, 9], [62, 9, 9]]), ([[0, 'cc64', 1], [0, 'on', 60], [3, 'off', 60], [9, 'cc64', 0]], [[60, 0, 3]]), ([[0, 'pb', 0]], None), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])], [([[0, 'cc64', 100], [0, 'on', 60], [5, 'off', 60], [8, 'on', 60], [12, 'cc64', 0], [30, 'off', 60]], [[60, 0, 8], [60, 8, 30]]), ([[0, 'cc64', 100], [0, 'on', 60], [1, 'on', 64], [5, 'off', 60], [6, 'off', 64], [8, 'on', 60], [12, 'cc64', 0]], [[60, 0, 8], [60, 8, 12], [64, 1, 12]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'cc64', 1], [0, 'on', 60], [3, 'off', 60], [9, 'cc64', 0]], [[60, 0, 3]]), ([[0, 'pb', 0]], None), ([], []), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])], [([[0, 'on', 60], [10, 'off', 60]], [[60, 0, 10]]), ([[0, 'cc64', 127], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 20]]), ([[0, 'cc64', 64], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 63]], [[60, 0, 20]]), ([[0, 'cc64', 100], [0, 'on', 60], [5, 'off', 60], [8, 'on', 60], [12, 'cc64', 0], [30, 'off', 60]], [[60, 0, 8], [60, 8, 30]]), ([[0, 'cc64', 100], [0, 'on', 60], [1, 'on', 64], [5, 'off', 60], [6, 'off', 64], [8, 'on', 60], [12, 'cc64', 0]], [[60, 0, 8], [60, 8, 12], [64, 1, 12]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])], [([[0, 'on', 60], [10, 'off', 60]], [[60, 0, 10]]), ([[0, 'cc64', 127], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 20]]), ([[0, 'cc64', 64], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 63]], [[60, 0, 20]]), ([[0, 'cc64', 63], [0, 'on', 60], [10, 'off', 60], [20, 'cc64', 0]], [[60, 0, 10]]), ([[0, 'on', 60], [5, 'on', 60], [9, 'off', 60]], [[60, 0, 5], [60, 5, 9]]), ([[0, 'on', 60], [0, 'on', 64], [7, 'off', 64]], [[60, 0, 7], [64, 0, 7]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0]], [[50, 1, 5], [50, 5, 12], [52, 2, 12]]), ([[0, 'cc64', 127], [1, 'on', 50], [2, 'on', 52], [3, 'off', 50], [4, 'off', 52], [5, 'on', 50], [9, 'off', 50], [12, 'cc64', 0], [15, 'on', 70], [16, 'off', 70]], [[50, 1, 5], [50, 5, 12], [52, 2, 12], [70, 15, 16]])]]
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 | [[60, 0, 10]] | [[60, 0, 10]] | Passed |
| oracle 1 | [[60, 0, 20]] | [[60, 0, 20]] | Passed |
| oracle 2 | [[60, 0, 20]] | [[60, 0, 20]] | Passed |
| oracle 3 | [[60, 0, 10]] | [[60, 0, 10]] | Passed |
| oracle 4 | [[60, 8, 30]] | [[60, 0, 8], [60, 8, 30]] | Failed |
| oracle 5 | [[60, 5, 9]] | [[60, 0, 5], [60, 5, 9]] | Failed |
| oracle 6 | [[60, 0, 7], [64, 0, 7]] | [[60, 0, 7], [64, 0, 7]] | Passed |
| oracle 7 | [[50, 5, 12], [52, 2, 12]] | [[50, 1, 5], [50, 5, 12], [52, 2, 12]] | Failed |
SHA-256 / f9c31bd27321a2139bf177923a93d608c6b34b33bc0e2cebc598575b305c24c1
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.080104+00:00.
Case digest / 24620704d76a72826ecbc1fb714b80ca0f5ae978fbca11e02ee407a842d2b1ca