FA-81511 / MIDI event timing / Open access
SMPTE time-division ticks to microseconds: frame rate code not negated · case 01
Every SMPTE-timed file is rejected because the rate code decodes to a negative number.
ROOT CAUSE
The two's-complement rate byte is converted with the subtraction reversed.
THE FAILURE
The two's-complement rate byte is converted with the subtraction reversed.
Unsuccessful approach: Masking the sign bit yields 104, 103, 99 and 98 instead of the frame rates.
Case contract
Input [division_high_byte, ticks_per_frame, ticks]. The high byte is a negative frame-rate code in two's complement: 24, 25, 29 (meaning 30000/1001 frames per second) or 30. Microseconds = ticks * 1000000 / (rate * ticks_per_frame), floored once. Invalid codes, non-positive ticks per frame or negative ticks 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
from fractions import Fraction
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 3:
return None
hi, tpf, ticks = x
code = hi - 256
rates = {24: Fraction(24), 25: Fraction(25), 29: Fraction(30000, 1001), 30: Fraction(30)}
if code not in rates or tpf <= 0 or ticks < 0:
return None
return int(Fraction(ticks * 1000000) / (rates[code] * tpf))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([232, 40, 40], 41666), ([231, 40, 1000], 1000000), ([227, 80, 80], 33366), ([227, 80, 2400], 1001000), ([233, 40, 40], None), ([228, 40, 40], None), ([232, 0, 10], None), ([232, 40, -1], None)], [([232, 40, 40], 41666), ([231, 40, 1000], 1000000), ([227, 80, 80], 33366), ([227, 80, 2400], 1001000), ([227, 4, 107892], 899999100), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 40, -1], None)], [([227, 80, 80], 33366), ([227, 80, 2400], 1001000), ([227, 4, 107892], 899999100), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([227, 1, 29], 967633)], [([227, 80, 2400], 1001000), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([227, 1, 29], 967633), ([227, 80, 0], 0), ([226, 3, 1000001], 11111122222)], [([227, 4, 107892], 899999100), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([227, 1, 29], 967633), ([227, 80, 0], 0), ([226, 3, 1000001], 11111122222), ([227, 100, 300000], 100100000)]]
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 | None | 41666 | Failed |
| oracle 1 | None | 1000000 | Failed |
| oracle 2 | None | 33366 | Failed |
| oracle 3 | None | 1001000 | Failed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 7a2d061ef7142bdcbd0ee71d49eaa18b9a6dcf32410681e46e543e9e1060a4f0
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 3:
return None
hi, tpf, ticks = x
code = hi & 0x7F
rates = {24: Fraction(24), 25: Fraction(25), 29: Fraction(30000, 1001), 30: Fraction(30)}
if code not in rates or tpf <= 0 or ticks < 0:
return None
return int(Fraction(ticks * 1000000) / (rates[code] * tpf))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([232, 40, 40], 41666), ([231, 40, 1000], 1000000), ([227, 80, 80], 33366), ([227, 80, 2400], 1001000), ([233, 40, 40], None), ([228, 40, 40], None), ([232, 0, 10], None), ([232, 40, -1], None)], [([232, 40, 40], 41666), ([231, 40, 1000], 1000000), ([227, 80, 80], 33366), ([227, 80, 2400], 1001000), ([227, 4, 107892], 899999100), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 40, -1], None)], [([227, 80, 80], 33366), ([227, 80, 2400], 1001000), ([227, 4, 107892], 899999100), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([227, 1, 29], 967633)], [([227, 80, 2400], 1001000), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([227, 1, 29], 967633), ([227, 80, 0], 0), ([226, 3, 1000001], 11111122222)], [([227, 4, 107892], 899999100), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([227, 1, 29], 967633), ([227, 80, 0], 0), ([226, 3, 1000001], 11111122222), ([227, 100, 300000], 100100000)]]
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 | None | 41666 | Failed |
| oracle 1 | None | 1000000 | Failed |
| oracle 2 | None | 33366 | Failed |
| oracle 3 | None | 1001000 | Failed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / b83d5c5f228698ba33f03ec8ae7fd6e5a7f53c2291e4493e512d4b6f36a5f776
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.754624+00:00.
Case digest / 113cf5f680e1556c241453d5366ad1065a6919267a83c27c5b1ebfb9f02071d3