ec4e7dc5a4
Expand CabinetVoice from 3 to 8 synthesized voicings (all original code, no captures): add Modern 4×12, Boutique 2×12, Bright 1×12, Full-Range (FRFR), and Lo-Fi 1×8. Extend the IR synthesis model with two per-voice stages so the voices reach character the old 4-band curve could not: - cone-"breakup" peak (narrow upper-mid bite/clank, breakupQ 2.0) - mid interference "notch" (comb-filter dip ~1.2–2.5 kHz, notchQ 2.5) Both are RBJ peaking biquads; gain 0 = identity, so a voice can disable either (Full-Range runs a flat notch). Chain is now HP → LP×2 → body → presence → breakup → notch. New tests: FRFR top-end extension, notch mid-dip, 8-voice name uniqueness. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
184 lines
6.3 KiB
Swift
184 lines
6.3 KiB
Swift
// CabinetVoice.swift
|
||
// Lyrebird
|
||
//
|
||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||
// SPDX-License-Identifier: MIT
|
||
|
||
/// A built-in guitar-speaker-cabinet voicing.
|
||
///
|
||
/// Each voice is a compact set of target-response parameters — low/high rolloff, a low-mid
|
||
/// "body" bump, an upper-mid "presence" peak, a higher cone-"breakup" peak, and a mid
|
||
/// interference "notch" — from which ``CabinetIRFactory`` synthesizes a short impulse response
|
||
/// entirely in code. These IRs are **our own content** (MIT, generated, no third-party capture),
|
||
/// so they ship with the pedal without licensing concerns. (Loading a user-supplied captured
|
||
/// `.wav` cab IR is a planned follow-up.)
|
||
///
|
||
/// The values are deliberately broad-strokes voicings, not measurements of specific hardware.
|
||
public enum CabinetVoice: String, CaseIterable, Sendable {
|
||
case americanCombo
|
||
case britishStack
|
||
case vintageDark
|
||
case modernStack
|
||
case boutiqueOpen
|
||
case brightCombo
|
||
case fullRange
|
||
case loFiBox
|
||
|
||
/// Human-readable name for pickers.
|
||
public var displayName: String {
|
||
switch self {
|
||
case .americanCombo: return "American 1×12"
|
||
case .britishStack: return "British 4×12"
|
||
case .vintageDark: return "Vintage Dark"
|
||
case .modernStack: return "Modern 4×12"
|
||
case .boutiqueOpen: return "Boutique 2×12"
|
||
case .brightCombo: return "Bright 1×12"
|
||
case .fullRange: return "Full-Range (FRFR)"
|
||
case .loFiBox: return "Lo-Fi 1×8"
|
||
}
|
||
}
|
||
|
||
/// Low-frequency rolloff (high-pass cutoff) in Hz — the speaker's bass limit.
|
||
var highPassHz: Double {
|
||
switch self {
|
||
case .americanCombo: return 80.0
|
||
case .britishStack: return 95.0
|
||
case .vintageDark: return 90.0
|
||
case .modernStack: return 100.0
|
||
case .boutiqueOpen: return 70.0
|
||
case .brightCombo: return 85.0
|
||
case .fullRange: return 45.0
|
||
case .loFiBox: return 180.0
|
||
}
|
||
}
|
||
|
||
/// High-frequency rolloff (low-pass cutoff) in Hz — the speaker's top-end limit. Applied as a
|
||
/// two-stage cascade for a steeper, more speaker-like slope.
|
||
var lowPassHz: Double {
|
||
switch self {
|
||
case .americanCombo: return 5500.0
|
||
case .britishStack: return 4500.0
|
||
case .vintageDark: return 3800.0
|
||
case .modernStack: return 4000.0
|
||
case .boutiqueOpen: return 6000.0
|
||
case .brightCombo: return 6500.0
|
||
case .fullRange: return 9000.0
|
||
case .loFiBox: return 3000.0
|
||
}
|
||
}
|
||
|
||
/// Low-mid "body" peak centre in Hz.
|
||
var bodyHz: Double {
|
||
switch self {
|
||
case .americanCombo: return 420.0
|
||
case .britishStack: return 700.0
|
||
case .vintageDark: return 500.0
|
||
case .modernStack: return 900.0
|
||
case .boutiqueOpen: return 450.0
|
||
case .brightCombo: return 550.0
|
||
case .fullRange: return 300.0
|
||
case .loFiBox: return 900.0
|
||
}
|
||
}
|
||
|
||
/// Low-mid body peak gain in dB (may be negative for a scoop).
|
||
var bodyGainDb: Double {
|
||
switch self {
|
||
case .americanCombo: return 1.5
|
||
case .britishStack: return -2.0
|
||
case .vintageDark: return 2.0
|
||
case .modernStack: return 2.0
|
||
case .boutiqueOpen: return -1.0
|
||
case .brightCombo: return 1.0
|
||
case .fullRange: return 0.0
|
||
case .loFiBox: return 4.0
|
||
}
|
||
}
|
||
|
||
/// Presence peak centre in Hz — the upper-mid "bite".
|
||
var presenceHz: Double {
|
||
switch self {
|
||
case .americanCombo: return 3000.0
|
||
case .britishStack: return 2500.0
|
||
case .vintageDark: return 2200.0
|
||
case .modernStack: return 3200.0
|
||
case .boutiqueOpen: return 3500.0
|
||
case .brightCombo: return 3800.0
|
||
case .fullRange: return 4000.0
|
||
case .loFiBox: return 2400.0
|
||
}
|
||
}
|
||
|
||
/// Presence peak gain in dB.
|
||
var presenceGainDb: Double {
|
||
switch self {
|
||
case .americanCombo: return 3.0
|
||
case .britishStack: return 4.0
|
||
case .vintageDark: return 2.0
|
||
case .modernStack: return 5.0
|
||
case .boutiqueOpen: return 2.0
|
||
case .brightCombo: return 4.0
|
||
case .fullRange: return 1.0
|
||
case .loFiBox: return 1.0
|
||
}
|
||
}
|
||
|
||
/// Cone-"breakup" peak centre in Hz — the higher, narrower bite/clank a real driver adds as
|
||
/// the cone breaks up. Sits above the presence peak.
|
||
var breakupHz: Double {
|
||
switch self {
|
||
case .americanCombo: return 4200.0
|
||
case .britishStack: return 3800.0
|
||
case .vintageDark: return 3500.0
|
||
case .modernStack: return 4500.0
|
||
case .boutiqueOpen: return 5000.0
|
||
case .brightCombo: return 5200.0
|
||
case .fullRange: return 6000.0
|
||
case .loFiBox: return 2600.0
|
||
}
|
||
}
|
||
|
||
/// Cone-breakup peak gain in dB. Small; `0` disables the peak (identity).
|
||
var breakupGainDb: Double {
|
||
switch self {
|
||
case .americanCombo: return 2.0
|
||
case .britishStack: return 3.0
|
||
case .vintageDark: return 1.5
|
||
case .modernStack: return 3.0
|
||
case .boutiqueOpen: return 1.5
|
||
case .brightCombo: return 3.0
|
||
case .fullRange: return 0.5
|
||
case .loFiBox: return 2.0
|
||
}
|
||
}
|
||
|
||
/// Mid interference "notch" centre in Hz — the characteristic dip from cone/mic
|
||
/// comb-filtering, typically ~1.2–2.5 kHz.
|
||
var notchHz: Double {
|
||
switch self {
|
||
case .americanCombo: return 1800.0
|
||
case .britishStack: return 1600.0
|
||
case .vintageDark: return 1500.0
|
||
case .modernStack: return 1700.0
|
||
case .boutiqueOpen: return 2000.0
|
||
case .brightCombo: return 2100.0
|
||
case .fullRange: return 2000.0
|
||
case .loFiBox: return 1200.0
|
||
}
|
||
}
|
||
|
||
/// Notch depth in dB (negative). `0` disables the notch (identity).
|
||
var notchGainDb: Double {
|
||
switch self {
|
||
case .americanCombo: return -3.0
|
||
case .britishStack: return -4.0
|
||
case .vintageDark: return -2.5
|
||
case .modernStack: return -5.0
|
||
case .boutiqueOpen: return -2.0
|
||
case .brightCombo: return -2.0
|
||
case .fullRange: return 0.0
|
||
case .loFiBox: return -1.0
|
||
}
|
||
}
|
||
}
|