feat(amps): Vox variants — Chime 15 / Normal / Baby (Phase 3)

Make ChimeAmpPedal open with a convenience init, then derive three AC-style Vox
voices that inherit its Cut control + .vox tone stack and differ by voicing:

- Chime 15 — 1×12 EL84 combo: power-amp drive 2.0 (earlier breakup), Bright cab,
  gain 6.
- Chime Normal — AC30 non-top-boost channel: warmer/rounder (treble 0.5, more
  Cut), American cab, base headroom.
- Chime Baby — tiny practice combo: drive 2.5 (breaks up earliest), Lo-Fi 1×8
  cab, less bass.

Chime 15 / Baby override powerAmpDriveInput (fixed higher drive) + oversample 4;
Normal keeps the base. Registered across all 6 sites as .amp. 8 tests (Cut per
voice, inherited surface/.vox, breakup oversample, voices differ, ceiling,
round-trip, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-03 12:45:09 -07:00
parent 415e99dd62
commit 818478ce1b
10 changed files with 253 additions and 6 deletions
+3
View File
@@ -50,6 +50,9 @@ public extension PedalType {
static let britishJTM = PedalType("British JTM")
static let britishBluesbreaker = PedalType("British Bluesbreaker")
static let chime = PedalType("Chime")
static let chimeFifteen = PedalType("Chime 15")
static let chimeNormal = PedalType("Chime Normal")
static let chimeBaby = PedalType("Chime Baby")
static let fullertonReverb = PedalType("Fullerton Reverb")
static let fullertonDeluxe = PedalType("Fullerton Deluxe")
static let fullertonPrinceton = PedalType("Fullerton Princeton")
@@ -10,8 +10,10 @@ import LyrebirdUI
/// Chimey/jangly amp (bell-like top boost) with a **Cut** control that rolls off the high end as
/// it's turned up — the classic top-boost "Cut" behavior.
///
/// A ``AmpVoicePedal`` fixed to the chime tone stack.
public final class ChimeAmpPedal: AmpVoicePedal {
/// A ``AmpVoicePedal`` fixed to the chime tone stack. The base of the Vox-voiced family — the
/// AC-style variants (Chime 15 / Chime Normal / Chime Baby) subclass it and differ by gain, cab,
/// tone defaults, and power-amp breakup.
open class ChimeAmpPedal: AmpVoicePedal {
/// Cut amount in [0, 1]: `0` = fully open/bright, `1` = darkest. Maps to a low-pass cutoff
/// swept from `cutOpenHz` down to `cutDarkHz`.
@@ -34,8 +36,10 @@ public final class ChimeAmpPedal: AmpVoicePedal {
/// - 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", inputBus: inputBus, outputBus: outputBus)
/// The AC-style variants call the inherited `AmpVoicePedal.init(name:inputBus:outputBus:)` to set
/// their own name while inheriting the shared Cut voice.
public convenience init(inputBus: Int = 0, outputBus: Int = 0) {
self.init(name: "Chime", inputBus: inputBus, outputBus: outputBus)
gain = 5.0
}
@@ -0,0 +1,38 @@
// ChimeBabyAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Vox-voiced **practice combo** — the tiny AC4/AC10-style amp: low headroom, a small boxy
/// speaker, and the earliest breakup of the chime family.
///
/// A ``ChimeAmpPedal`` (Cut voice) driven hardest into the power stage, with the small lo-fi cab.
public final class ChimeBabyAmpPedal: ChimeAmpPedal {
/// Power-amp drive — the highest of the chime family, so it breaks up earliest.
private let babyPowerDrive: Double = 2.5
public override var summaryText: String {
"Vox practice combo — tiny, boxy, earliest-breakup chime with a Cut control."
}
/// Driven hardest of the chime family, so 4× oversampling for anti-alias headroom.
public override var powerAmpOversample: Int { 4 }
public override var powerAmpDriveInput: any ValidGeneratorInput { babyPowerDrive }
/// Creates a Chime Baby 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 Baby", inputBus: inputBus, outputBus: outputBus)
gain = 6.0
bass = 0.4 // small speaker, less low end
cab = 7.0 // Lo-Fi 1×8 — the small, boxy voice
}
}
@@ -0,0 +1,37 @@
// ChimeFifteenAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Vox-voiced **1×12 EL84 combo** — the lower-powered, earlier-breakup sibling of the AC top-boost
/// voice. Chimey but grittier: the small power section saturates sooner.
///
/// A ``ChimeAmpPedal`` (Cut voice) with a higher fixed power-amp drive and a bright cab.
public final class ChimeFifteenAmpPedal: ChimeAmpPedal {
/// Power-amp drive — higher than the base's fixed `1.5` so the EL84 stage breaks up earlier.
private let fifteenPowerDrive: Double = 2.0
public override var summaryText: String {
"Vox 1×12 EL84 combo — chimey but earlier-breakup, with a Cut control."
}
/// Driven harder than the base, so 4× oversampling for anti-alias headroom.
public override var powerAmpOversample: Int { 4 }
public override var powerAmpDriveInput: any ValidGeneratorInput { fifteenPowerDrive }
/// Creates a Chime 15 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 15", inputBus: inputBus, outputBus: outputBus)
gain = 6.0 // grittier starting point than the big AC voice
cab = 5.0 // Bright 1×12
}
}
@@ -0,0 +1,33 @@
// ChimeNormalAmpPedal.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
import LyrebirdUI
/// Vox-voiced **Normal channel** — the AC30's non-top-boost side: warmer and rounder than the
/// bright top-boost voice, with the same high clean headroom.
///
/// A ``ChimeAmpPedal`` (Cut voice) voiced darker (lower treble default, a touch more Cut) to stand
/// in for the plainer Normal-channel EQ.
public final class ChimeNormalAmpPedal: ChimeAmpPedal {
public override var summaryText: String {
"Vox Normal channel — warm, round, high-headroom chime with a Cut control."
}
/// Creates a Chime Normal 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 Normal", inputBus: inputBus, outputBus: outputBus)
gain = 5.0
treble = 0.5 // rounder top than the top-boost voice
cut = 0.3 // a shade darker by default
cab = 0.0 // American 1×12 — plainer than the bright cab
}
}
@@ -37,6 +37,9 @@ public enum PedalRegistry {
"British JTM": { BritishJTMAmpPedal() },
"British Bluesbreaker": { BritishBluesbreakerAmpPedal() },
"Chime": { ChimeAmpPedal() },
"Chime 15": { ChimeFifteenAmpPedal() },
"Chime Normal": { ChimeNormalAmpPedal() },
"Chime Baby": { ChimeBabyAmpPedal() },
"Fullerton Reverb": { FullertonReverbAmpPedal() },
"Fullerton Deluxe": { FullertonDeluxeAmpPedal() },
"Fullerton Princeton": { FullertonPrincetonAmpPedal() },
@@ -44,7 +44,7 @@ public enum PedalCategory: String, CaseIterable, Identifiable, Sendable {
}
private static let mapping: [String: PedalCategory] = [
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "Chime": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
"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,
@@ -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", "British Plexi", "British JTM", "British Bluesbreaker", "Chime", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Jazz Clean", "Chime Top Boost", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
"California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "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",
@@ -23,6 +23,9 @@ private func enclosureColor(for displayName: String) -> Color {
case "British JTM": return Color(red: 0.36, green: 0.24, blue: 0.12) // warm JTM bronze
case "British Bluesbreaker": return Color(red: 0.28, green: 0.22, blue: 0.12) // bluesbreaker tan
case "Chime": return Color(red: 0.16, green: 0.24, blue: 0.22) // vintage green
case "Chime 15": return Color(red: 0.18, green: 0.28, blue: 0.22) // brighter vox green
case "Chime Normal": return Color(red: 0.20, green: 0.26, blue: 0.20) // warm vox green
case "Chime Baby": return Color(red: 0.22, green: 0.30, blue: 0.24) // pale vox green
case "Fullerton Reverb": return Color(red: 0.15, green: 0.22, blue: 0.30) // blackface panel
case "Fullerton Deluxe": return Color(red: 0.17, green: 0.20, blue: 0.26) // blackface, warmer
case "Fullerton Princeton": return Color(red: 0.19, green: 0.19, blue: 0.23) // small blackface
@@ -0,0 +1,126 @@
// ChimeVariantsTests.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("Chime Vox variants")
struct ChimeVariantsTests {
private let sampleRate: Double = 48000.0
private func render<P: AmpVoicePedal>(_ make: () -> P, configure: (P) -> 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: P = make()
pedal.inputBus = srcBus.index
pedal.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
}
}
private let variants: [(name: String, make: () -> ChimeAmpPedal)] = [
("Chime 15", { ChimeFifteenAmpPedal() }),
("Chime Normal", { ChimeNormalAmpPedal() }),
("Chime Baby", { ChimeBabyAmpPedal() }),
]
@Test func allBuildNonSilentFinite() throws {
for v: (name: String, make: () -> ChimeAmpPedal) in variants {
let s: [Float] = try render(v.make)
#expect(hasNonSilentOutput(s), "\(v.name) produced silence")
#expect(s.allSatisfy { $0.isFinite }, "\(v.name) produced non-finite output")
}
}
@Test func cutChangesOutput() throws {
for v: (name: String, make: () -> ChimeAmpPedal) in variants {
let open: [Float] = try render(v.make) { $0.cut = 0.0 }
let dark: [Float] = try render(v.make) { $0.cut = 1.0 }
#expect(windowedSSD(open, dark) > 0, "\(v.name) Cut had no effect")
}
}
@Test func inheritCutSurfaceAndVoxStack() throws {
for v: (name: String, make: () -> ChimeAmpPedal) in variants {
let pedal: ChimeAmpPedal = v.make()
#expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Cut"], "\(v.name) knobs")
#expect(pedal.toneStackModel == .vox, "\(v.name) tone stack")
}
}
@Test func breakupVariantsOversampleAtFour() throws {
// Chime 15 and Chime Baby drive the power amp harder → 4× oversample; Normal keeps the base.
#expect(ChimeFifteenAmpPedal().powerAmpOversample == 4)
#expect(ChimeBabyAmpPedal().powerAmpOversample == 4)
#expect(ChimeNormalAmpPedal().powerAmpOversample == 2)
}
@Test func variantsDifferFromEachOther() throws {
let cfg: (ChimeAmpPedal) -> Void = { $0.gain = 6.0; $0.cut = 0.2 }
let fifteen: [Float] = try render({ ChimeFifteenAmpPedal() }, configure: cfg)
let normal: [Float] = try render({ ChimeNormalAmpPedal() }, configure: cfg)
let baby: [Float] = try render({ ChimeBabyAmpPedal() }, configure: cfg)
#expect(windowedSSD(fifteen, normal) > 0, "Chime 15 and Normal should voice differently")
#expect(windowedSSD(normal, baby) > 0, "Chime Normal and Baby should voice differently")
}
@Test func stayWithinCeilingAtMaxGain() throws {
let ceilingEpsilon: Double = 1.0e-4
for v: (name: String, make: () -> ChimeAmpPedal) in variants {
let hot: [Float] = try render(v.make) { (pedal: ChimeAmpPedal) in
pedal.gain = 30.0
pedal.bass = 1.0
pedal.treble = 1.0
pedal.cut = 0.0
}
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
#expect(peak <= 1.0 + ceilingEpsilon, "\(v.name) peak \(peak) exceeds the ±1 ceiling")
}
}
@Test func cutRoundTripsThroughState() throws {
let pedal: ChimeBabyAmpPedal = ChimeBabyAmpPedal()
pedal.cut = 0.7
pedal.cab = 3.0
let restored: ChimeBabyAmpPedal = ChimeBabyAmpPedal()
restored.applyState(pedal.captureState())
#expect(restored.cut == 0.7 && restored.cab == 3.0, "Chime Baby state did not round-trip")
}
@Test func registeredInBuiltInRegistry() throws {
#expect(PedalRegistry.makePedal(type: "Chime 15") is ChimeFifteenAmpPedal)
#expect(PedalRegistry.makePedal(type: "Chime Normal") is ChimeNormalAmpPedal)
#expect(PedalRegistry.makePedal(type: "Chime Baby") is ChimeBabyAmpPedal)
}
}