fix(cab): keep modernStack breakup in-band; doc + test follow-ups
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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`.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user