FAILURE MAP
← Case archive

FA-10901 / Audio channel mixing / Open access

Mix gains per source · case 01

The sum of source gains is applied to the sum of signals, introducing cross terms.

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

ROOT CAUSE

The sum of source gains is applied to the sum of signals, introducing cross terms.

VERIFIED REPAIR

Apply the explicit PCM/playback contract: Mix equal-length source arrays with one corresponding scalar gain per source; output is unsaturated.

Unsuccessful approach: A common first-source gain ignores independently configured source levels.

Case contract

Mix equal-length source arrays with one corresponding scalar gain per source; output is unsaturated.

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(sources, gains):
    return [sum(frame)*sum(gains) for frame in zip(*sources)] if sources else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([[1, 0], [0, 1]], [0.25, 0.75])),[0.25, 0.75])
check('fixture 2',solve(*([[1], [1]], [0.5, 0.5])),[1])
check('fixture 3',solve(*([], [])),[])
check('fixture 4',solve(*([[2]], [0])),[0])
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
fixture 1[1.0, 1.0][0.25, 0.75]Failed
fixture 2[2.0][1]Failed
fixture 3[][]Passed
fixture 4[0][0]Passed

SHA-256 / dc4483ea00679fe3d0c07a39b8cf044d2b9dbd9442cf91161de3dc1b90457ff4

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(sources, gains):
    return [sum(frame)*gains[0] for frame in zip(*sources)] if sources else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([[1, 0], [0, 1]], [0.25, 0.75])),[0.25, 0.75])
check('fixture 2',solve(*([[1], [1]], [0.5, 0.5])),[1])
check('fixture 3',solve(*([], [])),[])
check('fixture 4',solve(*([[2]], [0])),[0])
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
fixture 1[0.25, 0.25][0.25, 0.75]Failed
fixture 2[1.0][1]Passed
fixture 3[][]Passed
fixture 4[0][0]Passed

SHA-256 / 32e30a2d8532020f1e77f7297fdb9df0fe4ff8aa08def11e051d9f56ac2b8ae6

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(sources, gains):
    return [sum(x*g for x,g in zip(frame,gains)) for frame in zip(*sources)] if sources else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([[1, 0], [0, 1]], [0.25, 0.75])),[0.25, 0.75])
check('fixture 2',solve(*([[1], [1]], [0.5, 0.5])),[1])
check('fixture 3',solve(*([], [])),[])
check('fixture 4',solve(*([[2]], [0])),[0])
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
fixture 1[0.25, 0.75][0.25, 0.75]Passed
fixture 2[1.0][1]Passed
fixture 3[][]Passed
fixture 4[0][0]Passed

SHA-256 / c0c8b6f9407415f2757bf3efc0c7fc746054f5fe2c687da23bab47f06fb17a87

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

Case digest / bbce047306d6949e8121395d0ceb2c91b3332d7b2248c0e59b13208efc25ce75