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>
This commit is contained in:
2026-08-03 12:10:06 -07:00
parent 690030a4c5
commit 4de8379cb8
11 changed files with 388 additions and 3 deletions
+3
View File
@@ -46,6 +46,9 @@ public extension PedalType {
// Drive & dynamics
static let california = PedalType("California")
static let british = PedalType("British")
static let britishPlexi = PedalType("British Plexi")
static let britishJTM = PedalType("British JTM")
static let britishBluesbreaker = PedalType("British Bluesbreaker")
static let chime = PedalType("Chime")
static let fullertonReverb = PedalType("Fullerton Reverb")
static let fullertonDeluxe = PedalType("Fullerton Deluxe")
@@ -0,0 +1,87 @@
// BritishBluesbreakerAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// British non-master **2×12 combo** with onboard **tremolo** — the bluesbreaker voice: lower-power
/// Marshall crunch that cleans up with the guitar volume, plus a bias-tremolo.
///
/// A ``BritishComboAmpPedal`` (Presence + Bright) that overlays a tremolo in the onboard-effects
/// slot, with Speed / Intensity knobs and a Tremolo footswitch.
public final class BritishBluesbreakerAmpPedal: BritishComboAmpPedal {
/// Tremolo LFO rate in Hz. Range [0.5, 12].
@UIParam public var speed: Double = 4.0
/// Tremolo depth in [0, 1]. `0` = off, `1` = full swing.
@UIParam public var intensity: Double = 0.0
/// Tremolo footswitch: `1` = engaged, `0` = bypassed (`Speed`/`Intensity` preserved).
@UIParam public var tremoloEnabled: Double = 1.0
/// Tremolo depth scaling — at full `intensity` the LFO swings over half the normalised range so
/// the peak gain is 1.0 and the trough is `1 − intensity`.
private let tremoloDepthScale: Double = 0.5
private let speedRange: ClosedRange<Double> = 0.5 ... 12.0
private let intensityRange: ClosedRange<Double> = 0.0 ... 1.0
public override var summaryText: String {
"British 2×12 combo — bluesbreaker crunch with tremolo, Presence, and a Bright switch."
}
public override var signatureKnobs: [PedalKnob] {
[
PedalKnob(label: "Presence", node: $presence, range: signatureRange),
PedalKnob(label: "Speed", node: $speed, range: speedRange),
PedalKnob(label: "Intensity", node: $intensity, range: intensityRange),
]
}
/// Wider card for the extra tremolo knobs plus the Bright and Tremolo switches.
public override var widthUnits: Int { 3 }
public override var effectSwitches: [PedalSwitch] {
[
PedalSwitch(
label: "Bright",
node: $bright,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
PedalSwitch(
label: "Tremolo",
node: $tremoloEnabled,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
]
}
/// Creates a British Bluesbreaker 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: "British Bluesbreaker", inputBus: inputBus, outputBus: outputBus)
gain = 6.0
cab = 1.0 // British 4×12 voice (combo 2×12 tonally close enough among our cabs)
}
/// Tremolo (gated by the Tremolo footswitch), inserted after the tone stack.
public override func onboardEffects(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
// Footswitch gates depth to 0 → LFO is a constant 1.0 (identity). Unipolar sine over
// [1 − depth, 1]: peak gain 1.0, trough 1 − depth.
let depth: any ValidGeneratorInput = $intensity * $tremoloEnabled
let lfoScale: any ValidGeneratorInput = depth * tremoloDepthScale
let lfoOffset: any ValidGeneratorInput = 1.0 - (depth * tremoloDepthScale)
let lfo: OscSin.Audio = OscSin.Audio(freq: $speed, mul: lfoScale, add: lfoOffset)
return signal * lfo
}
}
@@ -0,0 +1,66 @@
// 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)
}
}
@@ -0,0 +1,31 @@
// BritishJTMAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// British non-master **JTM** — the earliest Marshall, Bassman-derived: warmer and lower-gain than
/// the plexi Super Lead, a rounder blues-rock crunch.
///
/// A ``BritishComboAmpPedal`` with lower gain and a slightly darker top end.
public final class BritishJTMAmpPedal: BritishComboAmpPedal {
public override var summaryText: String {
"British non-master combo — warm, lower-gain JTM crunch with Presence and Bright."
}
/// Creates a British JTM 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: "British JTM", inputBus: inputBus, outputBus: outputBus)
gain = 5.0 // warmer, lower-gain than the plexi
treble = 0.5 // a shade rounder on top
cab = 1.0 // British 4×12
}
}
@@ -0,0 +1,31 @@
// BritishPlexiAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// British non-master **Super Lead** — the classic plexi-panel stack: big, loud, no master volume,
/// clean-ish until cranked and then a singing midrange roar.
///
/// A ``BritishComboAmpPedal`` with higher gain and the 4×12 cab. Presence + Bright; loudness and
/// breakup both come from `Gain`.
public final class BritishPlexiAmpPedal: BritishComboAmpPedal {
public override var summaryText: String {
"British non-master stack — plexi roar with Presence and a Bright switch."
}
/// Creates a British Plexi 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: "British Plexi", inputBus: inputBus, outputBus: outputBus)
gain = 7.0 // clean-ish until pushed
cab = 1.0 // British 4×12
}
}
@@ -33,6 +33,9 @@ public enum PedalRegistry {
public static let builtIn: [String: @MainActor () -> Pedal] = [
"California": { CaliforniaAmpPedal() },
"British": { BritishAmpPedal() },
"British Plexi": { BritishPlexiAmpPedal() },
"British JTM": { BritishJTMAmpPedal() },
"British Bluesbreaker": { BritishBluesbreakerAmpPedal() },
"Chime": { ChimeAmpPedal() },
"Fullerton Reverb": { FullertonReverbAmpPedal() },
"Fullerton Deluxe": { FullertonDeluxeAmpPedal() },
+1 -1
View File
@@ -178,7 +178,7 @@ public struct HelpView: View {
+ "built-in speaker impulse responses.",
"The Cabinet pedal's built-in cab voicings are original impulse responses generated in "
+ "code — not captures of any third-party hardware or IR pack.",
"The California, British, Chime, Fullerton Reverb, Fullerton Deluxe, Fullerton Princeton, Jazz Clean, and Chime Top Boost amp pedals' tone stacks "
"The amp pedals' tone stacks "
+ "follow the Yeh & Smith analysis of the classic passive tone-stack circuit (\"Discretization "
+ "of the '59 Fender Bassman Tone Stack\", DAFx-06); their models are original code, not "
+ "captures of specific hardware.",
@@ -44,7 +44,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
}
private static let mapping: [String: PedalCategory] = [
"California": .amp, "British": .amp, "Chime": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "Chime": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
"Overdrive": .gain, "Distortion": .gain, "Fuzz": .gain, "Volume": .gain,
"Compressor": .dynamics, "Sustainer": .dynamics, "Limiter": .dynamics, "Noise Gate": .dynamics,
"Graphic EQ": .filter, "Auto-Wah": .filter, "Wah": .filter, "Mutant": .filter,
@@ -54,7 +54,7 @@ public struct PedalPaletteView: View {
/// Preferred display order for the built-in pedals. Any registered pedal not listed here is
/// appended afterwards (sorted) so the palette never silently drops a newly added pedal.
private static let preferredOrder: [String] = [
"California", "British", "Chime", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Jazz Clean", "Chime Top Boost", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "Chime", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Jazz Clean", "Chime Top Boost", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"Volume",
"Graphic EQ", "Tremolo", "Phaser", "Modulation", "Chorus", "Flanger", "Vibrato", "Rotary",
"Auto-Wah", "Wah", "Mutant", "Cabinet", "Ring Modulator", "Diffuser", "Bitcrusher", "Granulator",
@@ -19,6 +19,9 @@ private func enclosureColor(for displayName: String) -> Color {
switch displayName {
case "California": return Color(red: 0.20, green: 0.28, blue: 0.34) // West-Coast steel blue
case "British": return Color(red: 0.30, green: 0.16, blue: 0.10) // oxblood tolex
case "British Plexi": return Color(red: 0.34, green: 0.20, blue: 0.10) // gold-panel plexi
case "British JTM": return Color(red: 0.36, green: 0.24, blue: 0.12) // warm JTM bronze
case "British Bluesbreaker": return Color(red: 0.28, green: 0.22, blue: 0.12) // bluesbreaker tan
case "Chime": return Color(red: 0.16, green: 0.24, blue: 0.22) // vintage green
case "Fullerton Reverb": return Color(red: 0.15, green: 0.22, blue: 0.30) // blackface panel
case "Fullerton Deluxe": return Color(red: 0.17, green: 0.20, blue: 0.26) // blackface, warmer
@@ -0,0 +1,161 @@
// BritishComboAmpPedalTests.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import Testing
import Foundation
import LyrebirdSynth
import LyrebirdUI
@testable import LyrebirdShoeGaze
@MainActor
@Suite("British non-master combos")
struct BritishComboAmpPedalTests {
private let sampleRate: Double = 48000.0
private func render<P: AmpVoicePedal>(_ make: () -> P, configure: (P) -> Void = { _ in }) throws -> [Float] {
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(
duration: 0.3, sampleRate: sampleRate, numAudioBuses: 64)
defer { try? FileManager.default.removeItem(at: url) }
let srcBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
let dstBus: AudioBus = try engine.busAllocator.allocateAudioBus(channelCount: 1)
defer {
engine.busAllocator.releaseAudioBus(srcBus)
engine.busAllocator.releaseAudioBus(dstBus)
}
let source: TestLoopSource = TestLoopSource(targetBus: srcBus.index)
let pedal: P = make()
pedal.inputBus = srcBus.index
pedal.outputBus = dstBus.index
pedal.sampleRate = sampleRate
configure(pedal)
let master: TestRouteMaster = TestRouteMaster(inputBusIndex: dstBus.index)
try engine.add(source)
try engine.add(pedal, position: NodePosition.after(source))
try engine.add(master, position: NodePosition.after(pedal))
try engine.start()
return readStereoCAF(url: url, sampleRate: sampleRate)
}
private func windowedSSD(_ a: [Float], _ b: [Float], skip: Int = 4096, window: Int = 4096) -> Double {
guard a.count >= skip + window, b.count >= skip + window else { return 0.0 }
return zip(a[skip..<(skip + window)], b[skip..<(skip + window)]).reduce(0.0) { acc, pair in
let d: Double = Double(pair.0 - pair.1); return acc + d * d
}
}
private let voices: [(name: String, make: () -> BritishComboAmpPedal)] = [
("British Plexi", { BritishPlexiAmpPedal() }),
("British JTM", { BritishJTMAmpPedal() }),
("British Bluesbreaker", { BritishBluesbreakerAmpPedal() }),
]
@Test func allBuildNonSilentFinite() throws {
for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
let s: [Float] = try render(v.make)
#expect(hasNonSilentOutput(s), "\(v.name) produced silence")
#expect(s.allSatisfy { $0.isFinite }, "\(v.name) produced non-finite output")
}
}
@Test func presenceChangesOutput() throws {
for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
let low: [Float] = try render(v.make) { $0.presence = 0.0 }
let high: [Float] = try render(v.make) { $0.presence = 1.0 }
#expect(windowedSSD(low, high) > 0, "\(v.name) Presence had no effect")
}
}
@Test func brightSwitchChangesOutput() throws {
for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
let flat: [Float] = try render(v.make) { $0.bright = 0.0 }
let bright: [Float] = try render(v.make) { $0.bright = 1.0 }
#expect(windowedSSD(flat, bright) > 0, "\(v.name) Bright had no effect")
}
}
@Test func areMarshallVoicedNonMaster() throws {
for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
let pedal: BritishComboAmpPedal = v.make()
#expect(pedal.toneStackModel == .marshall, "\(v.name) tone stack")
// Non-master: no "Master" knob (that is the separate BritishAmpPedal voice).
#expect(!pedal.effectKnobs.map { $0.label }.contains("Master"), "\(v.name) should be non-master")
}
}
@Test func plexiAndJTMExposePresenceAndBright() throws {
for pedal: BritishComboAmpPedal in [BritishPlexiAmpPedal(), BritishJTMAmpPedal()] {
#expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Presence"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright"])
}
}
@Test func voicesDifferFromEachOther() throws {
let cfg: (BritishComboAmpPedal) -> Void = { $0.gain = 6.0 }
let plexi: [Float] = try render({ BritishPlexiAmpPedal() }, configure: cfg)
let jtm: [Float] = try render({ BritishJTMAmpPedal() }, configure: cfg)
#expect(windowedSSD(plexi, jtm) > 0, "Plexi and JTM should voice differently")
}
// MARK: - Bluesbreaker tremolo
@Test func bluesbreakerExposesTremolo() throws {
let pedal: BritishBluesbreakerAmpPedal = BritishBluesbreakerAmpPedal()
#expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Presence", "Speed", "Intensity"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Tremolo"])
#expect(pedal.widthUnits == 3)
}
@Test func bluesbreakerTremoloIntensityChangesOutput() throws {
let off: [Float] = try render({ BritishBluesbreakerAmpPedal() }) { $0.intensity = 0.0 }
let on: [Float] = try render({ BritishBluesbreakerAmpPedal() }) { $0.intensity = 1.0; $0.speed = 6.0 }
#expect(windowedSSD(off, on) > 0, "Bluesbreaker tremolo had no effect")
}
@Test func bluesbreakerTremoloFootswitchBypassesToIdentity() throws {
let bypassed: [Float] = try render({ BritishBluesbreakerAmpPedal() }) {
$0.intensity = 1.0; $0.speed = 6.0; $0.tremoloEnabled = 0.0
}
let noTremolo: [Float] = try render({ BritishBluesbreakerAmpPedal() }) { $0.intensity = 0.0 }
#expect(windowedSSD(bypassed, noTremolo) == 0.0, "tremolo footswitch off should be identity")
}
@Test func stayWithinCeilingAtMaxGain() throws {
let ceilingEpsilon: Double = 1.0e-4
for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
let hot: [Float] = try render(v.make) { (pedal: BritishComboAmpPedal) in
pedal.gain = 30.0
pedal.bass = 1.0
pedal.treble = 1.0
pedal.presence = 1.0
pedal.bright = 1.0
}
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
#expect(peak <= 1.0 + ceilingEpsilon, "\(v.name) peak \(peak) exceeds the ±1 ceiling")
}
}
@Test func roundTripsThroughState() throws {
let pedal: BritishBluesbreakerAmpPedal = BritishBluesbreakerAmpPedal()
pedal.presence = 0.7
pedal.bright = 1.0
pedal.intensity = 0.5
pedal.tremoloEnabled = 0.0
pedal.cab = 2.0
let restored: BritishBluesbreakerAmpPedal = BritishBluesbreakerAmpPedal()
restored.applyState(pedal.captureState())
#expect(restored.presence == 0.7 && restored.bright == 1.0)
#expect(restored.intensity == 0.5 && restored.tremoloEnabled == 0.0 && restored.cab == 2.0)
}
@Test func registeredInBuiltInRegistry() throws {
#expect(PedalRegistry.makePedal(type: "British Plexi") is BritishPlexiAmpPedal)
#expect(PedalRegistry.makePedal(type: "British JTM") is BritishJTMAmpPedal)
#expect(PedalRegistry.makePedal(type: "British Bluesbreaker") is BritishBluesbreakerAmpPedal)
}
}