FA-10846 / Audio frame buffers / Open access
Reverse audio by frames · case 01
Reversing scalar samples also reverses channel order inside each frame.
ROOT CAUSE
Reversing scalar samples also reverses channel order inside each frame.
VERIFIED REPAIR
Apply the explicit PCM/playback contract: Reverse complete frame order while preserving channel order within each frame; input length is divisible by positive channels.
Unsuccessful approach: Reversing only each frame swaps channels without reversing playback time.
Case contract
Reverse complete frame order while preserving channel order within each frame; input length is divisible by positive channels.
Why this case matters
A pure Python local audio pipeline stage with explicit sample formats and frame conventions; no real-time device or signal-spectrum claims.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(samples, channels):
return list(reversed(samples))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([1, 2, 3, 4, 5, 6], 2)),[5, 6, 3, 4, 1, 2])
check('fixture 2',solve(*([1, 2], 2)),[1, 2])
check('fixture 3',solve(*([], 2)),[])
check('fixture 4',solve(*([1, 2, 3], 1)),[3, 2, 1])
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 |
|---|---|---|---|
| fixture 1 | [6, 5, 4, 3, 2, 1] | [5, 6, 3, 4, 1, 2] | Failed |
| fixture 2 | [2, 1] | [1, 2] | Failed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [3, 2, 1] | [3, 2, 1] | Passed |
SHA-256 / ea09c05400af466a3abc1765abff8f23f2df5a054f9c916df52ed55890654425
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(samples, channels):
return [x for i in range(0,len(samples),channels) for x in reversed(samples[i:i+channels])]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([1, 2, 3, 4, 5, 6], 2)),[5, 6, 3, 4, 1, 2])
check('fixture 2',solve(*([1, 2], 2)),[1, 2])
check('fixture 3',solve(*([], 2)),[])
check('fixture 4',solve(*([1, 2, 3], 1)),[3, 2, 1])
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 |
|---|---|---|---|
| fixture 1 | [2, 1, 4, 3, 6, 5] | [5, 6, 3, 4, 1, 2] | Failed |
| fixture 2 | [2, 1] | [1, 2] | Failed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [1, 2, 3] | [3, 2, 1] | Failed |
SHA-256 / a785fb51f0391d99d02f8030f494548c468de038ab04fcebca801a5068cd5454
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(samples, channels):
return [x for i in range(len(samples)-channels,-1,-channels) for x in samples[i:i+channels]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([1, 2, 3, 4, 5, 6], 2)),[5, 6, 3, 4, 1, 2])
check('fixture 2',solve(*([1, 2], 2)),[1, 2])
check('fixture 3',solve(*([], 2)),[])
check('fixture 4',solve(*([1, 2, 3], 1)),[3, 2, 1])
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 |
|---|---|---|---|
| fixture 1 | [5, 6, 3, 4, 1, 2] | [5, 6, 3, 4, 1, 2] | Passed |
| fixture 2 | [1, 2] | [1, 2] | Passed |
| fixture 3 | [] | [] | Passed |
| fixture 4 | [3, 2, 1] | [3, 2, 1] | Passed |
SHA-256 / 89667a85e6713b3b0d5bc2fe34eff8c4860109ee802c1e79169e988898a80f5b
Verification & scope
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:38:42.737810+00:00.
Case digest / 4caf183c7e10fb7e33b9d491ccb9b11af882ccc1ae98550f39e931e3820b855b