Files
ShoeGaze/Sources/LyrebirdShoeGaze/Pedals/BritishComboAmpPedal.swift
T
josh 4de8379cb8 feat(amps): Marshall non-master voices — Plexi / JTM / Bluesbreaker (Phase 2)
Add a shared non-master British base and three voices. BritishComboAmpPedal
(open) provides the common surface: .marshall tone stack, Presence lift
(post-power-amp shelf), Bright switch (pre-preamp shelf), fixed power-amp drive
(loudness from Gain, no Master — distinct from the master-volume BritishAmpPedal).

- British Plexi — non-master Super Lead, higher gain, 4×12.
- British JTM — warmer, lower-gain JTM crunch, darker top.
- British Bluesbreaker — 2×12 combo crunch + onboard tremolo (Speed/Intensity +
  Tremolo footswitch), widthUnits 3.

Registered across all 6 sites as .amp; Help tone-stack acknowledgment genericized
so it no longer needs editing per amp. 12 tests (Presence/Bright per voice,
non-master check, Plexi/JTM surface, voices differ, Bluesbreaker tremolo +
footswitch bit-exact bypass, ceiling, round-trip, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 12:10:06 -07:00

67 lines
2.8 KiB
Swift

// BritishComboAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Shared base for the **non-master** British voices (Plexi / JTM / Bluesbreaker) — the earlier
/// Marshalls with no master volume, so the power-amp stage runs at a fixed drive and loudness comes
/// from cranking `Gain`.
///
/// Provides the common British control surface: the `.marshall` tone stack, a **Presence** lift
/// (post-power-amp high-shelf) and a **Bright** switch (pre-preamp high-shelf). Concrete voices
/// subclass this and differ by gain/cab/headroom; the Bluesbreaker additionally overlays tremolo.
///
/// Distinct from ``BritishAmpPedal``, which is the master-volume (JCM-style) crunch voice.
open class BritishComboAmpPedal: AmpVoicePedal {
/// Presence amount in [0, 1] → 0…`presenceMaxGainDb` of lift above `presenceFreqHz`.
@UIParam public var presence: Double = 0.4
/// Bright switch: `0` = flat, `1` = treble shelf engaged.
@UIParam public var bright: Double = 0.0
private let presenceFreqHz: Double = 4500.0
private let presenceMaxGainDb: Double = 8.0
private let presenceSlope: Double = 0.7
private let brightFreqHz: Double = 3500.0
private let brightMaxGainDb: Double = 6.0
private let brightSlope: Double = 0.7
let switchOffValue: Double = 0.0
let switchOnValue: Double = 1.0
public override var toneStackModel: ToneStackModel { .marshall }
public override var signatureKnobs: [PedalKnob] {
[PedalKnob(label: "Presence", node: $presence, range: signatureRange)]
}
public override var effectSwitches: [PedalSwitch] {
[
PedalSwitch(
label: "Bright",
node: $bright,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
]
}
/// Bright switch: a high-shelf lift ahead of the preamp (identity when off, live, no rebuild).
public override func inputShaping(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let shelfGainDb: any ValidGeneratorInput = $bright * brightMaxGainDb
return RBJHighShelf.Audio(
input: signal, freq: brightFreqHz, gain: shelfGainDb, slope: brightSlope)
}
/// Presence: a post-power-amp high-shelf lift, `[0, 1]` → `[0, presenceMaxGainDb]` dB.
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let gainDB: LinLin.Audio = LinLin.Audio(
$presence, inLo: 0.0, inHi: 1.0, outLo: 0.0, outHi: presenceMaxGainDb)
return RBJHighShelf.Audio(input: signal, freq: presenceFreqHz, gain: gainDB, slope: presenceSlope)
}
}