feat(amps): Jazz Clean — stereo-chorus solid-state amp

First stereo (widener) amp, modeling the JC-style ultra-clean combo whose
signature is a lush stereo chorus fed to two power amps / speakers.

Refactor AmpVoicePedal.effect() into two reusable, behavior-preserving pieces:
- preCabinetCore(_:)  — inputShaping → preamp → tone → onboardEffects → power → shapeVoice (mono)
- cabinetAndLimit(_:) — selected cab convolver → tanh soft-limit → Clip(±1) (per channel)
effect() = cabinetAndLimit(preCabinetCore(dry)); the four existing amps are
unchanged (verified by their suites).

JazzCleanAmpPedal (widener, .fender): mono core (with spring reverb + bright)
→ Chorus (mono → stereo split) → per-channel cabinetAndLimit. Controls:
Gain/Bass/Mid/Treble + Reverb/Rate/Depth knobs, Bright + Chorus switches, Cab
selector; widthUnits 3; defaults to the Full-Range cab for a hi-fi voice. The
Chorus footswitch gates the wet mix to 0 (dry pass-through, Rate/Depth kept).

Registered across registry/type/category/palette/enclosure; Help acknowledgment
lists its tone stack. 10 tests (chorus rate/depth, reverb, bright, footswitch
bit-exact bypass, ceiling with FX, stereo/control-surface config, round-trip,
registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 08:12:27 -07:00
parent 27fb6e6898
commit 102715ded1
9 changed files with 328 additions and 10 deletions
+1
View File
@@ -48,6 +48,7 @@ public extension PedalType {
static let british = PedalType("British")
static let chime = PedalType("Chime")
static let fullertonReverb = PedalType("Fullerton Reverb")
static let jazzClean = PedalType("Jazz Clean")
static let neuralAmp = PedalType("Neural Amp")
static let overdrive = PedalType("Overdrive")
static let distortion = PedalType("Distortion")
@@ -184,7 +184,16 @@ open class AmpVoicePedal: Pedal {
/// - Parameter dry: Dry mono input signal.
/// - Returns: The amped, cab-convolved, soft-limited, ceiling-clamped mono output.
public override func effect(_ dry: any ValidGeneratorInput) -> any ValidGeneratorInput {
let sr: Double = sampleRate
cabinetAndLimit(preCabinetCore(dry))
}
/// The mono pre-cabinet core: `inputShaping → preamp → tone stack → onboardEffects → power amp →
/// shapeVoice`. Factored out of `effect(_:)` so a stereo (widener) amp can split into a stereo
/// stage (e.g. a stereo chorus) between the core and a per-channel ``cabinetAndLimit(_:)``.
///
/// - Parameter dry: Dry mono input signal.
/// - Returns: The post-power-amp, pre-cabinet mono signal.
func preCabinetCore(_ dry: any ValidGeneratorInput) -> any ValidGeneratorInput {
let preShaped: any ValidGeneratorInput = inputShaping(dry)
let preamp: TriodeStage = TriodeStage(input: preShaped, drive: $gain, bias: preampBias, oversample: 4)
let toned: ToneStack = ToneStack(
@@ -192,11 +201,20 @@ open class AmpVoicePedal: Pedal {
let processed: any ValidGeneratorInput = onboardEffects(toned)
let powerAmp: TriodeStage = TriodeStage(
input: processed, drive: powerAmpDrive, bias: powerAmpBias, oversample: 2)
let shaped: any ValidGeneratorInput = shapeVoice(powerAmp)
return shapeVoice(powerAmp)
}
/// The per-channel cabinet + output stage: the selected `CabinetVoice` convolver → `tanh`
/// soft-limit → `Clip(±1)` safety clamp. Applied once in mono, or once per channel by a
/// widener amp.
///
/// - Parameter signal: The post-core signal for one channel.
/// - Returns: The cab-convolved, soft-limited, ceiling-clamped signal.
func cabinetAndLimit(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let voice: CabinetVoice = CabinetVoice.voice(atSelectorValue: cab)
let cabinet: ConvolutionReverb.Audio = ConvolutionReverb.Audio(
input: shaped,
ir: CabinetIRFactory.makeIR(voice: voice, sampleRate: sr),
input: signal,
ir: CabinetIRFactory.makeIR(voice: voice, sampleRate: sampleRate),
mix: cabinetMix
)
let softLimited: TriodeStage = TriodeStage(
@@ -0,0 +1,151 @@
// JazzCleanAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Ultra-clean solid-state combo with its signature lush **stereo chorus**, plus spring reverb and
/// a bright switch — the glassy "jazz clean" platform.
///
/// Unlike the mono amp voices, this amp is a ``PedalChannelKind/widener``: the real amp has two
/// power amps and two speakers fed by a stereo chorus, so it takes the mono guitar input and emits a
/// genuinely stereo pair. The chorus (mono → stereo) is the stereo splitter — its two taps become
/// the left and right channels, each then run through its own cabinet + output stage.
///
/// Signal path (inside `wideEffect(_:)`):
/// ```
/// dry → preCabinetCore (bright → preamp → tone → spring reverb → power amp) [mono]
/// → Chorus (mono → stereo) [stereo split]
/// → L: cabinetAndLimit R: cabinetAndLimit [per channel]
/// ```
/// A **Chorus** switch models the amp's chorus on/off footswitch: off collapses the chorus to a dry
/// pass-through (both channels identical), preserving the Rate/Depth settings.
public final class JazzCleanAmpPedal: AmpVoicePedal {
// MARK: - Onboard-effect parameters
/// Spring-reverb wet mix in [0, 1].
@UIParam public var reverb: Double = 0.2
/// Chorus LFO rate in Hz. Range [0.1, 5.0].
@UIParam public var chorusRate: Double = 0.8
/// Chorus depth as a fraction of the base delay time, in [0, 1].
@UIParam public var chorusDepth: Double = 0.3
/// Bright switch: `0` = flat, `1` = treble shelf engaged.
@UIParam public var bright: Double = 0.0
/// Chorus footswitch: `1` = chorus engaged (stereo), `0` = bypassed (dry, mono-equivalent).
@UIParam public var chorusEnabled: Double = 1.0
// MARK: - Constants
/// Bright-switch shelf corner in Hz.
private let brightFreqHz: Double = 3000.0
/// Bright-switch shelf lift in dB when engaged.
private let brightMaxGainDb: Double = 5.0
/// Bright-switch shelf slope.
private let brightSlope: Double = 0.9
/// Fixed chorus wet/dry blend when the chorus is engaged (the amp has no chorus-mix knob).
private let chorusMixValue: Double = 0.5
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
private let chorusRateRange: ClosedRange<Double> = 0.1 ... 5.0
private let chorusDepthRange: ClosedRange<Double> = 0.0 ... 1.0
private let switchOffValue: Double = 0.0
private let switchOnValue: Double = 1.0
// MARK: - Voice configuration
public override var toneStackModel: ToneStackModel { .fender }
public override var summaryText: String {
"Solid-state clean — lush stereo chorus, spring reverb, and a Bright switch."
}
public override var signatureKnobs: [PedalKnob] {
[
PedalKnob(label: "Reverb", node: $reverb, range: reverbRange),
PedalKnob(label: "Rate", node: $chorusRate, range: chorusRateRange),
PedalKnob(label: "Depth", node: $chorusDepth, range: chorusDepthRange),
]
}
/// Stereo output — the chorus feeds two independent power-amp/cabinet channels.
public override var channelKind: PedalChannelKind { .widener }
/// Wider card for the reverb/chorus knobs plus the Bright and Chorus switches.
public override var widthUnits: Int { 3 }
// MARK: - Init
/// Creates a Jazz Clean 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: "Jazz Clean", inputBus: inputBus, outputBus: outputBus)
gain = 3.0 // clean, low-gain solid-state default
cab = 6.0 // Full-Range (FRFR) — the hi-fi, least-coloured voice
}
// MARK: - Switches
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: "Chorus",
node: $chorusEnabled,
options: [
PedalSwitch.Option(title: "Off", value: switchOffValue),
PedalSwitch.Option(title: "On", value: switchOnValue),
]
),
]
}
// MARK: - Hooks
/// 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)
}
/// Spring reverb inside the mono core (before the stereo chorus split).
public override func onboardEffects(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
SpringReverb.Audio(input: signal, mix: $reverb, sampleRate: sampleRate)
}
// MARK: - Stereo effect
/// Mono amp core → stereo chorus split → per-channel cabinet + output stage.
///
/// The `chorusEnabled` footswitch gates the chorus wet mix to `0` when off, so the chorus passes
/// the dry core to both channels (a mono-equivalent output) while preserving Rate/Depth.
///
/// - Parameter dry: Dry mono input signal.
/// - Returns: The stereo (left, right) amp output.
public override func wideEffect(
_ dry: any ValidGeneratorInput
) -> (left: any ValidGeneratorInput, right: any ValidGeneratorInput) {
let core: any ValidGeneratorInput = preCabinetCore(dry)
let chorusMix: any ValidGeneratorInput = $chorusEnabled * chorusMixValue
let chorus: Chorus.Audio = Chorus.Audio(
input: core,
depth: $chorusDepth,
rate: $chorusRate,
mix: chorusMix,
sampleRate: sampleRate
)
return (cabinetAndLimit(chorus.left), cabinetAndLimit(chorus.right))
}
}
@@ -35,6 +35,7 @@ public enum PedalRegistry {
"British": { BritishAmpPedal() },
"Chime": { ChimeAmpPedal() },
"Fullerton Reverb": { FullertonReverbAmpPedal() },
"Jazz Clean": { JazzCleanAmpPedal() },
"Neural Amp": { NeuralAmpPedal() },
"Overdrive": { OverdrivePedal() },
"Distortion": { DistortionPedal() },
+4 -4
View File
@@ -178,10 +178,10 @@ 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, and Fullerton Reverb 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.",
"The California, British, Chime, Fullerton Reverb, and Jazz Clean 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.",
"The Neural Amp pedal loads GuitarML Proteus / NeuralPi capture models (the open LSTM "
+ "format from github.com/GuitarML). You supply the model file; none are bundled, and "
+ "those models are licensed by their respective authors.",
@@ -42,7 +42,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
}
private static let mapping: [String: PedalCategory] = [
"California": .gain, "British": .gain, "Chime": .gain, "Fullerton Reverb": .gain, "Neural Amp": .gain, "Overdrive": .gain, "Distortion": .gain, "Fuzz": .gain, "Volume": .gain,
"California": .gain, "British": .gain, "Chime": .gain, "Fullerton Reverb": .gain, "Jazz Clean": .gain, "Neural Amp": .gain, "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,
"Cabinet": .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", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"California", "British", "Chime", "Fullerton Reverb", "Jazz Clean", "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",
@@ -21,6 +21,7 @@ private func enclosureColor(for displayName: String) -> Color {
case "British": return Color(red: 0.30, green: 0.16, blue: 0.10) // oxblood tolex
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 "Jazz Clean": return Color(red: 0.14, green: 0.30, blue: 0.34) // solid-state silver-teal
case "Neural Amp": return Color(red: 0.22, green: 0.16, blue: 0.30) // deep neural violet
case "Overdrive": return Color(red: 0.85, green: 0.42, blue: 0.08) // warm orange
case "Distortion": return Color(red: 0.80, green: 0.26, blue: 0.12) // hot rust
@@ -0,0 +1,146 @@
// JazzCleanAmpPedalTests.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("JazzCleanAmpPedal")
struct JazzCleanAmpPedalTests {
private let sampleRate: Double = 48000.0
/// Renders the left channel through a bare engine. As with the other widener-pedal suites, the
/// right channel needs a board stereo region, so this exercises the mono core → chorus.left →
/// cabinet path; the control-surface / stereo config is asserted directly below.
private func render(configure: (JazzCleanAmpPedal) -> 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: JazzCleanAmpPedal = JazzCleanAmpPedal(inputBus: srcBus.index, 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
}
}
@Test func buildsNonSilentFiniteOutput() throws {
let samples: [Float] = try render()
#expect(!samples.isEmpty)
#expect(hasNonSilentOutput(samples), "Jazz Clean produced silence")
#expect(samples.allSatisfy { $0.isFinite }, "Jazz Clean produced non-finite output")
}
@Test func chorusRateChangesOutput() throws {
let slow: [Float] = try render { $0.chorusRate = 0.2 }
let fast: [Float] = try render { $0.chorusRate = 5.0 }
#expect(windowedSSD(slow, fast) > 0, "chorus rate had no effect")
}
@Test func chorusDepthChangesOutput() throws {
let shallow: [Float] = try render { $0.chorusDepth = 0.05 }
let deep: [Float] = try render { $0.chorusDepth = 0.9 }
#expect(windowedSSD(shallow, deep) > 0, "chorus depth had no effect")
}
@Test func reverbMixChangesOutput() throws {
let dry: [Float] = try render { $0.reverb = 0.0 }
let wet: [Float] = try render { $0.reverb = 0.9 }
#expect(windowedSSD(dry, wet) > 0, "reverb mix had no effect")
}
@Test func brightSwitchChangesOutput() throws {
let flat: [Float] = try render { $0.bright = 0.0 }
let bright: [Float] = try render { $0.bright = 1.0 }
#expect(windowedSSD(flat, bright) > 0, "bright switch had no effect")
}
@Test func chorusFootswitchBypasses() throws {
// Off must differ from on; and with the chorus off the Rate knob is irrelevant (mix 0 →
// dry), so two off-renders at different rates are bit-identical.
let on: [Float] = try render { $0.chorusEnabled = 1.0; $0.chorusRate = 3.0 }
let off: [Float] = try render { $0.chorusEnabled = 0.0; $0.chorusRate = 3.0 }
#expect(windowedSSD(on, off) > 0, "chorus footswitch had no effect")
let offSlow: [Float] = try render { $0.chorusEnabled = 0.0; $0.chorusRate = 0.2 }
let offFast: [Float] = try render { $0.chorusEnabled = 0.0; $0.chorusRate = 5.0 }
#expect(windowedSSD(offSlow, offFast) == 0.0, "chorus off should ignore rate (dry pass-through)")
}
@Test func outputStaysWithinCeilingWithFXEngaged() throws {
let ceilingEpsilon: Double = 1.0e-4
let hot: [Float] = try render { (pedal: JazzCleanAmpPedal) in
pedal.gain = 30.0
pedal.bass = 1.0
pedal.treble = 1.0
pedal.reverb = 1.0
pedal.bright = 1.0
pedal.chorusDepth = 0.9
}
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
#expect(peak <= 1.0 + ceilingEpsilon, "peak \(peak) exceeds the ±1 ceiling")
#expect(peak > 0.3, "unexpectedly quiet at max gain: \(peak)")
}
@Test func exposesFullControlSurface() throws {
let pedal: JazzCleanAmpPedal = JazzCleanAmpPedal()
#expect(pedal.effectKnobs.map { $0.label }
== ["Gain", "Bass", "Mid", "Treble", "Reverb", "Rate", "Depth"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Chorus"])
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
#expect(pedal.effectSelectors.first?.rebuildsOnChange == true)
#expect(pedal.widthUnits == 3)
#expect(pedal.showsMixControl == false)
#expect(pedal.channelKind == .widener, "Jazz Clean should be a stereo widener")
#expect(pedal.toneStackModel == .fender)
}
@Test func controlsRoundTripThroughState() throws {
let pedal: JazzCleanAmpPedal = JazzCleanAmpPedal()
pedal.gain = 6.0
pedal.reverb = 0.5
pedal.chorusRate = 2.0
pedal.chorusDepth = 0.4
pedal.bright = 1.0
pedal.chorusEnabled = 0.0
pedal.cab = 3.0
let restored: JazzCleanAmpPedal = JazzCleanAmpPedal()
restored.applyState(pedal.captureState())
#expect(restored.gain == 6.0)
#expect(restored.reverb == 0.5)
#expect(restored.chorusRate == 2.0)
#expect(restored.chorusDepth == 0.4)
#expect(restored.bright == 1.0)
#expect(restored.chorusEnabled == 0.0)
#expect(restored.cab == 3.0)
}
@Test func registeredInBuiltInRegistry() throws {
#expect(PedalRegistry.makePedal(type: "Jazz Clean") is JazzCleanAmpPedal)
}
}