FAILURE MAP
← Case archive

FA-81701 / MIDI event timing / Open access

Tick resolution conversion preserving note length: short notes collapse to zero length · case 01

A one-tick note converted to a coarser resolution ends on the same tick it starts, so it is inaudible.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The collision test only fires when the off lands before the on, not on the same tick.

VERIFIED REPAIR

Restore the minimum length guard step so that it reads `if tick > otick and t <= ot:`.

Unsuccessful approach: Dropping the original-length condition also lengthens notes that were zero-length in the source.

Case contract

Input [events, source_ppq, target_ppq] with events [tick, kind, note] in time order. Each tick maps to tick*target/source rounded half up. A note-off (matched FIFO to the earliest open note-on of the same note) whose original length was positive but whose converted tick is not after its note-on is moved to note-on + 1. Invalid resolutions return 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) != 3:
        return None
    events, src, dst = x
    if src <= 0 or dst <= 0:
        return None
    out = []
    open_on = {}
    for tick, kind, note in events:
        t = (2 * tick * dst + src) // (2 * src)
        if kind == 'on':
            open_on.setdefault(note, []).append((tick, t))
        elif open_on.get(note):
            otick, ot = open_on[note].pop(0)
            if tick > otick and t < ot:
                t = ot + 1
        out.append([t, kind, note])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[1, 'on', 60]], 2, 1], [[1, 'on', 60]]), ([[[3, 'on', 60]], 2, 1], [[2, 'on', 60]]), ([[[0, 'on', 60], [2, 'on', 60], [3, 'off', 60], [9, 'off', 60]], 8, 2], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]])], [([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[3, 'on', 60]], 2, 1], [[2, 'on', 60]]), ([[[0, 'on', 60], [2, 'on', 60], [3, 'off', 60], [9, 'off', 60]], 8, 2], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [100, 'off', 60]], 96, 480], [[0, 'on', 60], [500, 'off', 60]]), ([[[7, 'on', 62], [250, 'off', 62]], 480, 96], [[1, 'on', 62], [50, 'off', 62]]), ([[[0, 'on', 60]], 0, 96], None), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, 'off', 60]])], [([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[7, 'on', 62], [250, 'off', 62]], 480, 96], [[1, 'on', 62], [50, 'off', 62]]), ([[[0, 'on', 60]], 0, 96], None), ([[[0, 'on', 60], [5, 'on', 60], [6, 'off', 60], [40, 'off', 60]], 10, 1], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [4, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[3, 'on', 64], [5, 'off', 64]], 6, 4], [[2, 'on', 64], [3, 'off', 64]])], [([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[3, 'on', 64], [5, 'off', 64]], 6, 4], [[2, 'on', 64], [3, 'off', 64]]), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, 'off', 60]])], [([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[1, 'on', 60]], 2, 1], [[1, 'on', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, '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 fixtureActualExpectedOutcome
oracle 0[[0, 'on', 60], [96, 'off', 60]][[0, 'on', 60], [96, 'off', 60]]Passed
oracle 1[[0, 'on', 60], [0, 'off', 60]][[0, 'on', 60], [1, 'off', 60]]Failed
oracle 2[[1, 'on', 60], [2, 'off', 60]][[1, 'on', 60], [2, 'off', 60]]Passed
oracle 3[[0, 'on', 60], [0, 'off', 60]][[0, 'on', 60], [0, 'off', 60]]Passed
oracle 4[[1, 'on', 60]][[1, 'on', 60]]Passed
oracle 5[[2, 'on', 60]][[2, 'on', 60]]Passed
oracle 6[[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]][[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]Passed
oracle 7[[1, 'on', 61], [1, 'off', 61]][[1, 'on', 61], [2, 'off', 61]]Failed

SHA-256 / 8adfe960b46f8b40b7c831f33891b0fca250694804cce74d3d2399a356d01a64

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) != 3:
        return None
    events, src, dst = x
    if src <= 0 or dst <= 0:
        return None
    out = []
    open_on = {}
    for tick, kind, note in events:
        t = (2 * tick * dst + src) // (2 * src)
        if kind == 'on':
            open_on.setdefault(note, []).append((tick, t))
        elif open_on.get(note):
            otick, ot = open_on[note].pop(0)
            if t <= ot:
                t = ot + 1
        out.append([t, kind, note])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[1, 'on', 60]], 2, 1], [[1, 'on', 60]]), ([[[3, 'on', 60]], 2, 1], [[2, 'on', 60]]), ([[[0, 'on', 60], [2, 'on', 60], [3, 'off', 60], [9, 'off', 60]], 8, 2], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]])], [([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[3, 'on', 60]], 2, 1], [[2, 'on', 60]]), ([[[0, 'on', 60], [2, 'on', 60], [3, 'off', 60], [9, 'off', 60]], 8, 2], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [100, 'off', 60]], 96, 480], [[0, 'on', 60], [500, 'off', 60]]), ([[[7, 'on', 62], [250, 'off', 62]], 480, 96], [[1, 'on', 62], [50, 'off', 62]]), ([[[0, 'on', 60]], 0, 96], None), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, 'off', 60]])], [([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[7, 'on', 62], [250, 'off', 62]], 480, 96], [[1, 'on', 62], [50, 'off', 62]]), ([[[0, 'on', 60]], 0, 96], None), ([[[0, 'on', 60], [5, 'on', 60], [6, 'off', 60], [40, 'off', 60]], 10, 1], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [4, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[3, 'on', 64], [5, 'off', 64]], 6, 4], [[2, 'on', 64], [3, 'off', 64]])], [([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[3, 'on', 64], [5, 'off', 64]], 6, 4], [[2, 'on', 64], [3, 'off', 64]]), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, 'off', 60]])], [([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[1, 'on', 60]], 2, 1], [[1, 'on', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, '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 fixtureActualExpectedOutcome
oracle 0[[0, 'on', 60], [96, 'off', 60]][[0, 'on', 60], [96, 'off', 60]]Passed
oracle 1[[0, 'on', 60], [1, 'off', 60]][[0, 'on', 60], [1, 'off', 60]]Passed
oracle 2[[1, 'on', 60], [2, 'off', 60]][[1, 'on', 60], [2, 'off', 60]]Passed
oracle 3[[0, 'on', 60], [1, 'off', 60]][[0, 'on', 60], [0, 'off', 60]]Failed
oracle 4[[1, 'on', 60]][[1, 'on', 60]]Passed
oracle 5[[2, 'on', 60]][[2, 'on', 60]]Passed
oracle 6[[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]][[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]Passed
oracle 7[[1, 'on', 61], [2, 'off', 61]][[1, 'on', 61], [2, 'off', 61]]Passed

SHA-256 / 3ee6e67d12fcd444e045c15d3b5014676fe0c00fb5e301dc81f5655115b1eeee

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) or len(x) != 3:
        return None
    events, src, dst = x
    if src <= 0 or dst <= 0:
        return None
    out = []
    open_on = {}
    for tick, kind, note in events:
        t = (2 * tick * dst + src) // (2 * src)
        if kind == 'on':
            open_on.setdefault(note, []).append((tick, t))
        elif open_on.get(note):
            otick, ot = open_on[note].pop(0)
            if tick > otick and t <= ot:
                t = ot + 1
        out.append([t, kind, note])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[1, 'on', 60]], 2, 1], [[1, 'on', 60]]), ([[[3, 'on', 60]], 2, 1], [[2, 'on', 60]]), ([[[0, 'on', 60], [2, 'on', 60], [3, 'off', 60], [9, 'off', 60]], 8, 2], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]])], [([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[3, 'on', 60]], 2, 1], [[2, 'on', 60]]), ([[[0, 'on', 60], [2, 'on', 60], [3, 'off', 60], [9, 'off', 60]], 8, 2], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [100, 'off', 60]], 96, 480], [[0, 'on', 60], [500, 'off', 60]]), ([[[7, 'on', 62], [250, 'off', 62]], 480, 96], [[1, 'on', 62], [50, 'off', 62]]), ([[[0, 'on', 60]], 0, 96], None), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, 'off', 60]])], [([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[7, 'on', 62], [250, 'off', 62]], 480, 96], [[1, 'on', 62], [50, 'off', 62]]), ([[[0, 'on', 60]], 0, 96], None), ([[[0, 'on', 60], [5, 'on', 60], [6, 'off', 60], [40, 'off', 60]], 10, 1], [[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [4, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[3, 'on', 64], [5, 'off', 64]], 6, 4], [[2, 'on', 64], [3, 'off', 64]])], [([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[3, 'on', 64], [5, 'off', 64]], 6, 4], [[2, 'on', 64], [3, 'off', 64]]), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, 'off', 60]])], [([[[0, 'on', 60], [480, 'off', 60]], 480, 96], [[0, 'on', 60], [96, 'off', 60]]), ([[[0, 'on', 60], [1, 'off', 60]], 480, 96], [[0, 'on', 60], [1, 'off', 60]]), ([[[1, 'on', 60], [3, 'off', 60]], 2, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[0, 'on', 60], [0, 'off', 60]], 480, 96], [[0, 'on', 60], [0, 'off', 60]]), ([[[5, 'on', 60], [7, 'off', 60]], 10, 1], [[1, 'on', 60], [2, 'off', 60]]), ([[[1, 'on', 60]], 2, 1], [[1, 'on', 60]]), ([[[12, 'on', 61], [13, 'off', 61]], 24, 1], [[1, 'on', 61], [2, 'off', 61]]), ([[[0, 'on', 60], [1, 'on', 60], [2, 'off', 60], [3, 'off', 60]], 10, 1], [[0, 'on', 60], [0, 'on', 60], [1, 'off', 60], [1, '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 fixtureActualExpectedOutcome
oracle 0[[0, 'on', 60], [96, 'off', 60]][[0, 'on', 60], [96, 'off', 60]]Passed
oracle 1[[0, 'on', 60], [1, 'off', 60]][[0, 'on', 60], [1, 'off', 60]]Passed
oracle 2[[1, 'on', 60], [2, 'off', 60]][[1, 'on', 60], [2, 'off', 60]]Passed
oracle 3[[0, 'on', 60], [0, 'off', 60]][[0, 'on', 60], [0, 'off', 60]]Passed
oracle 4[[1, 'on', 60]][[1, 'on', 60]]Passed
oracle 5[[2, 'on', 60]][[2, 'on', 60]]Passed
oracle 6[[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]][[0, 'on', 60], [1, 'on', 60], [1, 'off', 60], [2, 'off', 60]]Passed
oracle 7[[1, 'on', 61], [2, 'off', 61]][[1, 'on', 61], [2, 'off', 61]]Passed

SHA-256 / d4f67d23e2c548f39feba8175c2f5a605d8d5c4dea27d93fff79dcc51bdd9eb7

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.385412+00:00.

Case digest / b299d8e2ccd616a2b651b106eaa3203597d541dafd42cb13a4e7e4812bb765d1