292261a088
Follow-up cleanup now that card width is content-derived. Redefine widthUnits as the card's base width in knob columns (1 = 3-wide, 2 = 4-wide) — both the knob-grid column count and the card's minimum width — with selector/switch rows able to push wider. Values above 2 no longer do anything. - Delete the now-misleading widthUnits 3/4 overrides on 11 amps; they inherit AmpVoicePedal's 2 (all full-surface amps → the same tight 4-wide card). - Remove Mutant's redundant override (2 knobs + 2 switches → 3-wide either way). - Cabinet: keep widthUnits 2 so it's 4-wide like the amps — its Cab/Mic/Mic B selector captions (voice names) need the room to stay readable (per request). - Looper keeps widthUnits 3 (the one pedal still using the flat multiple for its bespoke timeline/knobs/transport layout). - Refresh the widthUnits docs (base + AmpVoicePedal + Cabinet); update the amp tests' widthUnits assertions (3/4 → 2; Looper stays 3). 675 tests pass; no visual change to the amps, Cabinet now matches their width. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
127 lines
5.5 KiB
Swift
127 lines
5.5 KiB
Swift
// ChimeTopBoostAmpPedal.swift
|
||
// Lyrebird
|
||
//
|
||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||
// SPDX-License-Identifier: MIT
|
||
|
||
import LyrebirdSynth
|
||
import LyrebirdUI
|
||
|
||
/// British-invasion "top boost" combo with a full control surface: the chimey top-boost EQ, a
|
||
/// **Cut** control that tames the highs, onboard **tremolo** (Speed / Intensity), and a
|
||
/// **Brilliant** switch — the jangly clean-to-edge-of-breakup voice.
|
||
///
|
||
/// A ``AmpVoicePedal`` fixed to the chime tone stack that fills both subclass hooks:
|
||
/// - ``inputShaping(_:)`` applies the Brilliant switch as a pre-preamp treble shelf.
|
||
/// - ``onboardEffects(_:)`` inserts the tremolo between the tone stack and the power amp.
|
||
///
|
||
/// Unlike the American blackface combo this amp has no built-in reverb (that was always outboard),
|
||
/// so the onboard-effects slot holds only the tremolo. Tremolo defaults off (`Intensity = 0`).
|
||
public final class ChimeTopBoostAmpPedal: AmpVoicePedal {
|
||
|
||
// MARK: - Signature / onboard-effect parameters
|
||
|
||
/// Cut amount in [0, 1]: `0` = fully open/bright, `1` = darkest (the top-boost "Cut" control,
|
||
/// which rolls off the highs as it's turned up).
|
||
@UIParam public var cut: Double = 0.2
|
||
/// Tremolo LFO rate in Hz. Range [0.5, 12].
|
||
@UIParam public var speed: Double = 4.0
|
||
/// Tremolo depth in [0, 1]. `0` = off, `1` = full swing.
|
||
@UIParam public var intensity: Double = 0.0
|
||
/// Brilliant switch: `0` = flat, `1` = treble shelf engaged (the brilliant/top-boost sparkle).
|
||
@UIParam public var brilliant: Double = 0.0
|
||
/// Tremolo footswitch: `1` = engaged, `0` = bypassed (`Speed`/`Intensity` preserved).
|
||
@UIParam public var tremoloEnabled: Double = 1.0
|
||
|
||
// MARK: - Constants
|
||
|
||
/// Cut low-pass cutoff when fully open (`cut = 0`), in Hz.
|
||
private let cutOpenHz: Double = 9000.0
|
||
/// Cut low-pass cutoff when fully dark (`cut = 1`), in Hz.
|
||
private let cutDarkHz: Double = 2500.0
|
||
/// Cut low-pass Q (Butterworth).
|
||
private let cutQ: Double = 0.707
|
||
/// Brilliant-switch shelf corner in Hz.
|
||
private let brilliantFreqHz: Double = 4000.0
|
||
/// Brilliant-switch shelf lift in dB when engaged.
|
||
private let brilliantMaxGainDb: Double = 6.0
|
||
/// Brilliant-switch shelf slope.
|
||
private let brilliantSlope: Double = 0.7
|
||
private let cutRange: ClosedRange<Double> = 0.0 ... 1.0
|
||
private let speedRange: ClosedRange<Double> = 0.5 ... 12.0
|
||
private let intensityRange: ClosedRange<Double> = 0.0 ... 1.0
|
||
|
||
// MARK: - Voice configuration
|
||
|
||
public override var toneStackModel: ToneStackModel { .vox }
|
||
public override var summaryText: String {
|
||
"Chimey top-boost jangle — Cut control, tremolo, and a Brilliant switch."
|
||
}
|
||
public override var signatureKnobs: [PedalKnob] {
|
||
[
|
||
PedalKnob(label: "Cut", node: $cut, range: cutRange),
|
||
PedalKnob(label: "Speed", node: $speed, range: speedRange),
|
||
PedalKnob(label: "Intensity", node: $intensity, range: intensityRange),
|
||
]
|
||
}
|
||
|
||
// MARK: - Init
|
||
|
||
/// Creates a Chime Top Boost 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: "Chime Top Boost", inputBus: inputBus, outputBus: outputBus)
|
||
gain = 5.73
|
||
cab = 5.0 // Bright 1×12 — the chimey, top-end-forward cab voice
|
||
}
|
||
|
||
// MARK: - Switches
|
||
|
||
public override var effectSwitches: [PedalSwitch] {
|
||
[
|
||
PedalSwitch(
|
||
label: "Brilliant",
|
||
node: $brilliant,
|
||
options: [
|
||
PedalSwitch.Option(title: "Off", value: switchOffValue),
|
||
PedalSwitch.Option(title: "On", value: switchOnValue),
|
||
]
|
||
),
|
||
PedalSwitch(
|
||
label: "Tremolo",
|
||
node: $tremoloEnabled,
|
||
options: [
|
||
PedalSwitch.Option(title: "Off", value: switchOffValue),
|
||
PedalSwitch.Option(title: "On", value: switchOnValue),
|
||
]
|
||
),
|
||
]
|
||
}
|
||
|
||
// MARK: - Hooks
|
||
|
||
/// Brilliant 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 = $brilliant * brilliantMaxGainDb
|
||
return RBJHighShelf.Audio(
|
||
input: signal, freq: brilliantFreqHz, gain: shelfGainDb, slope: brilliantSlope)
|
||
}
|
||
|
||
/// Tremolo (gated by the Tremolo footswitch), inserted after the tone stack. No onboard reverb.
|
||
public override func onboardEffects(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||
// Tremolo gated by the Tremolo footswitch (identity when depth·enabled == 0).
|
||
tremolo(signal, speed: $speed, depth: $intensity, enabled: $tremoloEnabled)
|
||
}
|
||
|
||
/// Cut control: a low-pass whose cutoff sweeps from `cutOpenHz` (bright) down to `cutDarkHz`
|
||
/// (dark) as `cut` rises — the top-boost "Cut" behaviour, applied post-power-amp.
|
||
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||
let cutoff: LinLin.Audio = LinLin.Audio(
|
||
$cut, inLo: 0.0, inHi: 1.0, outLo: cutOpenHz, outHi: cutDarkHz)
|
||
return RBJLowPass.Audio(input: signal, freq: cutoff, q: cutQ)
|
||
}
|
||
}
|