feat(amp): shared power-amp Sag + Bias in an advanced pop-over

Phase 11. Promote Sag from Modern High-Gain to a shared AmpVoicePedal
capability and add a Bias control, both surfaced in a new pedal-card
pop-over rather than on the amp face.

- AmpVoicePedal gains `sag` [0,1] (AmplitudeFollower gain-droop, clamped
  [0.15,1] to prevent phase inversion) and `bias` [0,1] mapped to the
  power-amp TriodeStage grid bias ([-0.25,0.25], neutral 0.5 → 0.0 so
  existing voices are unchanged at defaults). Both applied in
  preCabinetCore; new `applySag(_:)` + `powerAmpBiasInput` helpers.
- Modern High-Gain drops its bespoke sag (now inherited); keeps sag=0.3
  default. Sag moves off its face into the pop-over.
- Pedal gains an `advancedKnobs` surface; PedalView draws a gear button
  (top-right) presenting them in a popover, reusing the existing pattern.
- Advanced knobs round-trip through PedalState (new `advancedValues`,
  backward-compatible decode) and are MIDI-CC-mappable (appended last).

De-branding (review nits): "Vox" removed from the Chime family's
user-visible summaries + docs; "Fullerton Princeton" renamed to display
"Fullerton Ivy League". Palette horizontal picker second row now shows
Routing before the Amp Model group.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 21:08:23 -07:00
parent 6cf698dbac
commit 1de14fd879
18 changed files with 273 additions and 77 deletions
@@ -17,36 +17,21 @@ import LyrebirdUI
/// tube-rectified amp. **Tight** high-passes the input to tighten the low end for fast riffing.
public final class ModernHighGainAmpPedal: BoutiqueAmpPedal {
/// Sag amount in [0, 1]: `0` = stiff (no droop), `1` = heavy power-supply sag/bloom.
@UIParam public var sag: Double = 0.3
/// Tight switch: `0` = full low end, `1` = low-cut engaged (tight riffing).
@UIParam public var tight: Double = 0.0
/// Sag envelope-follower attack — moderately fast (the supply starts drooping under load).
private let sagAttackSeconds: Double = 0.02
/// Sag envelope-follower release — slow, so the sag lingers and blooms back (supply recovery).
private let sagReleaseSeconds: Double = 0.30
/// Tight low-cut: high-pass corner is ~20 Hz (loose, no cut) or `tightFreqHz` (tight).
private let tightLooseFreqHz: Double = 20.0
/// Tight-switch-on high-pass corner in Hz.
private let tightFreqHz: Double = 120.0
/// Tight high-pass Q (Butterworth).
private let tightQ: Double = 0.707
/// Lowest the sag gain can droop to (~-16 dB — the deepest droop before the tone reads as
/// obviously gated rather than sagging). Bounds sag depth and — crucially — keeps the gain
/// strictly positive: the envelope tracks a post-shelf signal that can exceed 1, so an unclamped
/// `1 − sag·env` would go negative and phase-invert loud content instead of drooping.
private let sagGainFloor: Double = 0.15
public override var toneStackModel: ToneStackModel { .mesa }
public override var summaryText: String {
"Modern high-gain rectifier — scooped Mesa lead with Sag (power-supply bloom) and a Tight switch."
}
public override var signatureKnobs: [PedalKnob] {
super.signatureKnobs + [PedalKnob(label: "Sag", node: $sag, range: signatureRange)]
}
public override var effectSwitches: [PedalSwitch] {
super.effectSwitches + [
PedalSwitch(
@@ -70,6 +55,7 @@ public final class ModernHighGainAmpPedal: BoutiqueAmpPedal {
gain = 7.0
drive = 18.0 // hottest lead of the lineup
cab = 1.0 // British 4×12 — tight, aggressive
sag = 0.3 // rectifier bloom on by default (shared power-amp Sag from AmpVoicePedal)
}
/// Tight switch: a pre-preamp high-pass whose corner switches between ~20 Hz (loose, negligible
@@ -79,18 +65,4 @@ public final class ModernHighGainAmpPedal: BoutiqueAmpPedal {
$tight, inLo: 0.0, inHi: 1.0, outLo: tightLooseFreqHz, outHi: tightFreqHz)
return RBJHighPass.Audio(input: signal, freq: cutoff, q: tightQ)
}
/// Base Presence/Depth shaping, then power-supply Sag: an envelope follower reduces gain as the
/// signal gets loud (droop) and recovers slowly (bloom). `Sag` scales the depth; `0` = stiff.
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let shaped: any ValidGeneratorInput = super.shapeVoice(signal)
let envelope: AmplitudeFollower.Audio = AmplitudeFollower.Audio(
in: shaped, attackTime: sagAttackSeconds, releaseTime: sagReleaseSeconds)
// Gain droops toward `sagGainFloor` as the envelope rises. The Presence/Depth shelves can
// push the envelope above 1, so clamp to `[sagGainFloor, 1]` — an unclamped `1 − sag·env`
// would go negative and phase-invert loud content instead of attenuating it.
let sagGain: any ValidGeneratorInput = Clip.Audio(
1.0 - ($sag * envelope), lo: sagGainFloor, hi: 1.0)
return shaped * sagGain
}
}