feat(amp): Bias X (push-pull balance) in the advanced pop-over
Phase 13. Add a shared power-amp Bias X control modelling push-pull tube balance. powerAmpStage(_:) runs two TriodeStage halves biased at powerAmpBiasInput ± (biasX·biasXMaxSpread) and averages them: at biasX = 0 both halves share the base bias, so the average is bit-identical to the prior single stage (default, no re-voicing); turning it up spreads the operating points, shifting the even/odd harmonic mix. Deliberately a character control on the single-ended power model, not a full push-pull topology rebuild — it reduces to the exact shipped tone at biasX = 0 (monotonic imbalance amount, default 0). Appended to advancedKnobs (Sag, Bias, Bias X) — append-only so Phase-11 presets (2 advancedValues) still load with Bias X defaulting. Tests: Bias X changes waveshape (RMS-normalized, not level), stays within ±1, is exposed in the pop-over, round-trips through state; neutral Sag/Bias/Bias X is bit-exact identity. 650 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,8 +17,10 @@ import LyrebirdUI
|
||||
/// → TriodeStage(drive: gain) (preamp)
|
||||
/// → ToneStack(bass, mid, treble, model) (fixed per amp)
|
||||
/// → onboardEffects(_:) (subclass hook — e.g. reverb + tremolo; default identity)
|
||||
/// → TriodeStage(power-amp drive) (power-amp warmth)
|
||||
/// → powerAmpStage(_:) (power amp — two TriodeStage halves blended by
|
||||
/// Bias X; single-stage tone at biasX = 0)
|
||||
/// → shapeVoice(_:) (subclass signature filter)
|
||||
/// → applySag(_:) (shared power-supply Sag droop; identity at sag = 0)
|
||||
/// → ConvolutionReverb(cab IR) (speaker cabinet — voice-selectable, or None for a
|
||||
/// separate cab block; rebuild on change)
|
||||
/// → TriodeStage(bias: 0) → Clip(±1) (output soft-limit + hard safety ceiling — always on)
|
||||
@@ -57,6 +59,11 @@ open class AmpVoicePedal: Pedal {
|
||||
/// hotter (warmer, more even harmonics). Surfaced in the advanced pop-over. See
|
||||
/// ``powerAmpBiasInput``.
|
||||
@UIParam public var bias: Double = 0.5
|
||||
/// Power-amp **Bias X** (push-pull balance) in `[0, 1]`, default `0` = balanced. `0` reproduces
|
||||
/// the shipped single-stage tone exactly; turning it up spreads the two power-amp half-stages'
|
||||
/// operating points, shifting the even/odd harmonic mix as an imbalanced push-pull pair would.
|
||||
/// Surfaced in the advanced pop-over. See ``powerAmpStage(_:)``.
|
||||
@UIParam public var biasX: Double = 0.0
|
||||
|
||||
// MARK: - Subclass configuration
|
||||
|
||||
@@ -169,6 +176,34 @@ open class AmpVoicePedal: Pedal {
|
||||
LinLin.Audio($bias, inLo: 0.0, inHi: 1.0, outLo: coldPowerAmpBias, outHi: hotPowerAmpBias)
|
||||
}
|
||||
|
||||
/// The power-amp stage, modelling push-pull tube **balance** via ``biasX``: two `TriodeStage`
|
||||
/// halves biased at `powerAmpBiasInput ± (biasX · biasXMaxSpread)`, averaged. At `biasX = 0` both
|
||||
/// halves share the base bias, so the average is bit-identical to a single stage (the shipped
|
||||
/// behaviour); turning `biasX` up spreads their operating points, shifting the even/odd harmonic
|
||||
/// mix the way an imbalanced push-pull pair would.
|
||||
///
|
||||
/// > Note: this is a character control layered on the single-ended power-stage model, not a full
|
||||
/// > push-pull topology rebuild — it deliberately reduces to the exact prior tone at `biasX = 0`.
|
||||
///
|
||||
/// - Parameter signal: The post-`onboardEffects` signal into the power amp.
|
||||
/// - Returns: The blended power-amp output.
|
||||
func powerAmpStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
let imbalance: any ValidGeneratorInput = $biasX * biasXMaxSpread
|
||||
let hotHalf: TriodeStage = TriodeStage(
|
||||
input: signal,
|
||||
drive: powerAmpDriveInput,
|
||||
bias: powerAmpBiasInput + imbalance,
|
||||
oversample: powerAmpOversample
|
||||
)
|
||||
let coldHalf: TriodeStage = TriodeStage(
|
||||
input: signal,
|
||||
drive: powerAmpDriveInput,
|
||||
bias: powerAmpBiasInput - imbalance,
|
||||
oversample: powerAmpOversample
|
||||
)
|
||||
return (hotHalf + coldHalf) * powerAmpHalfBlend
|
||||
}
|
||||
|
||||
/// Applies power-supply **Sag**: an `AmplitudeFollower` on `signal` reduces gain as it gets loud
|
||||
/// (droop) and recovers slowly (bloom). `Sag` scales the depth; at `sag = 0` the droop is `0` and
|
||||
/// the gain is a constant `1.0` (an identity multiply), so a sag-less amp is unchanged.
|
||||
@@ -208,6 +243,12 @@ open class AmpVoicePedal: Pedal {
|
||||
/// drastically re-voicing the amp.
|
||||
private let coldPowerAmpBias: Double = -0.25
|
||||
private let hotPowerAmpBias: Double = 0.25
|
||||
/// Maximum push-pull bias imbalance at `biasX = 1` — the offset applied oppositely to the two
|
||||
/// power-amp half-stages. Modest so the control colours the harmonics without destabilising the amp.
|
||||
private let biasXMaxSpread: Double = 0.35
|
||||
/// Equal-weight blend of the two power-amp half-stages. `0.5·(hot + cold)` averages them, so at
|
||||
/// `biasX = 0` (identical halves) the result is bit-identical to a single stage.
|
||||
private let powerAmpHalfBlend: Double = 0.5
|
||||
/// 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).
|
||||
@@ -296,12 +337,14 @@ open class AmpVoicePedal: Pedal {
|
||||
}
|
||||
|
||||
/// Power-amp deep-cut controls, tucked behind the pedal card's advanced pop-over: **Sag**
|
||||
/// (power-supply droop/bloom) and **Bias** (power-amp grid-bias operating point). Neither is a
|
||||
/// topology control — both are live nodes that round-trip through the rig save format.
|
||||
/// (power-supply droop/bloom), **Bias** (power-amp grid-bias operating point), and **Bias X**
|
||||
/// (push-pull balance). None is a topology control — all are live nodes that round-trip through
|
||||
/// the rig save format. Order is append-only (persisted positionally in `advancedValues`).
|
||||
public override var advancedKnobs: [PedalKnob] {
|
||||
[
|
||||
PedalKnob(label: "Sag", node: $sag, range: signatureRange),
|
||||
PedalKnob(label: "Bias", node: $bias, range: toneRange),
|
||||
PedalKnob(label: "Bias X", node: $biasX, range: signatureRange),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -336,8 +379,7 @@ open class AmpVoicePedal: Pedal {
|
||||
let toned: ToneStack = ToneStack(
|
||||
input: preamp, bass: $bass, mid: $mid, treble: $treble, model: toneStackModel)
|
||||
let processed: any ValidGeneratorInput = onboardEffects(toned)
|
||||
let powerAmp: TriodeStage = TriodeStage(
|
||||
input: processed, drive: powerAmpDriveInput, bias: powerAmpBiasInput, oversample: powerAmpOversample)
|
||||
let powerAmp: any ValidGeneratorInput = powerAmpStage(processed)
|
||||
return applySag(shapeVoice(powerAmp))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user