FAILURE MAP
← Case archive

FA-81581 / MIDI event timing / Open access

MIDI clock transport and song position: song position taken as clocks · case 01

Locating to sixteenth 4 sets the clock position to 4 instead of 24.

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

ROOT CAUSE

The pointer value in sixteenth notes is used directly as a clock count.

THE FAILURE

The pointer value in sixteenth notes is used directly as a clock count.

Unsuccessful approach: Multiplying by 24 treats the pointer as quarter notes.

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':
            running = True
        elif kind == 'stop':
            running = False
        elif kind == 'clock':
            if running:
                pos += 1
        elif kind == 'spp':
            if not running:
                pos = ((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', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 1, 1]], [774, False, 32]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['start'], ['clock'], ['stop'], ['start'], ['clock']], [1, True, 0]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0])], [([['spp', 0, 1], ['continue']], [768, True, 32]), ([['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), ([], [0, False, 0]), ([['spp', 127, 127]], [98298, False, 4095])], [([['spp', 1, 1]], [774, False, 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])], [([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 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])], [([['start'], ['clock'], ['clock']], [2, True, 0]), ([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 127, 127]], [98298, False, 4095]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, 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[5, True, 0][25, True, 1]Failed
oracle 4[129, False, 5][774, False, 32]Failed
oracle 5[1, True, 0][1, True, 0]Passed
oracle 6[1, True, 0][1, True, 0]Passed
oracle 7[5, True, 0][20, True, 0]Failed

SHA-256 / 4c990213e7fb6f68f9e274bd8615495613dd4ed4514170af4d5542dc766c1f59

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 = True
        elif kind == 'stop':
            running = False
        elif kind == 'clock':
            if running:
                pos += 1
        elif kind == 'spp':
            if not running:
                pos = 24 * ((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', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 1, 1]], [774, False, 32]), ([['start'], ['spp', 8, 0], ['clock']], [1, True, 0]), ([['start'], ['clock'], ['stop'], ['start'], ['clock']], [1, True, 0]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0])], [([['spp', 0, 1], ['continue']], [768, True, 32]), ([['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), ([], [0, False, 0]), ([['spp', 127, 127]], [98298, False, 4095])], [([['spp', 1, 1]], [774, False, 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])], [([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 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])], [([['start'], ['clock'], ['clock']], [2, True, 0]), ([['spp', 4, 0], ['continue'], ['clock']], [25, True, 1]), ([['spp', 0, 1], ['continue']], [768, True, 32]), ([['spp', 1, 1]], [774, False, 32]), ([['stop'], ['spp', 3, 0], ['continue'], ['clock'], ['clock']], [20, True, 0]), ([['spp', 127, 127]], [98298, False, 4095]), ([['spp', 4, 0], ['continue'], ['stop'], ['continue'], ['clock']], [25, True, 1]), ([['start'], ['clock'], ['clock'], ['stop'], ['spp', 2, 0], ['continue'], ['clock']], [13, 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[97, True, 4][25, True, 1]Failed
oracle 4[3096, False, 129][774, False, 32]Failed
oracle 5[1, True, 0][1, True, 0]Passed
oracle 6[1, True, 0][1, True, 0]Passed
oracle 7[74, True, 3][20, True, 0]Failed

SHA-256 / 8a64968b9e20af6252dd8c35bd6a24bced459cc787ed5fa1f3fe8c910baf0dc7

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

Case digest / 61e2a08035482fbb0595b8494098d57a7e06ad6cb324fbffcd54701bb5595902