From 95839a9e35d8c7aca30e866b2135dd9817d5e2e6 Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Mon, 3 Aug 2026 15:18:06 -0700 Subject: [PATCH] =?UTF-8?q?feat(amps):=20Cali=20Hi-Gain=20=E2=80=94=20Mesa?= =?UTF-8?q?=20Mark=20w/=205-band=20graphic=20EQ=20(Phase=207)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New CaliHiGainAmpPedal: a BoutiqueAmpPedal (Clean/Lead channel, Master, Presence, Depth) with an onboard 5-band graphic EQ layered in shapeVoice — RBJ low shelf (80) → peaks (240/750/2200) → high shelf (6600), each a dB fader via effectSliders, cascaded after the base Presence/Depth shaping. Defaults to a mild scooped "V" (the Mark-series signature). .fender tone stack (Mark lineage); gain 6, hot Lead drive 16, British 4×12. Registered across 6 sites as .amp. 7 tests (EQ bands change output, inherited channel/master, ceiling with EQ + gain maxed, control surface incl. slider bank, round-trip, registry). Co-Authored-By: Claude Opus 4.8 --- Sources/LyrebirdShoeGaze/PedalType.swift | 1 + .../Pedals/CaliHiGainAmpPedal.swift | 79 +++++++++++++ .../Presets/PedalRegistry.swift | 1 + .../LyrebirdShoeGazeUI/PedalCategory.swift | 2 +- .../LyrebirdShoeGazeUI/PedalPaletteView.swift | 2 +- Sources/LyrebirdShoeGazeUI/PedalView.swift | 1 + .../CaliHiGainAmpPedalTests.swift | 105 ++++++++++++++++++ 7 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 Sources/LyrebirdShoeGaze/Pedals/CaliHiGainAmpPedal.swift create mode 100644 Tests/LyrebirdShoeGazeTests/CaliHiGainAmpPedalTests.swift diff --git a/Sources/LyrebirdShoeGaze/PedalType.swift b/Sources/LyrebirdShoeGaze/PedalType.swift index fff8051..86dd486 100644 --- a/Sources/LyrebirdShoeGaze/PedalType.swift +++ b/Sources/LyrebirdShoeGaze/PedalType.swift @@ -53,6 +53,7 @@ public extension PedalType { static let britishDual = PedalType("British Dual") static let boutiqueLead = PedalType("Boutique Lead") static let boutiqueOD = PedalType("Boutique OD") + static let caliHiGain = PedalType("Cali Hi-Gain") static let chime = PedalType("Chime") static let chimeFifteen = PedalType("Chime 15") static let chimeNormal = PedalType("Chime Normal") diff --git a/Sources/LyrebirdShoeGaze/Pedals/CaliHiGainAmpPedal.swift b/Sources/LyrebirdShoeGaze/Pedals/CaliHiGainAmpPedal.swift new file mode 100644 index 0000000..045e72c --- /dev/null +++ b/Sources/LyrebirdShoeGaze/Pedals/CaliHiGainAmpPedal.swift @@ -0,0 +1,79 @@ +// CaliHiGainAmpPedal.swift +// Lyrebird +// +// Copyright (c) 2026 Joshua Parmenter / realizedsound +// SPDX-License-Identifier: MIT + +import LyrebirdSynth +import LyrebirdUI + +/// California **Mark-series high-gain** — the cascaded lead voice defined by its onboard **5-band +/// graphic EQ**: the sliders sculpt the famous scooped "V" lead tone on top of the amp's own gain. +/// +/// A ``BoutiqueAmpPedal`` (Clean/Lead channel, Master, Presence, Depth) that adds a graphic-EQ bank +/// in ``shapeVoice(_:)`` — a low shelf, three peaks, and a high shelf, each a dB fader — cascaded +/// after the base Presence/Depth shaping. Defaults to a gentle V. +public final class CaliHiGainAmpPedal: BoutiqueAmpPedal { + + /// Graphic-EQ band gains in dB. Defaults form a mild scooped "V" — the Mark-series signature. + @UIParam public var eq80: Double = 2.0 + @UIParam public var eq240: Double = 0.0 + @UIParam public var eq750: Double = -5.0 + @UIParam public var eq2200: Double = 0.0 + @UIParam public var eq6600: Double = 3.0 + + private let eq80Freq: Double = 80.0 + private let eq240Freq: Double = 240.0 + private let eq750Freq: Double = 750.0 + private let eq2200Freq: Double = 2200.0 + private let eq6600Freq: Double = 6600.0 + /// Shelf slope for the outer graphic-EQ bands. + private let eqShelfSlope: Double = 1.0 + /// Peaking-band Q — moderate bandwidth so adjacent graphic-EQ bands overlap smoothly. + private let eqPeakQ: Double = 0.9 + private let bandGainRange: ClosedRange = -12.0 ... 12.0 + + public override var toneStackModel: ToneStackModel { .fender } + public override var summaryText: String { + "California Mark-series high gain with an onboard 5-band graphic EQ (scooped-V lead)." + } + + /// The five graphic-EQ bands as vertical faders (dB), rendered as a slider bank. + public override var effectSliders: [PedalSlider] { + [ + PedalSlider(label: "80", node: $eq80, range: bandGainRange), + PedalSlider(label: "240", node: $eq240, range: bandGainRange), + PedalSlider(label: "750", node: $eq750, range: bandGainRange), + PedalSlider(label: "2.2k", node: $eq2200, range: bandGainRange), + PedalSlider(label: "6.6k", node: $eq6600, range: bandGainRange), + ] + } + + /// Creates a Cali Hi-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: "Cali Hi-Gain", inputBus: inputBus, outputBus: outputBus) + gain = 6.0 + drive = 16.0 // hot Mark-style lead + cab = 1.0 // British 4×12 — tight and aggressive + } + + /// Base Presence/Depth shaping, then the 5-band graphic EQ (low shelf → 3 peaks → high shelf), + /// each band's gain in dB from its fader. + public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { + let shaped: any ValidGeneratorInput = super.shapeVoice(signal) + let low: RBJLowShelf.Audio = RBJLowShelf.Audio( + input: shaped, freq: eq80Freq, gain: $eq80, slope: eqShelfSlope) + let lowMid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio( + input: low, freq: eq240Freq, gain: $eq240, q: eqPeakQ) + let mid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio( + input: lowMid, freq: eq750Freq, gain: $eq750, q: eqPeakQ) + let highMid: RBJPeakingEQ.Audio = RBJPeakingEQ.Audio( + input: mid, freq: eq2200Freq, gain: $eq2200, q: eqPeakQ) + return RBJHighShelf.Audio( + input: highMid, freq: eq6600Freq, gain: $eq6600, slope: eqShelfSlope) + } +} diff --git a/Sources/LyrebirdShoeGaze/Presets/PedalRegistry.swift b/Sources/LyrebirdShoeGaze/Presets/PedalRegistry.swift index 6f0fbfb..314ce40 100644 --- a/Sources/LyrebirdShoeGaze/Presets/PedalRegistry.swift +++ b/Sources/LyrebirdShoeGaze/Presets/PedalRegistry.swift @@ -40,6 +40,7 @@ public enum PedalRegistry { "British Dual": { BritishDualAmpPedal() }, "Boutique Lead": { BoutiqueLeadAmpPedal() }, "Boutique OD": { BoutiqueODAmpPedal() }, + "Cali Hi-Gain": { CaliHiGainAmpPedal() }, "Chime": { ChimeAmpPedal() }, "Chime 15": { ChimeFifteenAmpPedal() }, "Chime Normal": { ChimeNormalAmpPedal() }, diff --git a/Sources/LyrebirdShoeGazeUI/PedalCategory.swift b/Sources/LyrebirdShoeGazeUI/PedalCategory.swift index 30c7900..f439668 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalCategory.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalCategory.swift @@ -44,7 +44,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable { } private static let mapping: [String: PedalCategory] = [ - "California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "British Master": .amp, "British Dual": .amp, "Boutique Lead": .amp, "Boutique OD": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Fullerton Drive": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp, + "California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "British Master": .amp, "British Dual": .amp, "Boutique Lead": .amp, "Boutique OD": .amp, "Cali Hi-Gain": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Fullerton Drive": .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, diff --git a/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift b/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift index 71a9184..7141031 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalPaletteView.swift @@ -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", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Fullerton Drive", "Jazz Clean", "Chime Top Boost", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz", + "California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Cali Hi-Gain", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Fullerton Drive", "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", diff --git a/Sources/LyrebirdShoeGazeUI/PedalView.swift b/Sources/LyrebirdShoeGazeUI/PedalView.swift index 00fd562..f9977d8 100644 --- a/Sources/LyrebirdShoeGazeUI/PedalView.swift +++ b/Sources/LyrebirdShoeGazeUI/PedalView.swift @@ -26,6 +26,7 @@ private func enclosureColor(for displayName: String) -> Color { case "British Dual": return Color(red: 0.24, green: 0.13, blue: 0.11) // modern high-gain case "Boutique Lead": return Color(red: 0.28, green: 0.12, blue: 0.16) // boutique oxblood case "Boutique OD": return Color(red: 0.30, green: 0.20, blue: 0.10) // D-style amber + case "Cali Hi-Gain": return Color(red: 0.16, green: 0.16, blue: 0.18) // Mark-series black case "Chime": return Color(red: 0.16, green: 0.24, blue: 0.22) // vintage green case "Chime 15": return Color(red: 0.18, green: 0.28, blue: 0.22) // brighter vox green case "Chime Normal": return Color(red: 0.20, green: 0.26, blue: 0.20) // warm vox green diff --git a/Tests/LyrebirdShoeGazeTests/CaliHiGainAmpPedalTests.swift b/Tests/LyrebirdShoeGazeTests/CaliHiGainAmpPedalTests.swift new file mode 100644 index 0000000..5c31d55 --- /dev/null +++ b/Tests/LyrebirdShoeGazeTests/CaliHiGainAmpPedalTests.swift @@ -0,0 +1,105 @@ +// CaliHiGainAmpPedalTests.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("CaliHiGainAmpPedal") +struct CaliHiGainAmpPedalTests { + + private let sampleRate: Double = 48000.0 + + private func render(configure: (CaliHiGainAmpPedal) -> 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: CaliHiGainAmpPedal = CaliHiGainAmpPedal(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 s: [Float] = try render() + #expect(hasNonSilentOutput(s) && s.allSatisfy { $0.isFinite }) + } + + @Test func graphicEQBandsChangeOutput() throws { + // Each band moves the tone: sweep the mid-scoop band and an outer band. + let midCut: [Float] = try render { $0.eq750 = -12.0 } + let midBoost: [Float] = try render { $0.eq750 = 12.0 } + #expect(windowedSSD(midCut, midBoost) > 0, "750 Hz band had no effect") + let trebleFlat: [Float] = try render { $0.eq6600 = 0.0 } + let trebleBoost: [Float] = try render { $0.eq6600 = 12.0 } + #expect(windowedSSD(trebleFlat, trebleBoost) > 0, "6.6 kHz band had no effect") + } + + @Test func inheritedChannelAndMasterWork() throws { + let clean: [Float] = try render { $0.channel = 0.0 } + let lead: [Float] = try render { $0.channel = 1.0 } + #expect(windowedSSD(clean, lead) > 0, "channel switch had no effect") + let channel: PedalSwitch? = CaliHiGainAmpPedal().effectSwitches.first { $0.label == "Channel" } + #expect(channel?.rebuildsOnChange == true) + } + + @Test func staysWithinCeilingWithEQAndGainMaxed() throws { + let hot: [Float] = try render { (p: CaliHiGainAmpPedal) in + p.gain = 30.0; p.bass = 1.0; p.treble = 1.0; p.master = 1.0; p.channel = 1.0; p.drive = 30.0 + p.eq80 = 12.0; p.eq240 = 12.0; p.eq750 = 12.0; p.eq2200 = 12.0; p.eq6600 = 12.0 + } + let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) } + #expect(peak <= 1.0 + 1.0e-4, "Cali Hi-Gain exceeds the ±1 ceiling with EQ + gain maxed: \(peak)") + } + + @Test func exposesControlSurface() throws { + let pedal: CaliHiGainAmpPedal = CaliHiGainAmpPedal() + #expect(pedal.effectKnobs.map { $0.label } + == ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"]) + #expect(pedal.effectSliders.map { $0.label } == ["80", "240", "750", "2.2k", "6.6k"]) + #expect(pedal.effectSwitches.map { $0.label } == ["Channel"]) + #expect(pedal.widthUnits == 4) + #expect(pedal.toneStackModel == .fender) + } + + @Test func controlsRoundTripThroughState() throws { + let pedal: CaliHiGainAmpPedal = CaliHiGainAmpPedal() + pedal.eq80 = 4.0; pedal.eq750 = -8.0; pedal.eq6600 = 6.0 + pedal.channel = 1.0; pedal.master = 0.7; pedal.cab = 2.0 + let restored: CaliHiGainAmpPedal = CaliHiGainAmpPedal() + restored.applyState(pedal.captureState()) + #expect(restored.eq80 == 4.0 && restored.eq750 == -8.0 && restored.eq6600 == 6.0) + #expect(restored.channel == 1.0 && restored.master == 0.7 && restored.cab == 2.0) + } + + @Test func registeredInBuiltInRegistry() throws { + #expect(PedalRegistry.makePedal(type: "Cali Hi-Gain") is CaliHiGainAmpPedal) + } +}