feat(amps): boutique high-gain — Boutique Lead / OD (Phase 6)
Add a shared BoutiqueAmpPedal base: a rebuildsOnChange Clean/Lead channel switch (Lead cascades a stage set by Drive), a Master (via masterDrive), and Presence (top-end high-shelf) + Depth (low-end low-shelf, RBJLowShelf) power-amp shaping; widthUnits 4, 4× power-amp oversample. - Boutique Lead — SLO-style aggressive super-lead (.marshall, hot Lead drive). - Boutique OD — D-style smooth overdrive (.fender) with a Mid Boost switch (RBJPeakingEQ peak scaled by the switch, identity when off) layered on the base Presence/Depth shaping. Registered across 6 sites as .amp. 10 tests (channel switch + rebuildsOnChange, presence/depth, master drives power amp via RMS-normalized SSD, drive, ceiling on lead channel, control surfaces, OD mid boost, round-trip, registry). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -51,6 +51,8 @@ public extension PedalType {
|
||||
static let britishBluesbreaker = PedalType("British Bluesbreaker")
|
||||
static let britishMaster = PedalType("British Master")
|
||||
static let britishDual = PedalType("British Dual")
|
||||
static let boutiqueLead = PedalType("Boutique Lead")
|
||||
static let boutiqueOD = PedalType("Boutique OD")
|
||||
static let chime = PedalType("Chime")
|
||||
static let chimeFifteen = PedalType("Chime 15")
|
||||
static let chimeNormal = PedalType("Chime Normal")
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
// BoutiqueAmpPedal.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
|
||||
/// Shared base for the boutique high-gain amps (Boutique Lead / Boutique OD) — a footswitchable
|
||||
/// Clean/Lead channel into a master-volume power section, with **Presence** (top-end) and **Depth**
|
||||
/// (low-end resonance) shaping.
|
||||
///
|
||||
/// The Lead channel cascades a second gain stage (set by `Drive`) via ``preampStage(_:)`` — a
|
||||
/// `rebuildsOnChange` **Channel** switch, so only the selected channel is built. `Master` drives the
|
||||
/// power-amp stage via ``AmpVoicePedal/masterDrive(_:minDrive:maxDrive:)``. Concrete voices override
|
||||
/// ``AmpVoicePedal/toneStackModel`` and gain defaults, and may extend the shaping (e.g. a mid boost).
|
||||
open class BoutiqueAmpPedal: AmpVoicePedal {
|
||||
|
||||
/// Presence amount in [0, 1] → 0…`presenceMaxGainDb` of top-end lift.
|
||||
@UIParam public var presence: Double = 0.4
|
||||
/// Depth amount in [0, 1] → 0…`depthMaxGainDb` of low-end resonance lift.
|
||||
@UIParam public var depth: Double = 0.3
|
||||
/// Master volume in [0, 1] → power-amp drive in [`masterMinDrive`, `masterMaxDrive`].
|
||||
@UIParam public var master: Double = 0.5
|
||||
/// Lead-channel preamp gain (the cascaded stage). Range [1, 30].
|
||||
@UIParam public var drive: Double = 10.0
|
||||
/// Channel select: `0` = Clean, `1` = Lead (the cascaded gain stage).
|
||||
@UIParam public var channel: Double = 0.0
|
||||
|
||||
private let presenceFreqHz: Double = 4500.0
|
||||
private let presenceMaxGainDb: Double = 8.0
|
||||
private let presenceSlope: Double = 0.7
|
||||
private let depthFreqHz: Double = 120.0
|
||||
private let depthMaxGainDb: Double = 6.0
|
||||
private let depthSlope: Double = 0.7
|
||||
private let masterMinDrive: Double = 0.5
|
||||
private let masterMaxDrive: Double = 5.0
|
||||
/// Grid bias of the cascaded lead stage — a little asymmetry for even-harmonic grind.
|
||||
let leadBias: Double = 0.15
|
||||
private let channelThreshold: Double = 0.5
|
||||
|
||||
let signatureAmount: ClosedRange<Double> = 0.0 ... 1.0
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 30.0
|
||||
let switchOffValue: Double = 0.0
|
||||
let switchOnValue: Double = 1.0
|
||||
|
||||
public override var toneStackModel: ToneStackModel { .marshall }
|
||||
public override var signatureKnobs: [PedalKnob] {
|
||||
[
|
||||
PedalKnob(label: "Presence", node: $presence, range: signatureAmount),
|
||||
PedalKnob(label: "Depth", node: $depth, range: signatureAmount),
|
||||
PedalKnob(label: "Master", node: $master, range: signatureAmount),
|
||||
PedalKnob(label: "Drive", node: $drive, range: driveRange),
|
||||
]
|
||||
}
|
||||
|
||||
public override var effectSwitches: [PedalSwitch] {
|
||||
[
|
||||
PedalSwitch(
|
||||
label: "Channel",
|
||||
node: $channel,
|
||||
options: [
|
||||
PedalSwitch.Option(title: "Clean", value: switchOffValue),
|
||||
PedalSwitch.Option(title: "Lead", value: switchOnValue),
|
||||
],
|
||||
rebuildsOnChange: true
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
/// Master drives the power-amp stage. 4× oversampling since it can be driven hard.
|
||||
public override var powerAmpDriveInput: any ValidGeneratorInput {
|
||||
masterDrive($master, minDrive: masterMinDrive, maxDrive: masterMaxDrive)
|
||||
}
|
||||
public override var powerAmpOversample: Int { 4 }
|
||||
|
||||
/// Wider card for the Presence/Depth/Master/Drive knobs plus the Channel switch.
|
||||
public override var widthUnits: Int { 4 }
|
||||
|
||||
/// Clean preamp, plus a cascaded lead stage on the Lead channel. `channel` is read at
|
||||
/// board-build time (the switch is `rebuildsOnChange`), so only the selected channel is built.
|
||||
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
let clean: any ValidGeneratorInput = super.preampStage(signal)
|
||||
guard channel >= channelThreshold else { return clean }
|
||||
return TriodeStage(input: clean, drive: $drive, bias: leadBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
/// Presence (top-end high-shelf) then Depth (low-end low-shelf), post power amp.
|
||||
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
let presenceGainDb: LinLin.Audio = LinLin.Audio(
|
||||
$presence, inLo: 0.0, inHi: 1.0, outLo: 0.0, outHi: presenceMaxGainDb)
|
||||
let presenced: RBJHighShelf.Audio = RBJHighShelf.Audio(
|
||||
input: signal, freq: presenceFreqHz, gain: presenceGainDb, slope: presenceSlope)
|
||||
let depthGainDb: LinLin.Audio = LinLin.Audio(
|
||||
$depth, inLo: 0.0, inHi: 1.0, outLo: 0.0, outHi: depthMaxGainDb)
|
||||
return RBJLowShelf.Audio(
|
||||
input: presenced, freq: depthFreqHz, gain: depthGainDb, slope: depthSlope)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// BoutiqueLeadAmpPedal.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
|
||||
/// Boutique **super-lead** — the SLO-style high-gain singing lead: aggressive cascaded overdrive on
|
||||
/// the Lead channel, a Master volume, and Presence / Depth power-amp shaping.
|
||||
///
|
||||
/// A ``BoutiqueAmpPedal`` fixed to the aggressive British tone stack, defaulting to a hot Lead drive.
|
||||
public final class BoutiqueLeadAmpPedal: BoutiqueAmpPedal {
|
||||
|
||||
public override var toneStackModel: ToneStackModel { .marshall }
|
||||
public override var summaryText: String {
|
||||
"Boutique super-lead — aggressive cascaded high gain with Master, Presence, and Depth."
|
||||
}
|
||||
|
||||
/// Creates a Boutique Lead 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: "Boutique Lead", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 6.0
|
||||
drive = 14.0 // hot singing lead
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// BoutiqueODAmpPedal.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdUI
|
||||
|
||||
/// Boutique **overdrive special** — the smooth D-style voice: a Fender-derived clean plus a fluid
|
||||
/// overdrive channel, a **Mid Boost** switch, a Master volume, and Presence / Depth shaping.
|
||||
///
|
||||
/// A ``BoutiqueAmpPedal`` on the smoother American tone stack. The Mid Boost adds a midrange peak
|
||||
/// (the D-style "PAB" character) on top of the base Presence/Depth shaping.
|
||||
public final class BoutiqueODAmpPedal: BoutiqueAmpPedal {
|
||||
|
||||
/// Mid Boost switch: `0` = flat, `1` = midrange peak engaged.
|
||||
@UIParam public var midBoost: Double = 0.0
|
||||
|
||||
private let midBoostFreqHz: Double = 650.0
|
||||
private let midBoostMaxGainDb: Double = 6.0
|
||||
private let midBoostQ: Double = 1.0
|
||||
|
||||
public override var toneStackModel: ToneStackModel { .fender }
|
||||
public override var summaryText: String {
|
||||
"Boutique overdrive special — smooth D-style OD with a Mid Boost, Master, Presence, and Depth."
|
||||
}
|
||||
|
||||
/// Base Channel switch plus the Mid Boost switch (compose `super`).
|
||||
public override var effectSwitches: [PedalSwitch] {
|
||||
super.effectSwitches + [
|
||||
PedalSwitch(
|
||||
label: "Mid Boost",
|
||||
node: $midBoost,
|
||||
options: [
|
||||
PedalSwitch.Option(title: "Off", value: switchOffValue),
|
||||
PedalSwitch.Option(title: "On", value: switchOnValue),
|
||||
]
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
/// Creates a Boutique OD 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: "Boutique OD", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 5.0
|
||||
drive = 10.0
|
||||
cab = 0.0 // American 1×12
|
||||
}
|
||||
|
||||
/// The base Presence/Depth shaping, plus a Mid Boost peak when the switch is engaged (its gain
|
||||
/// scales by the switch value, so Off is a true identity, live, no rebuild).
|
||||
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
let shaped: any ValidGeneratorInput = super.shapeVoice(signal)
|
||||
let midGainDb: any ValidGeneratorInput = $midBoost * midBoostMaxGainDb
|
||||
return RBJPeakingEQ.Audio(input: shaped, freq: midBoostFreqHz, gain: midGainDb, q: midBoostQ)
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,8 @@ public enum PedalRegistry {
|
||||
"British Bluesbreaker": { BritishBluesbreakerAmpPedal() },
|
||||
"British Master": { BritishMasterAmpPedal() },
|
||||
"British Dual": { BritishDualAmpPedal() },
|
||||
"Boutique Lead": { BoutiqueLeadAmpPedal() },
|
||||
"Boutique OD": { BoutiqueODAmpPedal() },
|
||||
"Chime": { ChimeAmpPedal() },
|
||||
"Chime 15": { ChimeFifteenAmpPedal() },
|
||||
"Chime Normal": { ChimeNormalAmpPedal() },
|
||||
|
||||
@@ -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, "British Master": .amp, "British Dual": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Fullerton Drive": .amp, "Jazz Clean": .amp, "Chime Top Boost": .amp, "Neural Amp": .amp,
|
||||
"California": .amp, "British": .amp, "British Plexi": .amp, "British JTM": .amp, "British Bluesbreaker": .amp, "British Master": .amp, "British Dual": .amp, "Boutique Lead": .amp, "Boutique OD": .amp, "Chime": .amp, "Chime 15": .amp, "Chime Normal": .amp, "Chime Baby": .amp, "Fullerton Reverb": .amp, "Fullerton Deluxe": .amp, "Fullerton Princeton": .amp, "Fullerton Drive": .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", "British Master", "British Dual", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Fullerton Drive", "Jazz Clean", "Chime Top Boost", "Neural Amp", "Overdrive", "Distortion", "Compressor", "Sustainer", "Limiter", "Noise Gate", "Fuzz",
|
||||
"California", "British", "British Plexi", "British JTM", "British Bluesbreaker", "British Master", "British Dual", "Boutique Lead", "Boutique OD", "Chime", "Chime 15", "Chime Normal", "Chime Baby", "Fullerton Reverb", "Fullerton Deluxe", "Fullerton Princeton", "Fullerton Drive", "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",
|
||||
|
||||
@@ -24,6 +24,8 @@ private func enclosureColor(for displayName: String) -> Color {
|
||||
case "British Bluesbreaker": return Color(red: 0.28, green: 0.22, blue: 0.12) // bluesbreaker tan
|
||||
case "British Master": return Color(red: 0.26, green: 0.14, blue: 0.09) // hot-rodded oxblood
|
||||
case "British Dual": return Color(red: 0.24, green: 0.13, blue: 0.11) // modern high-gain
|
||||
case "Boutique Lead": return Color(red: 0.28, green: 0.12, blue: 0.16) // boutique oxblood
|
||||
case "Boutique OD": return Color(red: 0.30, green: 0.20, blue: 0.10) // D-style amber
|
||||
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
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
// BoutiqueAmpPedalTests.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("Boutique high-gain amps")
|
||||
struct BoutiqueAmpPedalTests {
|
||||
|
||||
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 func rmsNormalizedSSD(_ a: [Float], _ b: [Float], skip: Int = 4096, window: Int = 4096) -> Double {
|
||||
guard a.count >= skip + window, b.count >= skip + window else { return 0.0 }
|
||||
let aw: ArraySlice<Float> = a[skip..<(skip + window)]
|
||||
let bw: ArraySlice<Float> = b[skip..<(skip + window)]
|
||||
func rms(_ x: ArraySlice<Float>) -> Double {
|
||||
let sumSq: Double = x.reduce(0.0) { $0 + Double($1) * Double($1) }
|
||||
return (sumSq / Double(x.count)).squareRoot()
|
||||
}
|
||||
let ra: Double = rms(aw)
|
||||
let rb: Double = rms(bw)
|
||||
guard ra > 0.0, rb > 0.0 else { return 0.0 }
|
||||
return zip(aw, bw).reduce(0.0) { acc, pair in
|
||||
let d: Double = Double(pair.0) / ra - Double(pair.1) / rb
|
||||
return acc + d * d
|
||||
}
|
||||
}
|
||||
|
||||
private func peak(_ s: [Float]) -> Double { s.reduce(0.0) { Swift.max($0, abs(Double($1))) } }
|
||||
|
||||
private let voices: [(name: String, make: () -> BoutiqueAmpPedal)] = [
|
||||
("Boutique Lead", { BoutiqueLeadAmpPedal() }),
|
||||
("Boutique OD", { BoutiqueODAmpPedal() }),
|
||||
]
|
||||
|
||||
@Test func allBuildNonSilentFinite() throws {
|
||||
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
|
||||
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 channelSwitchChangesOutputAndRebuilds() throws {
|
||||
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
|
||||
let clean: [Float] = try render(v.make) { $0.channel = 0.0 }
|
||||
let lead: [Float] = try render(v.make) { $0.channel = 1.0; $0.drive = 18.0 }
|
||||
#expect(windowedSSD(clean, lead) > 0, "\(v.name) channel switch had no effect")
|
||||
let channel: PedalSwitch? = v.make().effectSwitches.first { $0.label == "Channel" }
|
||||
#expect(channel?.rebuildsOnChange == true, "\(v.name) Channel should rebuild on change")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func presenceAndDepthChangeOutput() throws {
|
||||
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
|
||||
let pLow: [Float] = try render(v.make) { $0.presence = 0.0 }
|
||||
let pHigh: [Float] = try render(v.make) { $0.presence = 1.0 }
|
||||
#expect(windowedSSD(pLow, pHigh) > 0, "\(v.name) Presence had no effect")
|
||||
let dLow: [Float] = try render(v.make) { $0.depth = 0.0 }
|
||||
let dHigh: [Float] = try render(v.make) { $0.depth = 1.0 }
|
||||
#expect(windowedSSD(dLow, dHigh) > 0, "\(v.name) Depth had no effect")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func masterDrivesPowerAmp() throws {
|
||||
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
|
||||
let low: [Float] = try render(v.make) { $0.gain = 8.0; $0.master = 0.1 }
|
||||
let high: [Float] = try render(v.make) { $0.gain = 8.0; $0.master = 1.0 }
|
||||
#expect(rmsNormalizedSSD(low, high) > 1.0e-3, "\(v.name) Master changed level but not tone")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func driveKnobChangesLeadChannel() throws {
|
||||
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
|
||||
let low: [Float] = try render(v.make) { $0.channel = 1.0; $0.drive = 2.0 }
|
||||
let high: [Float] = try render(v.make) { $0.channel = 1.0; $0.drive = 25.0 }
|
||||
#expect(windowedSSD(low, high) > 0, "\(v.name) Drive had no effect on the lead channel")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func stayWithinCeilingOnLeadChannel() throws {
|
||||
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
|
||||
let hot: [Float] = try render(v.make) { (p: BoutiqueAmpPedal) in
|
||||
p.gain = 30.0; p.bass = 1.0; p.treble = 1.0
|
||||
p.presence = 1.0; p.depth = 1.0; p.master = 1.0; p.channel = 1.0; p.drive = 30.0
|
||||
}
|
||||
#expect(peak(hot) <= 1.0 + 1.0e-4, "\(v.name) exceeds the ±1 ceiling on the lead channel")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func exposesControlSurfaces() throws {
|
||||
let lead: BoutiqueLeadAmpPedal = BoutiqueLeadAmpPedal()
|
||||
#expect(lead.effectKnobs.map { $0.label }
|
||||
== ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"])
|
||||
#expect(lead.effectSwitches.map { $0.label } == ["Channel"])
|
||||
#expect(lead.widthUnits == 4)
|
||||
#expect(lead.toneStackModel == .marshall)
|
||||
#expect(lead.powerAmpOversample == 4)
|
||||
|
||||
let od: BoutiqueODAmpPedal = BoutiqueODAmpPedal()
|
||||
#expect(od.effectSwitches.map { $0.label } == ["Channel", "Mid Boost"])
|
||||
#expect(od.toneStackModel == .fender)
|
||||
}
|
||||
|
||||
@Test func odMidBoostChangesOutput() throws {
|
||||
let flat: [Float] = try render({ BoutiqueODAmpPedal() }) { $0.midBoost = 0.0 }
|
||||
let boosted: [Float] = try render({ BoutiqueODAmpPedal() }) { $0.midBoost = 1.0 }
|
||||
#expect(windowedSSD(flat, boosted) > 0, "Mid Boost had no effect")
|
||||
}
|
||||
|
||||
@Test func roundTripsThroughState() throws {
|
||||
let pedal: BoutiqueODAmpPedal = BoutiqueODAmpPedal()
|
||||
pedal.presence = 0.6; pedal.depth = 0.7; pedal.master = 0.8; pedal.drive = 12.0
|
||||
pedal.channel = 1.0; pedal.midBoost = 1.0; pedal.cab = 2.0
|
||||
let restored: BoutiqueODAmpPedal = BoutiqueODAmpPedal()
|
||||
restored.applyState(pedal.captureState())
|
||||
#expect(restored.presence == 0.6 && restored.depth == 0.7 && restored.master == 0.8)
|
||||
#expect(restored.drive == 12.0 && restored.channel == 1.0 && restored.midBoost == 1.0 && restored.cab == 2.0)
|
||||
}
|
||||
|
||||
@Test func registeredInBuiltInRegistry() throws {
|
||||
#expect(PedalRegistry.makePedal(type: "Boutique Lead") is BoutiqueLeadAmpPedal)
|
||||
#expect(PedalRegistry.makePedal(type: "Boutique OD") is BoutiqueODAmpPedal)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user