From 8a266a33dc58dd39348c0a1c2f7ef52ff3ac8932 Mon Sep 17 00:00:00 2001 From: Joshua Parmenter Date: Sun, 2 Aug 2026 18:54:45 -0700 Subject: [PATCH] fix(cab): keep modernStack breakup in-band; doc + test follow-ups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review fixes: - modernStack.breakupHz 4500 → 3800 so the cone-breakup peak sits below the 4000 Hz low-pass (was the only voice with breakup > lowPass, which rolled off most of the intended boost). - CabinetIRFactory class doc: list the full 7-stage chain (breakup + notch were missing). - Tests: add loFiIsDarkerThanFullRange and breakupPeakLiftsUpperMid for per-voice differentiation; drop the hard-coded voice count in voiceNamesAreUnique. Co-Authored-By: Claude Opus 4.8 --- .../Cabinet/CabinetIRFactory.swift | 3 ++- .../Cabinet/CabinetVoice.swift | 2 +- .../CabinetIRFactoryTests.swift | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Sources/LyrebirdShoeGaze/Cabinet/CabinetIRFactory.swift b/Sources/LyrebirdShoeGaze/Cabinet/CabinetIRFactory.swift index a9760b6..aa26d48 100644 --- a/Sources/LyrebirdShoeGaze/Cabinet/CabinetIRFactory.swift +++ b/Sources/LyrebirdShoeGaze/Cabinet/CabinetIRFactory.swift @@ -15,7 +15,8 @@ private let cabinetPeakingGainDivisor: Double = 40.0 /// Synthesizes a short cabinet impulse response for a ``CabinetVoice`` by running a unit /// impulse through a cascade of RBJ biquads (high-pass → two-stage low-pass → low-mid body -/// peak → presence peak) and capturing the result into a mono ``LyrebirdBuffer``. +/// peak → presence peak → cone-breakup peak → mid notch) and capturing the result into a mono +/// ``LyrebirdBuffer``. /// /// This runs **off the RT thread** (at pedal build time), so it uses plain `Double` math with /// no allocation constraints. The produced buffer is a normal IR consumed by `ConvolutionReverb`. diff --git a/Sources/LyrebirdShoeGaze/Cabinet/CabinetVoice.swift b/Sources/LyrebirdShoeGaze/Cabinet/CabinetVoice.swift index bd2eb2b..e338cec 100644 --- a/Sources/LyrebirdShoeGaze/Cabinet/CabinetVoice.swift +++ b/Sources/LyrebirdShoeGaze/Cabinet/CabinetVoice.swift @@ -130,7 +130,7 @@ public enum CabinetVoice: String, CaseIterable, Sendable { case .americanCombo: return 4200.0 case .britishStack: return 3800.0 case .vintageDark: return 3500.0 - case .modernStack: return 4500.0 + case .modernStack: return 3800.0 case .boutiqueOpen: return 5000.0 case .brightCombo: return 5200.0 case .fullRange: return 6000.0 diff --git a/Tests/LyrebirdShoeGazeTests/CabinetIRFactoryTests.swift b/Tests/LyrebirdShoeGazeTests/CabinetIRFactoryTests.swift index 2ba60f4..86530b7 100644 --- a/Tests/LyrebirdShoeGazeTests/CabinetIRFactoryTests.swift +++ b/Tests/LyrebirdShoeGazeTests/CabinetIRFactoryTests.swift @@ -88,9 +88,26 @@ struct CabinetIRFactoryTests { #expect(atNotch < above, "notch did not dip below the upper midrange") } + @Test func loFiIsDarkerThanFullRange() { + // Lo-Fi 1×8 rolls off at ~3 kHz vs Full-Range's ~9 kHz, so it is markedly darker at 4 kHz. + let loFi: LyrebirdBuffer = CabinetIRFactory.makeIR(voice: .loFiBox, sampleRate: sampleRate) + let frfr: LyrebirdBuffer = CabinetIRFactory.makeIR(voice: .fullRange, sampleRate: sampleRate) + #expect(responseMagnitude(frfr, hz: 4000.0) > responseMagnitude(loFi, hz: 4000.0), + "Lo-Fi should be darker than Full-Range at 4 kHz") + } + + @Test func breakupPeakLiftsUpperMid() { + // Bright 1×12 (breakup +3 dB @ 5.2 kHz, LP 6.5 kHz) keeps more ~5.1 kHz energy than + // Boutique 2×12 (breakup +1.5 dB @ 5.0 kHz, LP 6.0 kHz) — both the stronger breakup boost + // and the higher low-pass push the same direction. + let bright: LyrebirdBuffer = CabinetIRFactory.makeIR(voice: .brightCombo, sampleRate: sampleRate) + let boutique: LyrebirdBuffer = CabinetIRFactory.makeIR(voice: .boutiqueOpen, sampleRate: sampleRate) + #expect(responseMagnitude(bright, hz: 5100.0) > responseMagnitude(boutique, hz: 5100.0), + "brightCombo should have more upper-mid bite than boutiqueOpen at 5.1 kHz") + } + @Test func voiceNamesAreUnique() { let names: [String] = CabinetVoice.allCases.map { $0.displayName } #expect(Set(names).count == names.count, "duplicate cabinet display names") - #expect(names.count == 8, "expected 8 cabinet voices") } }