feat(amps): Chime Top Boost — full Vox-style control surface

Full-surface counterpart to the basic Chime voice, modeling the AC-style top-boost
combo. Reuses the AmpVoicePedal hooks:
- inputShaping: Brilliant switch (pre-preamp treble shelf, identity when off).
- onboardEffects: tremolo (Speed/Intensity), gated by a Tremolo footswitch. No
  onboard reverb (always outboard on these amps).
- shapeVoice: the Cut control (post-power-amp low-pass swept 9k→2.5k).

ChimeTopBoostAmpPedal (.vox): Gain/Bass/Mid/Treble + Cut/Speed/Intensity knobs,
Brilliant + Tremolo switches, Cab selector (defaults to Bright 1×12); widthUnits 3.
Registered across registry/type/category/palette/enclosure; Help acknowledgment
lists its tone stack. 10 tests (Cut, tremolo intensity/speed, brilliant, tremolo
footswitch bit-exact bypass, ceiling with FX, control surface, round-trip, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 09:18:17 -07:00
parent 17a0845225
commit 5d8e655dab
8 changed files with 288 additions and 3 deletions
+1
View File
@@ -49,6 +49,7 @@ public extension PedalType {
static let chime = PedalType("Chime")
static let fullertonReverb = PedalType("Fullerton Reverb")
static let jazzClean = PedalType("Jazz Clean")
static let chimeTopBoost = PedalType("Chime Top Boost")
static let neuralAmp = PedalType("Neural Amp")
static let overdrive = PedalType("Overdrive")
static let distortion = PedalType("Distortion")
@@ -0,0 +1,140 @@
// 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
/// Tremolo depth scaling — at full `intensity` the LFO swings over half the normalised range so
/// the peak gain is 1.0 and the trough is `1 − intensity`.
private let tremoloDepthScale: Double = 0.5
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
private let switchOffValue: Double = 0.0
private let switchOnValue: Double = 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),
]
}
/// Wider card for the extra Cut/tremolo knobs plus the Brilliant and Tremolo switches.
public override var widthUnits: Int { 3 }
// 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.0
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 {
// Footswitch gates depth to 0 → LFO is a constant 1.0 (identity). Unipolar sine over
// [1 − depth, 1]: peak gain 1.0, trough 1 − depth.
let depth: any ValidGeneratorInput = $intensity * $tremoloEnabled
let lfoScale: any ValidGeneratorInput = depth * tremoloDepthScale
let lfoOffset: any ValidGeneratorInput = 1.0 - (depth * tremoloDepthScale)
let lfo: OscSin.Audio = OscSin.Audio(freq: $speed, mul: lfoScale, add: lfoOffset)
return signal * lfo
}
/// 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)
}
}
@@ -36,6 +36,7 @@ public enum PedalRegistry {
"Chime": { ChimeAmpPedal() },
"Fullerton Reverb": { FullertonReverbAmpPedal() },
"Jazz Clean": { JazzCleanAmpPedal() },
"Chime Top Boost": { ChimeTopBoostAmpPedal() },
"Neural Amp": { NeuralAmpPedal() },
"Overdrive": { OverdrivePedal() },
"Distortion": { DistortionPedal() },
+1 -1
View File
@@ -178,7 +178,7 @@ public struct HelpView: View {
+ "built-in speaker impulse responses.",
"The Cabinet pedal's built-in cab voicings are original impulse responses generated in "
+ "code — not captures of any third-party hardware or IR pack.",
"The California, British, Chime, Fullerton Reverb, and Jazz Clean amp pedals' tone stacks "
"The California, British, Chime, Fullerton Reverb, Jazz Clean, and Chime Top Boost amp pedals' tone stacks "
+ "follow the Yeh & Smith analysis of the classic passive tone-stack circuit (\"Discretization "
+ "of the '59 Fender Bassman Tone Stack\", DAFx-06); their models are original code, not "
+ "captures of specific hardware.",
@@ -42,7 +42,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
}
private static let mapping: [String: PedalCategory] = [
"California": .gain, "British": .gain, "Chime": .gain, "Fullerton Reverb": .gain, "Jazz Clean": .gain, "Neural Amp": .gain, "Overdrive": .gain, "Distortion": .gain, "Fuzz": .gain, "Volume": .gain,
"California": .gain, "British": .gain, "Chime": .gain, "Fullerton Reverb": .gain, "Jazz Clean": .gain, "Chime Top Boost": .gain, "Neural Amp": .gain, "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,
"Cabinet": .filter,
@@ -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", "Chime", "Fullerton Reverb", "Jazz Clean", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"California", "British", "Chime", "Fullerton Reverb", "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",
@@ -22,6 +22,7 @@ private func enclosureColor(for displayName: String) -> Color {
case "Chime": return Color(red: 0.16, green: 0.24, blue: 0.22) // vintage green
case "Fullerton Reverb": return Color(red: 0.15, green: 0.22, blue: 0.30) // blackface panel
case "Jazz Clean": return Color(red: 0.14, green: 0.30, blue: 0.34) // solid-state silver-teal
case "Chime Top Boost": return Color(red: 0.20, green: 0.32, blue: 0.20) // vox-green tolex
case "Neural Amp": return Color(red: 0.22, green: 0.16, blue: 0.30) // deep neural violet
case "Overdrive": return Color(red: 0.85, green: 0.42, blue: 0.08) // warm orange
case "Distortion": return Color(red: 0.80, green: 0.26, blue: 0.12) // hot rust
@@ -0,0 +1,142 @@
// ChimeTopBoostAmpPedalTests.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("ChimeTopBoostAmpPedal")
struct ChimeTopBoostAmpPedalTests {
private let sampleRate: Double = 48000.0
private func render(configure: (ChimeTopBoostAmpPedal) -> 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: ChimeTopBoostAmpPedal = ChimeTopBoostAmpPedal(
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 samples: [Float] = try render()
#expect(!samples.isEmpty)
#expect(hasNonSilentOutput(samples), "Chime Top Boost produced silence")
#expect(samples.allSatisfy { $0.isFinite }, "Chime Top Boost produced non-finite output")
}
@Test func cutChangesOutput() throws {
let open: [Float] = try render { $0.cut = 0.0 }
let dark: [Float] = try render { $0.cut = 1.0 }
#expect(windowedSSD(open, dark) > 0, "Cut had no effect")
}
@Test func tremoloIntensityChangesOutput() throws {
let off: [Float] = try render { $0.intensity = 0.0 }
let on: [Float] = try render { $0.intensity = 1.0; $0.speed = 6.0 }
#expect(windowedSSD(off, on) > 0, "tremolo intensity had no effect")
}
@Test func tremoloSpeedChangesOutput() throws {
let slow: [Float] = try render { $0.intensity = 1.0; $0.speed = 1.0 }
let fast: [Float] = try render { $0.intensity = 1.0; $0.speed = 10.0 }
#expect(windowedSSD(slow, fast) > 0, "tremolo speed had no effect")
}
@Test func brilliantSwitchChangesOutput() throws {
let flat: [Float] = try render { $0.brilliant = 0.0 }
let bright: [Float] = try render { $0.brilliant = 1.0 }
#expect(windowedSSD(flat, bright) > 0, "brilliant switch had no effect")
}
@Test func tremoloFootswitchBypassesToIdentity() throws {
// Footswitch off with Intensity up must equal no tremolo (Intensity 0), and differ from on.
// The differing `speed` is harmless: with depth gated to 0 the LFO is a constant 1.0.
let bypassed: [Float] = try render { $0.intensity = 1.0; $0.speed = 6.0; $0.tremoloEnabled = 0.0 }
let noTremolo: [Float] = try render { $0.intensity = 0.0 }
#expect(windowedSSD(bypassed, noTremolo) == 0.0, "tremolo footswitch off should be identity")
let engaged: [Float] = try render { $0.intensity = 1.0; $0.speed = 6.0; $0.tremoloEnabled = 1.0 }
#expect(windowedSSD(bypassed, engaged) > 0, "tremolo footswitch had no effect")
}
@Test func outputStaysWithinCeilingWithFXEngaged() throws {
let ceilingEpsilon: Double = 1.0e-4
let hot: [Float] = try render { (pedal: ChimeTopBoostAmpPedal) in
pedal.gain = 30.0
pedal.bass = 1.0
pedal.treble = 1.0
pedal.brilliant = 1.0
pedal.intensity = 1.0
pedal.speed = 6.0
}
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
#expect(peak <= 1.0 + ceilingEpsilon, "peak \(peak) exceeds the ±1 ceiling")
#expect(peak > 0.3, "unexpectedly quiet at max gain: \(peak)")
}
@Test func exposesFullControlSurface() throws {
let pedal: ChimeTopBoostAmpPedal = ChimeTopBoostAmpPedal()
#expect(pedal.effectKnobs.map { $0.label }
== ["Gain", "Bass", "Mid", "Treble", "Cut", "Speed", "Intensity"])
#expect(pedal.effectSwitches.map { $0.label } == ["Brilliant", "Tremolo"])
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
#expect(pedal.effectSelectors.first?.rebuildsOnChange == true)
#expect(pedal.widthUnits == 3)
#expect(pedal.showsMixControl == false)
#expect(pedal.toneStackModel == .vox)
}
@Test func controlsRoundTripThroughState() throws {
let pedal: ChimeTopBoostAmpPedal = ChimeTopBoostAmpPedal()
pedal.gain = 7.0
pedal.cut = 0.6
pedal.speed = 9.0
pedal.intensity = 0.5
pedal.brilliant = 1.0
pedal.tremoloEnabled = 0.0
pedal.cab = 2.0
let restored: ChimeTopBoostAmpPedal = ChimeTopBoostAmpPedal()
restored.applyState(pedal.captureState())
#expect(restored.gain == 7.0)
#expect(restored.cut == 0.6)
#expect(restored.speed == 9.0)
#expect(restored.intensity == 0.5)
#expect(restored.brilliant == 1.0)
#expect(restored.tremoloEnabled == 0.0)
#expect(restored.cab == 2.0)
}
@Test func registeredInBuiltInRegistry() throws {
#expect(PedalRegistry.makePedal(type: "Chime Top Boost") is ChimeTopBoostAmpPedal)
}
}