FA-81516 / MIDI event timing / Open access
SMPTE time-division ticks to microseconds: event times rounded to nearest microsecond · case 01
About half of all sub-frame tick positions are reported one microsecond later than the stipulated floored time.
ROOT CAUSE
The exact quotient is rounded to nearest instead of floored.
THE FAILURE
The exact quotient is rounded to nearest instead of floored.
Unsuccessful approach: Dropping the parentheses multiplies by ticks per frame instead of dividing by it.
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 = 256 - hi
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 round(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), ([227, 80, 2400], 1001000), ([232, 1, 1], 41666), ([227, 1, 29], 967633), ([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), ([232, 0, 10], None), ([232, 40, -1], None), ([227, 80, 0], 0)], [([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, 1, 1], 41666)], [([232, 40, 40], 41666), ([227, 80, 2400], 1001000), ([227, 4, 107892], 899999100), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([226, 3, 1000001], 11111122222)], [([232, 40, 40], 41666), ([227, 80, 80], 33366), ([227, 4, 107892], 899999100), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([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 | 41667 | 41666 | Failed |
| oracle 1 | 1001000 | 1001000 | Passed |
| oracle 2 | 41667 | 41666 | Failed |
| oracle 3 | 967633 | 967633 | Passed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 34169f55bea837f80cb8beb543990988e07a3a8f9083f3453f8644fd674e282b
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 = 256 - hi
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), ([227, 80, 2400], 1001000), ([232, 1, 1], 41666), ([227, 1, 29], 967633), ([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), ([232, 0, 10], None), ([232, 40, -1], None), ([227, 80, 0], 0)], [([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, 1, 1], 41666)], [([232, 40, 40], 41666), ([227, 80, 2400], 1001000), ([227, 4, 107892], 899999100), ([226, 100, 3000], 1000000), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([226, 3, 1000001], 11111122222)], [([232, 40, 40], 41666), ([227, 80, 80], 33366), ([227, 4, 107892], 899999100), ([226, 100, 7], 2333), ([232, 1, 1], 41666), ([231, 4, 3], 30000), ([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 | 66666666 | 41666 | Failed |
| oracle 1 | 6406400000 | 1001000 | Failed |
| oracle 2 | 41666 | 41666 | Passed |
| oracle 3 | 967633 | 967633 | Passed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / d1c4b6875dcd3e27f9fd1e190d82a47fffbf7e4ef41016936817d95290a183ae
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.782973+00:00.
Case digest / ca1df9163a957a216e63df9c3f568fd0f3a4403078c8893c405440047a71f672