feat(amps): Modern High-Gain — rectifier w/ Sag + Tight (Phase 10)
New ModernHighGainAmpPedal: a BoutiqueAmpPedal on the .mesa stack (Clean/Lead + Master + Presence/Depth) voiced as a hot modern rectifier. Two new controls: - Sag — power-supply droop/bloom, built from AmplitudeFollower (envelope → gain droop, slow release) in shapeVoice. No dedicated Lyrebird block needed, so no 1.7.3 release: sag = signal × (1 − sag·envelope), envelope of the post-power-amp signal; louder → lower gain → recovers slowly. - Tight switch — a pre-preamp high-pass whose corner sweeps 20→120 Hz (firms the low end for fast riffing), live via inputShaping. Registered across 6 sites as .amp. 7 tests (sag/tight change output, inherited channel + rebuildsOnChange, ceiling at max with everything cranked, control surface, round-trip, registry). Completes the amp-expansion plan. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
// ModernHighGainAmpPedal.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
|
||||
/// Modern **high-gain rectifier** — the saturated, scooped metal voice: a hot cascaded lead on the
|
||||
/// Mesa tone stack, with a **Sag** control (power-supply droop/bloom) and a **Tight** switch that
|
||||
/// firms up the low end.
|
||||
///
|
||||
/// A ``BoutiqueAmpPedal`` (Clean/Lead channel, Master, Presence, Depth) voiced on the `.mesa` stack.
|
||||
/// **Sag** models the power supply drooping under load: an envelope follower on the power-amp signal
|
||||
/// reduces gain as it gets loud, then recovers slowly — the compression/"bloom" feel of a
|
||||
/// 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 sweeps from ~20 Hz (loose, no cut) to `tightFreqHz`.
|
||||
private let tightLooseFreqHz: Double = 20.0
|
||||
private let tightFreqHz: Double = 120.0
|
||||
private let tightQ: Double = 0.707
|
||||
|
||||
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(
|
||||
label: "Tight",
|
||||
node: $tight,
|
||||
options: [
|
||||
PedalSwitch.Option(title: "Off", value: switchOffValue),
|
||||
PedalSwitch.Option(title: "On", value: switchOnValue),
|
||||
]
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
/// Creates a Modern High-Gain amp.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - inputBus: Audio bus index to read the dry input from. Defaults to `0`.
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Modern High-Gain", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 7.0
|
||||
drive = 18.0 // hottest lead of the lineup
|
||||
cab = 1.0 // British 4×12 — tight, aggressive
|
||||
}
|
||||
|
||||
/// Tight switch: a pre-preamp high-pass whose corner sweeps from ~20 Hz (loose) to
|
||||
/// `tightFreqHz` (tight), firming the low end without a rebuild.
|
||||
public override func inputShaping(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
let cutoff: LinLin.Audio = LinLin.Audio(
|
||||
$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 (1 − sag) as the envelope rises; |signal| ≤ ~1 so gain stays in [0, 1].
|
||||
let sagGain: any ValidGeneratorInput = 1.0 - ($sag * envelope)
|
||||
return shaped * sagGain
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user