FAILURE MAP
← Case archive

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

Melody transposition fitted into an instrument range: lowest fitting octave chosen instead of nearest · case 01

A melody that already fits a wide range is dropped several octaves to the lowest register that still fits.

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

ROOT CAUSE

The first candidate found by the ascending octave scan is used instead of the candidate with the smallest shift.

THE FAILURE

The first candidate found by the ascending octave scan is used instead of the candidate with the smallest shift.

Unsuccessful approach: Taking the maximum candidate picks the largest-magnitude or highest shift instead of the nearest octave.

Case contract

Input [notes, semitones, lo, hi]. Transpose every note by the semitone amount, then shift the whole melody by the octave offset k (|k| <= 10) of smallest magnitude that places every note within [lo, hi] inclusive. Return the notes, or None if the melody is empty, lo > hi, or no octave fits.

Why this case matters

Arranging tools transpose parts into playable instrument ranges.

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) != 4:
        return None
    notes, t, lo, hi = x
    if not notes or lo > hi:
        return None
    moved = [n + t for n in notes]
    low, high = min(moved), max(moved)
    if high - low > hi - lo:
        return None
    options = []
    for k in range(-10, 11):
        if lo <= low + 12 * k and high + 12 * k <= hi:
            options.append((abs(k), k))
    if not options:
        return None
    k = options[0][1]
    return [n + 12 * k for n in moved]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[60, 64, 67], 0, 55, 79], [60, 64, 67]), ([[60, 64, 67], 2, 55, 79], [62, 66, 69]), ([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 72], 0, 60, 72], [60, 72]), ([[60, 72], 0, 61, 73], None), ([[60, 64], 0, 54, 78], [60, 64]), ([[60, 62], 5, 40, 50], [41, 43]), ([[60], 6, 54, 67], [66])], [([[60, 64, 67], 0, 72, 96], [72, 76, 79]), ([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 62], 5, 40, 50], [41, 43]), ([[60, 79], 0, 60, 78], None), ([[70], 0, 52, 64], [58]), ([[70], 0, 58, 70], [70]), ([[48, 50], -2, 50, 70], [58, 60]), ([[], 0, 0, 127], None)], [([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[70], 0, 58, 70], [70]), ([[48, 50], -2, 50, 70], [58, 60]), ([[], 0, 0, 127], None), ([[60], 0, 70, 60], None), ([[60, 64, 67], -12, 55, 79], [60, 64, 67]), ([[60], 6, 54, 67], [66]), ([[62, 65], 0, 50, 62], [50, 53])], [([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 64], 0, 54, 78], [60, 64]), ([[60], 6, 54, 67], [66]), ([[62, 65], 0, 50, 62], [50, 53]), ([[60, 67], 0, 62, 73], None), ([[60, 63], 3, 48, 60], [51, 54]), ([[60], 0, 48, 48], [48]), ([[59, 61], 0, 47, 49], [47, 49])], [([[60, 64, 67], 0, 55, 79], [60, 64, 67]), ([[60, 64, 67], 0, 72, 96], [72, 76, 79]), ([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 64], 0, 54, 78], [60, 64]), ([[70], 0, 58, 70], [70]), ([[60, 64, 67], -12, 55, 79], [60, 64, 67]), ([[60], 0, 48, 48], [48]), ([[59, 61], 0, 47, 49], [47, 49])]]
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[60, 64, 67][60, 64, 67]Passed
oracle 1[62, 66, 69][62, 66, 69]Passed
oracle 2[36, 40, 43][48, 52, 55]Failed
oracle 3[60, 72][60, 72]Passed
oracle 4NoneNonePassed
oracle 5[60, 64][60, 64]Passed
oracle 6[41, 43][41, 43]Passed
oracle 7[54][66]Failed

SHA-256 / f2f8c7d377e08df79ed02e3f7a5566aa62f8acc2d98a68c307e1f04f69c93827

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) != 4:
        return None
    notes, t, lo, hi = x
    if not notes or lo > hi:
        return None
    moved = [n + t for n in notes]
    low, high = min(moved), max(moved)
    if high - low > hi - lo:
        return None
    options = []
    for k in range(-10, 11):
        if lo <= low + 12 * k and high + 12 * k <= hi:
            options.append((abs(k), k))
    if not options:
        return None
    k = max(options)[1]
    return [n + 12 * k for n in moved]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[60, 64, 67], 0, 55, 79], [60, 64, 67]), ([[60, 64, 67], 2, 55, 79], [62, 66, 69]), ([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 72], 0, 60, 72], [60, 72]), ([[60, 72], 0, 61, 73], None), ([[60, 64], 0, 54, 78], [60, 64]), ([[60, 62], 5, 40, 50], [41, 43]), ([[60], 6, 54, 67], [66])], [([[60, 64, 67], 0, 72, 96], [72, 76, 79]), ([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 62], 5, 40, 50], [41, 43]), ([[60, 79], 0, 60, 78], None), ([[70], 0, 52, 64], [58]), ([[70], 0, 58, 70], [70]), ([[48, 50], -2, 50, 70], [58, 60]), ([[], 0, 0, 127], None)], [([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[70], 0, 58, 70], [70]), ([[48, 50], -2, 50, 70], [58, 60]), ([[], 0, 0, 127], None), ([[60], 0, 70, 60], None), ([[60, 64, 67], -12, 55, 79], [60, 64, 67]), ([[60], 6, 54, 67], [66]), ([[62, 65], 0, 50, 62], [50, 53])], [([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 64], 0, 54, 78], [60, 64]), ([[60], 6, 54, 67], [66]), ([[62, 65], 0, 50, 62], [50, 53]), ([[60, 67], 0, 62, 73], None), ([[60, 63], 3, 48, 60], [51, 54]), ([[60], 0, 48, 48], [48]), ([[59, 61], 0, 47, 49], [47, 49])], [([[60, 64, 67], 0, 55, 79], [60, 64, 67]), ([[60, 64, 67], 0, 72, 96], [72, 76, 79]), ([[60, 64, 67], 0, 36, 60], [48, 52, 55]), ([[60, 64], 0, 54, 78], [60, 64]), ([[70], 0, 58, 70], [70]), ([[60, 64, 67], -12, 55, 79], [60, 64, 67]), ([[60], 0, 48, 48], [48]), ([[59, 61], 0, 47, 49], [47, 49])]]
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[72, 76, 79][60, 64, 67]Failed
oracle 1[62, 66, 69][62, 66, 69]Passed
oracle 2[36, 40, 43][48, 52, 55]Failed
oracle 3[60, 72][60, 72]Passed
oracle 4NoneNonePassed
oracle 5[72, 76][60, 64]Failed
oracle 6[41, 43][41, 43]Passed
oracle 7[54][66]Failed

SHA-256 / c8f99b0ceebbae1d369482a35027a6cd46f0645947a8772cee52fc846e74625d

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

Case digest / e32cb43da3b7349b936228fee2352d3d143fd301510c249c940f6303768d0db6