FAILURE MAP
← Case archive

FA-81551 / MIDI event timing / Open access

Strength-weighted grid quantisation: zero strength rejected · case 01

A strength of 0 (no-op quantise) is rejected instead of returning the input unchanged.

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

ROOT CAUSE

The strength range excludes its lower endpoint.

THE FAILURE

The strength range excludes its lower endpoint.

Unsuccessful approach: Excluding the upper endpoint instead rejects full-strength quantisation.

Case contract

Input [ticks, grid, strength] with grid > 0 and strength 0..100 percent. Each tick moves toward its nearest grid line (exact halves go to the later line) by strength percent of the distance, with the displacement truncated toward zero. Invalid parameters 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
    ticks, grid, strength = x
    if grid <= 0 or not 0 < strength <= 100:
        return None
    out = []
    for t in ticks:
        target = (2 * t + grid) // (2 * grid) * grid
        move = (target - t) * strength
        step = abs(move) // 100
        out.append(t + step if move >= 0 else t - step)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 10, 50, 110, 120], 120, 100], [0, 0, 0, 120, 120]), ([[10, 110], 120, 50], [5, 115]), ([[10, 110], 120, 75], [3, 117]), ([[7, 113], 120, 33], [5, 115]), ([[5, 115], 120, 0], [5, 115]), ([[5, 115], 120, 100], [0, 120]), ([[5], 120, 101], None), ([[5], 0, 50], None)], [([[60, 180], 120, 100], [120, 240]), ([[5, 115], 120, 0], [5, 115]), ([[5], 120, 101], None), ([[5], 0, 50], None), ([[5], 120, -1], None), ([[239, 241], 240, 50], [239, 241]), ([[1, 2, 3, 4], 3, 50], [1, 2, 3, 4]), ([[45, 75], 30, 100], [60, 90])], [([[0, 10, 50, 110, 120], 120, 100], [0, 0, 0, 120, 120]), ([[59, 61], 120, 100], [0, 120]), ([[5, 115], 120, 0], [5, 115]), ([[239, 241], 240, 50], [239, 241]), ([[1, 2, 3, 4], 3, 50], [1, 2, 3, 4]), ([[44, 76], 30, 90], [32, 88]), ([[1000, 1030], 120, 80], [968, 1070]), ([[125], 120, 99], [121])], [([[0, 10, 50, 110, 120], 120, 100], [0, 0, 0, 120, 120]), ([[60, 180], 120, 100], [120, 240]), ([[59, 61], 120, 100], [0, 120]), ([[5, 115], 120, 0], [5, 115]), ([[5, 115], 120, 100], [0, 120]), ([[45, 75], 30, 100], [60, 90]), ([[1000, 1030], 120, 80], [968, 1070]), ([[125], 120, 99], [121])], [([[60, 180], 120, 100], [120, 240]), ([[59, 61], 120, 100], [0, 120]), ([[10, 110], 120, 50], [5, 115]), ([[10, 110], 120, 75], [3, 117]), ([[7, 113], 120, 33], [5, 115]), ([[5, 115], 120, 0], [5, 115]), ([[5, 115], 120, 100], [0, 120]), ([[45, 75], 30, 100], [60, 90])]]
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, 0, 0, 120, 120][0, 0, 0, 120, 120]Passed
oracle 1[5, 115][5, 115]Passed
oracle 2[3, 117][3, 117]Passed
oracle 3[5, 115][5, 115]Passed
oracle 4None[5, 115]Failed
oracle 5[0, 120][0, 120]Passed
oracle 6NoneNonePassed
oracle 7NoneNonePassed

SHA-256 / 8766e90c1fbd790efa722195ac0fb9f3fca0ed8ecfa5026a5d709c0d6fdd3fad

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
    ticks, grid, strength = x
    if grid <= 0 or not 0 <= strength < 100:
        return None
    out = []
    for t in ticks:
        target = (2 * t + grid) // (2 * grid) * grid
        move = (target - t) * strength
        step = abs(move) // 100
        out.append(t + step if move >= 0 else t - step)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[0, 10, 50, 110, 120], 120, 100], [0, 0, 0, 120, 120]), ([[10, 110], 120, 50], [5, 115]), ([[10, 110], 120, 75], [3, 117]), ([[7, 113], 120, 33], [5, 115]), ([[5, 115], 120, 0], [5, 115]), ([[5, 115], 120, 100], [0, 120]), ([[5], 120, 101], None), ([[5], 0, 50], None)], [([[60, 180], 120, 100], [120, 240]), ([[5, 115], 120, 0], [5, 115]), ([[5], 120, 101], None), ([[5], 0, 50], None), ([[5], 120, -1], None), ([[239, 241], 240, 50], [239, 241]), ([[1, 2, 3, 4], 3, 50], [1, 2, 3, 4]), ([[45, 75], 30, 100], [60, 90])], [([[0, 10, 50, 110, 120], 120, 100], [0, 0, 0, 120, 120]), ([[59, 61], 120, 100], [0, 120]), ([[5, 115], 120, 0], [5, 115]), ([[239, 241], 240, 50], [239, 241]), ([[1, 2, 3, 4], 3, 50], [1, 2, 3, 4]), ([[44, 76], 30, 90], [32, 88]), ([[1000, 1030], 120, 80], [968, 1070]), ([[125], 120, 99], [121])], [([[0, 10, 50, 110, 120], 120, 100], [0, 0, 0, 120, 120]), ([[60, 180], 120, 100], [120, 240]), ([[59, 61], 120, 100], [0, 120]), ([[5, 115], 120, 0], [5, 115]), ([[5, 115], 120, 100], [0, 120]), ([[45, 75], 30, 100], [60, 90]), ([[1000, 1030], 120, 80], [968, 1070]), ([[125], 120, 99], [121])], [([[60, 180], 120, 100], [120, 240]), ([[59, 61], 120, 100], [0, 120]), ([[10, 110], 120, 50], [5, 115]), ([[10, 110], 120, 75], [3, 117]), ([[7, 113], 120, 33], [5, 115]), ([[5, 115], 120, 0], [5, 115]), ([[5, 115], 120, 100], [0, 120]), ([[45, 75], 30, 100], [60, 90])]]
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 0None[0, 0, 0, 120, 120]Failed
oracle 1[5, 115][5, 115]Passed
oracle 2[3, 117][3, 117]Passed
oracle 3[5, 115][5, 115]Passed
oracle 4[5, 115][5, 115]Passed
oracle 5None[0, 120]Failed
oracle 6NoneNonePassed
oracle 7NoneNonePassed

SHA-256 / e06749cb8436d9042f336b03ce8fab8152371c080a9dc2693264341914a8ff98

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

Case digest / 7283daed46da51814b5da64faf4927371fdd209d2ce2393e703054694a6e93a7