FAILURE MAP
← Case archive

FA-81586 / MIDI event timing / Open access

MIDI clock transport and song position: continue restarts from the top · case 01

Continue after a song position pointer or a stop jumps back to position 0, behaving like start.

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

ROOT CAUSE

The continue handler resets the position as start does.

VERIFIED REPAIR

Restore the continue semantics step so that it reads `elif kind == 'continue': running = True`.

Unsuccessful approach: Refusing to run when the position is 0 makes continue after a locate-to-zero silently stay stopped.

Case contract

Input a list of messages: ["start"], ["continue"], ["stop"], ["clock"] or ["spp", lsb, msb]. start resets the position to 0 and runs; continue runs from the current position; stop halts; clock advances the position by one clock only while running; a song position pointer (in sixteenth notes, 6 clocks each, 14-bit lsb/msb) is honoured only while stopped. Return [position in clocks, running, quarter notes = position // 24]; unknown messages 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):
        return None
    pos = 0
    running = False
    for msg in x:
        kind = msg[0]
        if kind == 'start':
            pos = 0
            running = True
        elif kind == 'continue':
            pos = 0
            running = True
        elif kind == 'stop':
            running = False
        elif kind == 'clock':
            if running:
                pos += 1
        elif kind == 'spp':
            if not running:
                pos = 6 * ((msg[2] << 7) | msg[1])
        else:
            return None
    return [pos, running, pos // 24]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([['start'], ['clock'], ['clock']], [2, True, 0]), ([['clock'], ['clock']], [0, False, 0]), ([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 32]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['start'], ['clock'], ['stop'], ['start'], ['clock']], [1, True, 0]), ([['spp', 16, 0], ['start']], [0, True, 0]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['reset']], None), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['spp', 0, 1], ['continue']], [768, True, 32]), ([['reset']], None), ([], [0, False, 0]), ([['start'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock']], [25, True, 1]), ([['spp', 127, 127]], [98298, False, 4095]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 127, 127]], [98298, False, 4095]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['start'], ['clock'], ['clock']], [2, True, 0]), ([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])]]
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[2, True, 0][2, True, 0]Passed
oracle 1[0, False, 0][0, False, 0]Passed
oracle 2[1, True, 0][2, True, 0]Failed
oracle 3[0, True, 0][768, True, 32]Failed
oracle 4[774, False, 32][774, False, 32]Passed
oracle 5[1, True, 0][1, True, 0]Passed
oracle 6[1, True, 0][1, True, 0]Passed
oracle 7[1, True, 0][1, True, 0]Passed

SHA-256 / b3451b85c44c0efa882dac0da63712be61cf54e5ba21990f8a5bb0e6a1e17e3f

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
    pos = 0
    running = False
    for msg in x:
        kind = msg[0]
        if kind == 'start':
            pos = 0
            running = True
        elif kind == 'continue':
            running = pos > 0
        elif kind == 'stop':
            running = False
        elif kind == 'clock':
            if running:
                pos += 1
        elif kind == 'spp':
            if not running:
                pos = 6 * ((msg[2] << 7) | msg[1])
        else:
            return None
    return [pos, running, pos // 24]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([['start'], ['clock'], ['clock']], [2, True, 0]), ([['clock'], ['clock']], [0, False, 0]), ([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 32]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['start'], ['clock'], ['stop'], ['start'], ['clock']], [1, True, 0]), ([['spp', 16, 0], ['start']], [0, True, 0]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['reset']], None), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['spp', 0, 1], ['continue']], [768, True, 32]), ([['reset']], None), ([], [0, False, 0]), ([['start'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock']], [25, True, 1]), ([['spp', 127, 127]], [98298, False, 4095]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 127, 127]], [98298, False, 4095]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['start'], ['clock'], ['clock']], [2, True, 0]), ([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])]]
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[2, True, 0][2, True, 0]Passed
oracle 1[0, False, 0][0, False, 0]Passed
oracle 2[2, True, 0][2, True, 0]Passed
oracle 3[768, True, 32][768, True, 32]Passed
oracle 4[774, False, 32][774, False, 32]Passed
oracle 5[1, True, 0][1, True, 0]Passed
oracle 6[0, False, 0][1, True, 0]Failed
oracle 7[0, False, 0][1, True, 0]Failed

SHA-256 / a208d042c661b58c7513a44d63abc6063e781a5755838d22525e09c4cb1788e7

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
    pos = 0
    running = False
    for msg in x:
        kind = msg[0]
        if kind == 'start':
            pos = 0
            running = True
        elif kind == 'continue':
            running = True
        elif kind == 'stop':
            running = False
        elif kind == 'clock':
            if running:
                pos += 1
        elif kind == 'spp':
            if not running:
                pos = 6 * ((msg[2] << 7) | msg[1])
        else:
            return None
    return [pos, running, pos // 24]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([['start'], ['clock'], ['clock']], [2, True, 0]), ([['clock'], ['clock']], [0, False, 0]), ([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 32]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['start'], ['clock'], ['stop'], ['start'], ['clock']], [1, True, 0]), ([['spp', 16, 0], ['start']], [0, True, 0]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['reset']], None), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['spp', 0, 1], ['continue']], [768, True, 32]), ([['reset']], None), ([], [0, False, 0]), ([['start'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock'], ['clock']], [25, True, 1]), ([['spp', 127, 127]], [98298, False, 4095]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 127, 127]], [98298, False, 4095]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])], [([['start'], ['clock'], ['clock']], [2, True, 0]), ([['start'], ['clock'], ['stop'], ['clock'], ['continue'], ['clock']], [2, True, 0]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, True, 0]), ([['continue'], ['clock']], [1, True, 0]), ([['start'], ['stop'], ['continue'], ['clock']], [1, True, 0])]]
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[2, True, 0][2, True, 0]Passed
oracle 1[0, False, 0][0, False, 0]Passed
oracle 2[2, True, 0][2, True, 0]Passed
oracle 3[768, True, 32][768, True, 32]Passed
oracle 4[774, False, 32][774, False, 32]Passed
oracle 5[1, True, 0][1, True, 0]Passed
oracle 6[1, True, 0][1, True, 0]Passed
oracle 7[1, True, 0][1, True, 0]Passed

SHA-256 / 11036a2a2c753785b41f3807c5f40c6e9070944f78dd4ac331003ba660e3b082

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

Case digest / 95f47b8b4827f95fc4e713a60e76963d3964ec7db0991a1236be4a7c725d532d