FAILURE MAP
← Case archive

FA-81276 / Music interval and transposition theory / Open access

Diatonic step transposition within a major key: scale degree estimated from semitones · case 01

F and every degree above E are assigned the wrong degree, so G up one step becomes G again.

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

ROOT CAUSE

The degree is approximated as half the semitone distance, ignoring the E-F half step.

THE FAILURE

The degree is approximated as half the semitone distance, ignoring the E-F half step.

Unsuccessful approach: Scaling by 7/12 with floor division misassigns F, which lands on degree 2.

Case contract

Input [tonic, notes, steps] where tonic is a MIDI reference note. Each note must belong to the major scale on the tonic (else return None). Its scale position is its degree plus 7 per octave counted from the tonic note with floor division (notes below the tonic note are in negative octaves). Move by the signed number of steps and return the resulting MIDI notes.

Why this case matters

Harmonisers and sequence generators transpose melodies diatonically rather than chromatically.

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
    tonic, notes, steps = x
    scale = [0, 2, 4, 5, 7, 9, 11]
    out = []
    for n in notes:
        rel = (n - tonic) % 12
        if rel not in scale:
            return None
        octave = (n - tonic) // 12
        pos = octave * 7 + rel // 2 + steps
        out.append(tonic + 12 * (pos // 7) + scale[pos % 7])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([60, [60, 62, 64], 2], [64, 65, 67]), ([60, [60, 64, 67], 1], [62, 65, 69]), ([60, [60], -1], [59]), ([60, [59, 57], 2], [62, 60]), ([60, [48, 50], -3], [43, 45]), ([60, [61], 1], None), ([60, [60, 65], 3], [65, 71]), ([60, [40, 41], 10], [57, 59])], [([60, [71], 1], [72]), ([67, [67, 71, 74], 2], [71, 74, 78]), ([60, [61], 1], None), ([60, [60, 65], 3], [65, 71]), ([62, [62, 66], -7], [50, 54]), ([60, [72, 74], 7], [84, 86]), ([65, [53, 58], 4], [60, 65]), ([60, [], 3], [])], [([60, [60, 64, 67], 1], [62, 65, 69]), ([60, [71], 1], [72]), ([60, [59, 57], 2], [62, 60]), ([67, [66], 1], [67]), ([65, [53, 58], 4], [60, 65]), ([60, [], 3], []), ([60, [64], -9], [48]), ([60, [65, 71], 0], [65, 71])], [([60, [71], 1], [72]), ([60, [59, 57], 2], [62, 60]), ([67, [67, 71, 74], 2], [71, 74, 78]), ([67, [66], 1], [67]), ([67, [55, 54], -2], [52, 50]), ([60, [60, 65], 3], [65, 71]), ([60, [65, 71], 0], [65, 71]), ([60, [40, 41], 10], [57, 59])], [([67, [66], 1], [67]), ([67, [55, 54], -2], [52, 50]), ([60, [60, 65], 3], [65, 71]), ([65, [53, 58], 4], [60, 65]), ([60, [57], -2], [53]), ([69, [57, 56], 1], [59, 57]), ([60, [65, 71], 0], [65, 71]), ([60, [40, 41], 10], [57, 59])]]
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[64, 65, 67][64, 65, 67]Passed
oracle 1[62, 65, 67][62, 65, 69]Failed
oracle 2[59][59]Passed
oracle 3[60, 59][62, 60]Failed
oracle 4[43, 45][43, 45]Passed
oracle 5NoneNonePassed
oracle 6[65, 69][65, 71]Failed
oracle 7[57, 57][57, 59]Failed

SHA-256 / 9906ecb172acb84531f1be57cf36f16ba54eadf5a491d254f0f926e10569e84b

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
    tonic, notes, steps = x
    scale = [0, 2, 4, 5, 7, 9, 11]
    out = []
    for n in notes:
        rel = (n - tonic) % 12
        if rel not in scale:
            return None
        octave = (n - tonic) // 12
        pos = octave * 7 + rel * 7 // 12 + steps
        out.append(tonic + 12 * (pos // 7) + scale[pos % 7])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([60, [60, 62, 64], 2], [64, 65, 67]), ([60, [60, 64, 67], 1], [62, 65, 69]), ([60, [60], -1], [59]), ([60, [59, 57], 2], [62, 60]), ([60, [48, 50], -3], [43, 45]), ([60, [61], 1], None), ([60, [60, 65], 3], [65, 71]), ([60, [40, 41], 10], [57, 59])], [([60, [71], 1], [72]), ([67, [67, 71, 74], 2], [71, 74, 78]), ([60, [61], 1], None), ([60, [60, 65], 3], [65, 71]), ([62, [62, 66], -7], [50, 54]), ([60, [72, 74], 7], [84, 86]), ([65, [53, 58], 4], [60, 65]), ([60, [], 3], [])], [([60, [60, 64, 67], 1], [62, 65, 69]), ([60, [71], 1], [72]), ([60, [59, 57], 2], [62, 60]), ([67, [66], 1], [67]), ([65, [53, 58], 4], [60, 65]), ([60, [], 3], []), ([60, [64], -9], [48]), ([60, [65, 71], 0], [65, 71])], [([60, [71], 1], [72]), ([60, [59, 57], 2], [62, 60]), ([67, [67, 71, 74], 2], [71, 74, 78]), ([67, [66], 1], [67]), ([67, [55, 54], -2], [52, 50]), ([60, [60, 65], 3], [65, 71]), ([60, [65, 71], 0], [65, 71]), ([60, [40, 41], 10], [57, 59])], [([67, [66], 1], [67]), ([67, [55, 54], -2], [52, 50]), ([60, [60, 65], 3], [65, 71]), ([65, [53, 58], 4], [60, 65]), ([60, [57], -2], [53]), ([69, [57, 56], 1], [59, 57]), ([60, [65, 71], 0], [65, 71]), ([60, [40, 41], 10], [57, 59])]]
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[64, 65, 67][64, 65, 67]Passed
oracle 1[62, 65, 69][62, 65, 69]Passed
oracle 2[59][59]Passed
oracle 3[62, 60][62, 60]Passed
oracle 4[43, 45][43, 45]Passed
oracle 5NoneNonePassed
oracle 6[65, 69][65, 71]Failed
oracle 7[57, 57][57, 59]Failed

SHA-256 / 4938fad4b4f12d3f7a139e83a36299030be781f4e543e7c5f6d1c6fa25aa03ee

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 music notation or theory engine. 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:01.478347+00:00.

Case digest / a9eb6bad7bca19faeb0c6545f7d43f66df934278f5b78da06a09734e97c15292