docs+test(amp): honest Bias X wording + combined-extreme ceiling test

Review follow-ups (no blockers were found):
- Rewrite Bias X docs: it's a power-amp bias-balance CHARACTER control that
  re-shapes the saturation knee, not a literal push-pull even-harmonic model
  (averaging two same-polarity bias-offset stages doesn't replicate push-pull
  imbalance). Document that both halves are always built (2x power-amp cost
  even at biasX=0 — chosen for a smooth live knob over a rebuild-on-change
  fast path). Fix a public->internal DocC symbol link (plain code font).
- Add extremeBiasAndBiasXStayWithinCeiling: Bias hot + Bias X max drives a
  half-stage bias to ±0.6 (tanh-bounded, outputLimit-clamped) — asserts
  finite, ≤ ±1.

651 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 08:26:56 -07:00
parent 594c501039
commit a2fcd59e1b
2 changed files with 30 additions and 13 deletions
@@ -263,6 +263,20 @@ struct AmpVoicePedalTests {
}
}
@Test func extremeBiasAndBiasXStayWithinCeiling() throws {
// Bias (hot) + Bias X (max) together drive a half-stage bias to ±0.6 (base ±0.25 ± spread
// 0.35). The tanh stays bounded and outputLimit clamps — output must stay finite and ≤ ±1.
let ceilingEpsilon: Double = 1.0e-4
for voice in voices {
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in
pedal.gain = 30.0; pedal.bass = 1.0; pedal.treble = 1.0; pedal.bias = 1.0; pedal.biasX = 1.0
}
#expect(hot.allSatisfy { $0.isFinite }, "\(voice.name) bias+biasX produced non-finite output")
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
#expect(peak <= 1.0 + ceilingEpsilon, "\(voice.name) bias+biasX peak \(peak) exceeds ±1")
}
}
@Test func advancedKnobsExposeSagBiasAndBiasX() throws {
for voice in voices {
let pedal: AmpVoicePedal = voice.make()