feat(amp): Gain/Drive become a 1–11 dial with a musical taper
Every amp's Gain (and the boutique/drive-channel Drive) is now a 1–11 dial — yes, it goes to eleven — instead of the raw 1–30 tube-drive number. - New AmpVoicePedal.taperedDrive(_:) maps the 1–11 dial to the 1–30 tube drive through an exponential LinExp taper, so 1 is nearly clean, 11 is full saturation, and the useful grind spreads across the dial (fine at the bottom, steep at the top) rather than bunching near the low end. - Wired into the base preampStage and every override that feeds a drive: Boutique / Fullerton Drive / Jazz Clean / British Dual (Drive channel), Anaheim (SS preamp), British Master (cascaded stage). - gainRange / driveRange → 1...11; every amp's default gain/drive reconverted from drive-space to the equivalent dial value (dial = 1 + 10·ln(drive)/ln(30)), so each amp's shipped voicing is preserved. - No preset migration (nothing shipped — per product owner); all knob work stays within ShoeGaze (no core Lyrebird change). - Tests updated to the 1–11 scale; added range + exponential-taper assertions. 671 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -41,8 +41,10 @@ open class AmpVoicePedal: Pedal {
|
||||
|
||||
// MARK: - Common parameters
|
||||
|
||||
/// Preamp drive into the first tube stage. Range [1, 30].
|
||||
@UIParam public var gain: Double = 6.0
|
||||
/// Preamp **Gain** dial in `[1, 11]` (yes, it goes to eleven). Mapped to the tube-drive range
|
||||
/// `[1, 30]` through a musical exponential taper — see ``taperedDrive(_:)`` — so low settings give
|
||||
/// fine control and the top of the dial pushes hard into saturation.
|
||||
@UIParam public var gain: Double = 6.27
|
||||
/// Tone-stack bass control in [0, 1].
|
||||
@UIParam public var bass: Double = 0.5
|
||||
/// Tone-stack mid control in [0, 1].
|
||||
@@ -152,7 +154,19 @@ open class AmpVoicePedal: Pedal {
|
||||
/// - Parameter signal: The post-`inputShaping` input signal.
|
||||
/// - Returns: The preamp output fed into the tone stack.
|
||||
open func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
TriodeStage(input: signal, drive: $gain, bias: preampBias, oversample: preampOversample)
|
||||
TriodeStage(input: signal, drive: taperedDrive($gain), bias: preampBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
/// Maps a `Gain` / `Drive` dial `[1, 11]` to the tube-drive range `[dialDriveMin, dialDriveMax]`
|
||||
/// through an exponential (musical) taper: `drive = dialDriveMin · (dialDriveMax/dialDriveMin) ^
|
||||
/// ((dial − 1) / 10)`. A live node, so the dial stays a smooth knob. Every amp's preamp and
|
||||
/// drive-channel stage runs its dial through this so `1` is nearly clean, `11` is full saturation,
|
||||
/// and the useful grind spreads across the dial rather than bunching at the bottom.
|
||||
///
|
||||
/// - Parameter dial: A `[1, 11]` Gain/Drive knob node.
|
||||
/// - Returns: The mapped tube drive to feed a `TriodeStage`.
|
||||
func taperedDrive(_ dial: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
LinExp.Audio(dial, inLo: dialMin, inHi: dialMax, outLo: dialDriveMin, outHi: dialDriveMax)
|
||||
}
|
||||
|
||||
/// Drive into the power-amp `TriodeStage`. Defaults to the fixed power-amp drive. Two kinds of
|
||||
@@ -239,6 +253,13 @@ open class AmpVoicePedal: Pedal {
|
||||
let switchOffValue: Double = 0.0
|
||||
let switchOnValue: Double = 1.0
|
||||
/// Fixed power-amp stage drive (gentler than the preamp).
|
||||
/// Gain/Drive dial endpoints and the tube-drive range they taper onto (see ``taperedDrive(_:)``).
|
||||
/// `11` is the top of the dial; `30` is the maximum tube drive it reaches. `dialDriveMin > 0` is
|
||||
/// required by `LinExp`.
|
||||
let dialMin: Double = 1.0
|
||||
let dialMax: Double = 11.0
|
||||
let dialDriveMin: Double = 1.0
|
||||
let dialDriveMax: Double = 30.0
|
||||
private let powerAmpDrive: Double = 1.5
|
||||
/// Power-amp grid bias at `bias = 0` (coldest) and `bias = 1` (hottest). Symmetric about `0`, so
|
||||
/// the neutral `bias = 0.5` maps to `0.0` — the old fixed power-amp bias — leaving every amp's
|
||||
@@ -274,7 +295,7 @@ open class AmpVoicePedal: Pedal {
|
||||
/// just above ±1, guaranteeing the amp stage never emits a sample the DAC would clip.
|
||||
private let outputCeiling: Double = 1.0
|
||||
|
||||
let gainRange: ClosedRange<Double> = 1.0 ... 30.0
|
||||
let gainRange: ClosedRange<Double> = 1.0 ... 11.0
|
||||
let toneRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
/// Range for a signature control that maps [0, 1] (Bright / Presence / Cut amount).
|
||||
let signatureRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
|
||||
@@ -85,7 +85,7 @@ public final class AnaheimAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Anaheim", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 3.0 // huge clean headroom
|
||||
gain = 4.23 // huge clean headroom
|
||||
cab = 0.0 // American 1×12
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public final class AnaheimAmpPedal: AmpVoicePedal {
|
||||
|
||||
/// Symmetric (solid-state-flavoured) preamp stage — `bias 0`, no even-harmonic tube warmth.
|
||||
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
TriodeStage(input: signal, drive: $gain, bias: ssPreampBias, oversample: preampOversample)
|
||||
TriodeStage(input: signal, drive: taperedDrive($gain), bias: ssPreampBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
/// The built-in limiter, gated by the Limiter switch — placed *before* the power-amp stage (so
|
||||
|
||||
@@ -23,8 +23,8 @@ open class BoutiqueAmpPedal: AmpVoicePedal {
|
||||
@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
|
||||
/// Lead-channel preamp gain (the cascaded stage). Dial [1, 11], tapered to tube drive.
|
||||
@UIParam public var drive: Double = 7.77
|
||||
/// Channel select: `0` = Clean, `1` = Lead (the cascaded gain stage).
|
||||
@UIParam public var channel: Double = 0.0
|
||||
|
||||
@@ -38,7 +38,7 @@ open class BoutiqueAmpPedal: AmpVoicePedal {
|
||||
private let masterMaxDrive: Double = 5.0
|
||||
private let channelThreshold: Double = 0.5
|
||||
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 30.0
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 11.0
|
||||
|
||||
public override var toneStackModel: ToneStackModel { .marshall }
|
||||
public override var signatureKnobs: [PedalKnob] {
|
||||
@@ -78,7 +78,7 @@ open class BoutiqueAmpPedal: AmpVoicePedal {
|
||||
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)
|
||||
return TriodeStage(input: clean, drive: taperedDrive($drive), bias: leadBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
/// Presence (top-end high-shelf) then Depth (low-end low-shelf), post power amp.
|
||||
|
||||
@@ -25,8 +25,8 @@ public final class BoutiqueLeadAmpPedal: BoutiqueAmpPedal {
|
||||
/// - 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
|
||||
gain = 6.27
|
||||
drive = 8.76 // hot singing lead
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ public final class BoutiqueODAmpPedal: BoutiqueAmpPedal {
|
||||
/// - 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
|
||||
gain = 5.73
|
||||
drive = 7.77
|
||||
cab = 0.0 // American 1×12
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class BritishAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "British", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 10.0 // crunch-leaning default
|
||||
gain = 7.77 // crunch-leaning default
|
||||
cab = 1.0 // default to the British 4×12 cab
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class BritishBluesbreakerAmpPedal: BritishComboAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "British Bluesbreaker", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 6.0
|
||||
gain = 6.27
|
||||
cab = 1.0 // British 4×12 voice (combo 2×12 tonally close enough among our cabs)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
|
||||
|
||||
/// 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 = 8.0
|
||||
/// Lead-channel preamp gain (the cascaded stage). Dial [1, 11], tapered to tube drive.
|
||||
@UIParam public var drive: Double = 7.11
|
||||
/// Spring-reverb wet mix in [0, 1].
|
||||
@UIParam public var reverb: Double = 0.2
|
||||
/// Channel select: `0` = Clean, `1` = Lead (the cascaded gain stage).
|
||||
@@ -29,7 +29,7 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
|
||||
private let masterMaxDrive: Double = 5.0
|
||||
/// Channel-select threshold: `>= this` selects the Lead channel.
|
||||
private let channelThreshold: Double = 0.5
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 30.0
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 11.0
|
||||
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
|
||||
public override var summaryText: String {
|
||||
@@ -73,7 +73,7 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "British Dual", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 5.0
|
||||
gain = 5.73
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
|
||||
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)
|
||||
return TriodeStage(input: clean, drive: taperedDrive($drive), bias: leadBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
/// Spring reverb in the onboard-effects slot (after the tone stack).
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class BritishJTMAmpPedal: BritishComboAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "British JTM", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 5.0 // warmer, lower-gain than the plexi
|
||||
gain = 5.73 // warmer, lower-gain than the plexi
|
||||
treble = 0.5 // a shade rounder on top
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
|
||||
@@ -44,13 +44,13 @@ public final class BritishMasterAmpPedal: BritishComboAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "British Master", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 5.0 // cascaded, so already a hot lead at moderate Gain
|
||||
gain = 5.73 // cascaded, so already a hot lead at moderate Gain
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
|
||||
/// Cascaded two-stage preamp: the base stage, then a second `TriodeStage` also driven by `Gain`.
|
||||
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
let stage1: any ValidGeneratorInput = super.preampStage(signal)
|
||||
return TriodeStage(input: stage1, drive: $gain, bias: leadBias, oversample: preampOversample)
|
||||
return TriodeStage(input: stage1, drive: taperedDrive($gain), bias: leadBias, oversample: preampOversample)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class BritishPlexiAmpPedal: BritishComboAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "British Plexi", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 7.0 // clean-ish until pushed
|
||||
gain = 6.72 // clean-ish until pushed
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ public final class CaliHiGainAmpPedal: BoutiqueAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Cali Hi-Gain", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 6.0
|
||||
drive = 16.0 // hot Mark-style lead
|
||||
gain = 6.27
|
||||
drive = 9.15 // hot Mark-style lead
|
||||
cab = 1.0 // British 4×12 — tight and aggressive
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public final class CaliforniaAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "California", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 4.0 // clean-leaning default
|
||||
gain = 5.08 // clean-leaning default
|
||||
}
|
||||
|
||||
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
|
||||
@@ -41,7 +41,7 @@ open class ChimeAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public convenience init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
self.init(name: "Chime", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 5.0
|
||||
gain = 5.73
|
||||
}
|
||||
|
||||
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
|
||||
|
||||
@@ -31,7 +31,7 @@ public final class ChimeBabyAmpPedal: ChimeAmpPedal {
|
||||
/// - 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
|
||||
gain = 6.27
|
||||
bass = 0.4 // small speaker, less low end
|
||||
cab = 7.0 // Lo-Fi 1×8 — the small, boxy voice
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public final class ChimeFifteenAmpPedal: ChimeAmpPedal {
|
||||
/// - 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
|
||||
gain = 6.27 // grittier starting point than the big AC voice
|
||||
cab = 5.0 // Bright 1×12
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class ChimeNormalAmpPedal: ChimeAmpPedal {
|
||||
/// - 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
|
||||
gain = 5.73
|
||||
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
|
||||
|
||||
@@ -77,7 +77,7 @@ public final class ChimeTopBoostAmpPedal: AmpVoicePedal {
|
||||
/// - 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
|
||||
gain = 5.73
|
||||
cab = 5.0 // Bright 1×12 — the chimey, top-end-forward cab voice
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public final class CitrusAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Citrus", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 6.0
|
||||
gain = 6.27
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class CommandAmpPedal: BritishComboAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Command", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 4.0 // headroom-rich clean
|
||||
gain = 5.08 // headroom-rich clean
|
||||
treble = 0.55 // a touch of hi-fi top
|
||||
cab = 1.0 // British 4×12
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public final class FullertonDeluxeAmpPedal: FullertonReverbAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Fullerton Deluxe", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 4.5 // slightly hotter starting point than the Twin
|
||||
gain = 5.42 // slightly hotter starting point than the Twin
|
||||
bass = 0.45 // a touch less low end than the 2×12
|
||||
cab = 0.0 // American 1×12
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
|
||||
|
||||
/// Spring-reverb wet mix in [0, 1].
|
||||
@UIParam public var reverb: Double = 0.25
|
||||
/// Drive-channel preamp gain (the cascaded overdrive stage). Range [1, 30].
|
||||
@UIParam public var drive: Double = 8.0
|
||||
/// Drive-channel preamp gain (the cascaded overdrive stage). Dial [1, 11], tapered to tube drive.
|
||||
@UIParam public var drive: Double = 7.11
|
||||
/// Bright switch: `0` = flat, `1` = treble shelf engaged.
|
||||
@UIParam public var bright: Double = 0.0
|
||||
/// Channel select: `0` = Clean, `1` = Drive (the cascaded overdrive stage).
|
||||
@@ -35,7 +35,7 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
|
||||
private let channelThreshold: Double = 0.5
|
||||
|
||||
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 30.0
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 11.0
|
||||
|
||||
public override var toneStackModel: ToneStackModel { .fender }
|
||||
public override var summaryText: String {
|
||||
@@ -80,7 +80,7 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Fullerton Drive", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 4.0
|
||||
gain = 5.08
|
||||
cab = 0.0 // American 1×12
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
|
||||
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: driveBias, oversample: preampOversample)
|
||||
return TriodeStage(input: clean, drive: taperedDrive($drive), bias: driveBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
/// Spring reverb in the onboard-effects slot (after the tone stack).
|
||||
|
||||
@@ -33,7 +33,7 @@ public final class FullertonPrincetonAmpPedal: FullertonReverbAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Fullerton Ivy League", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 5.0 // hotter still — the small combo grits up soonest
|
||||
gain = 5.73 // hotter still — the small combo grits up soonest
|
||||
bass = 0.4 // least low end of the trio
|
||||
treble = 0.55 // a shade darker
|
||||
cab = 2.0 // Vintage Dark — the small, dark 1×10 voice
|
||||
|
||||
@@ -83,7 +83,7 @@ open class FullertonReverbAmpPedal: AmpVoicePedal {
|
||||
/// inheriting the shared reverb + tremolo + bright control surface.
|
||||
public convenience init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
self.init(name: "Fullerton Reverb", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 4.0 // headroom-rich clean default
|
||||
gain = 5.08 // headroom-rich clean default
|
||||
}
|
||||
|
||||
// MARK: - Switches
|
||||
|
||||
@@ -38,8 +38,8 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
|
||||
@UIParam public var bright: Double = 0.0
|
||||
/// Chorus footswitch: `1` = chorus engaged (stereo), `0` = bypassed (dry, mono-equivalent).
|
||||
@UIParam public var chorusEnabled: Double = 1.0
|
||||
/// Drive-channel preamp gain (the onboard distortion). Range [1, 30].
|
||||
@UIParam public var drive: Double = 8.0
|
||||
/// Drive-channel preamp gain (the onboard distortion). Dial [1, 11], tapered to tube drive.
|
||||
@UIParam public var drive: Double = 7.11
|
||||
/// Channel select: `0` = Clean, `1` = Distortion (the cascaded onboard-distortion stage).
|
||||
@UIParam public var channel: Double = 0.0
|
||||
|
||||
@@ -62,7 +62,7 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
|
||||
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
|
||||
private let chorusRateRange: ClosedRange<Double> = 0.1 ... 5.0
|
||||
private let chorusDepthRange: ClosedRange<Double> = 0.0005 ... 0.015
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 30.0
|
||||
private let driveRange: ClosedRange<Double> = 1.0 ... 11.0
|
||||
|
||||
// MARK: - Voice configuration
|
||||
|
||||
@@ -94,7 +94,7 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Jazz Clean", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 3.0 // clean, low-gain solid-state default
|
||||
gain = 4.23 // clean, low-gain solid-state default
|
||||
cab = 6.0 // Full-Range (FRFR) — the hi-fi, least-coloured voice
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
|
||||
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: driveBias, oversample: preampOversample)
|
||||
return TriodeStage(input: clean, drive: taperedDrive($drive), bias: driveBias, oversample: preampOversample)
|
||||
}
|
||||
|
||||
// MARK: - Hooks
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class MagnaVibratoAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Magna Vibrato", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 4.0 // clean platform for the vibrato
|
||||
gain = 5.08 // clean platform for the vibrato
|
||||
cab = 0.0 // American 1×12
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ public final class ModernHighGainAmpPedal: BoutiqueAmpPedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Modern High-Gain", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 7.0
|
||||
drive = 18.0 // hottest lead of the lineup
|
||||
gain = 6.72
|
||||
drive = 9.50 // hottest lead of the lineup
|
||||
cab = 1.0 // British 4×12 — tight, aggressive
|
||||
sag = 0.3 // rectifier bloom on by default (shared power-amp Sag from AmpVoicePedal)
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class SixtiesComboAmpPedal: AmpVoicePedal {
|
||||
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
|
||||
public init(inputBus: Int = 0, outputBus: Int = 0) {
|
||||
super.init(name: "Sixties Combo", inputBus: inputBus, outputBus: outputBus)
|
||||
gain = 7.0 // gritty starting point
|
||||
gain = 6.72 // gritty starting point
|
||||
cab = 2.0 // Vintage Dark — small, dark
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,35 @@ struct AmpVoicePedalTests {
|
||||
@Test func gainChangesOutput() throws {
|
||||
for voice in voices {
|
||||
let clean: [Float] = try render(voice.make) { $0.gain = 2.0 }
|
||||
let hot: [Float] = try render(voice.make) { $0.gain = 25.0 }
|
||||
let hot: [Float] = try render(voice.make) { $0.gain = 10.5 }
|
||||
#expect(windowedSSD(clean, hot) > 0, "\(voice.name) gain had no effect")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func gainDialRunsOneToEleven() throws {
|
||||
// The Gain knob is a 1–11 dial (it goes to eleven), mapped to tube drive via a taper.
|
||||
for voice in voices {
|
||||
let gainKnob: PedalKnob? = voice.make().effectKnobs.first { $0.label == "Gain" }
|
||||
#expect(gainKnob?.range == 1.0 ... 11.0, "\(voice.name) Gain range should be 1...11")
|
||||
}
|
||||
// The Boutique amps' Drive channel is the same 1–11 dial.
|
||||
let driveKnob: PedalKnob? = BoutiqueLeadAmpPedal().effectKnobs.first { $0.label == "Drive" }
|
||||
#expect(driveKnob?.range == 1.0 ... 11.0, "Drive range should be 1...11")
|
||||
}
|
||||
|
||||
@Test func gainTaperIsMonotonicAndSaturatesMore() throws {
|
||||
// Turning the dial up must add saturation (waveshape change), and the exponential taper means
|
||||
// the jump from 9→11 shapes the wave more than 1→3 — most grind lives up top. Use the
|
||||
// California voice; RMS-normalize so level differences don't masquerade as waveshape change.
|
||||
let low: [Float] = try render({ CaliforniaAmpPedal() }) { $0.gain = 1.0 }
|
||||
let mid: [Float] = try render({ CaliforniaAmpPedal() }) { $0.gain = 3.0 }
|
||||
let hi: [Float] = try render({ CaliforniaAmpPedal() }) { $0.gain = 9.0 }
|
||||
let top: [Float] = try render({ CaliforniaAmpPedal() }) { $0.gain = 11.0 }
|
||||
#expect(rmsNormalizedSSD(low, mid) > 0, "1→3 should change the waveshape")
|
||||
#expect(rmsNormalizedSSD(hi, top) > rmsNormalizedSSD(low, mid),
|
||||
"the top of the taper should shape more than the bottom (exponential)")
|
||||
}
|
||||
|
||||
@Test func toneControlsChangeOutput() throws {
|
||||
for voice in voices {
|
||||
let dark: [Float] = try render(voice.make) { $0.treble = 0.0; $0.bass = 1.0 }
|
||||
@@ -122,7 +146,7 @@ struct AmpVoicePedalTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for voice in voices {
|
||||
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
}
|
||||
@@ -151,8 +175,8 @@ struct AmpVoicePedalTests {
|
||||
// just the level (which is what `level` would do). RMS-normalize each window before diffing:
|
||||
// a pure level change collapses to ~0, so a clearly-positive normalized SSD proves genuine
|
||||
// power-amp saturation.
|
||||
let low: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 12.0; $0.master = 0.1 }
|
||||
let high: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 12.0; $0.master = 1.0 }
|
||||
let low: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 8.3; $0.master = 0.1 }
|
||||
let high: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 8.3; $0.master = 1.0 }
|
||||
#expect(hasNonSilentOutput(low) && hasNonSilentOutput(high))
|
||||
#expect(rmsNormalizedSSD(low, high) > 1.0e-3, "Master changed level but not tone (no power-amp saturation)")
|
||||
}
|
||||
@@ -160,7 +184,7 @@ struct AmpVoicePedalTests {
|
||||
@Test func britishStaysWithinCeilingAtMaxMaster() throws {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
let hot: [Float] = try render({ BritishAmpPedal() }) { (pedal: BritishAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.master = 1.0
|
||||
@@ -187,8 +211,8 @@ struct AmpVoicePedalTests {
|
||||
|
||||
@Test func sagChangesOutput() throws {
|
||||
for voice in voices {
|
||||
let stiff: [Float] = try render(voice.make) { $0.gain = 20.0; $0.sag = 0.0 }
|
||||
let saggy: [Float] = try render(voice.make) { $0.gain = 20.0; $0.sag = 1.0 }
|
||||
let stiff: [Float] = try render(voice.make) { $0.gain = 9.8; $0.sag = 0.0 }
|
||||
let saggy: [Float] = try render(voice.make) { $0.gain = 9.8; $0.sag = 1.0 }
|
||||
#expect(windowedSSD(stiff, saggy) > 0, "\(voice.name) Sag had no effect")
|
||||
}
|
||||
}
|
||||
@@ -201,7 +225,7 @@ struct AmpVoicePedalTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for voice in voices {
|
||||
let cfg: (AmpVoicePedal) -> Void = { (p: AmpVoicePedal) in
|
||||
p.gain = 25.0; p.bass = 1.0; p.treble = 1.0
|
||||
p.gain = 10.5; p.bass = 1.0; p.treble = 1.0
|
||||
}
|
||||
let stiff: [Float] = try render(voice.make) { cfg($0); $0.sag = 0.0 }
|
||||
let saggy: [Float] = try render(voice.make) { cfg($0); $0.sag = 1.0 }
|
||||
@@ -221,8 +245,8 @@ struct AmpVoicePedalTests {
|
||||
// Bias shifts the power-amp tanh operating point → changes the even/odd harmonic mix (a
|
||||
// waveshape change), not merely the level. RMS-normalize so a pure level difference collapses.
|
||||
for voice in voices {
|
||||
let cold: [Float] = try render(voice.make) { $0.gain = 22.0; $0.bias = 0.0 }
|
||||
let hot: [Float] = try render(voice.make) { $0.gain = 22.0; $0.bias = 1.0 }
|
||||
let cold: [Float] = try render(voice.make) { $0.gain = 10.2; $0.bias = 0.0 }
|
||||
let hot: [Float] = try render(voice.make) { $0.gain = 10.2; $0.bias = 1.0 }
|
||||
#expect(hasNonSilentOutput(cold) && hasNonSilentOutput(hot))
|
||||
#expect(rmsNormalizedSSD(cold, hot) > 1.0e-4, "\(voice.name) Bias changed level but not waveshape")
|
||||
}
|
||||
@@ -244,8 +268,8 @@ struct AmpVoicePedalTests {
|
||||
// harmonic mix (a waveshape change), not merely the level. RMS-normalize so a pure level
|
||||
// difference collapses.
|
||||
for voice in voices {
|
||||
let balanced: [Float] = try render(voice.make) { $0.gain = 22.0; $0.biasX = 0.0 }
|
||||
let imbalanced: [Float] = try render(voice.make) { $0.gain = 22.0; $0.biasX = 1.0 }
|
||||
let balanced: [Float] = try render(voice.make) { $0.gain = 10.2; $0.biasX = 0.0 }
|
||||
let imbalanced: [Float] = try render(voice.make) { $0.gain = 10.2; $0.biasX = 1.0 }
|
||||
#expect(hasNonSilentOutput(balanced) && hasNonSilentOutput(imbalanced))
|
||||
#expect(rmsNormalizedSSD(balanced, imbalanced) > 1.0e-4,
|
||||
"\(voice.name) Bias X changed level but not waveshape")
|
||||
@@ -256,7 +280,7 @@ struct AmpVoicePedalTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for voice in voices {
|
||||
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in
|
||||
pedal.gain = 30.0; pedal.bass = 1.0; pedal.treble = 1.0; pedal.biasX = 1.0
|
||||
pedal.gain = 11.0; pedal.bass = 1.0; pedal.treble = 1.0; pedal.biasX = 1.0
|
||||
}
|
||||
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
|
||||
#expect(peak <= 1.0 + ceilingEpsilon, "\(voice.name) Bias X peak \(peak) exceeds ±1")
|
||||
@@ -269,7 +293,7 @@ struct AmpVoicePedalTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for voice in voices {
|
||||
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in
|
||||
pedal.gain = 30.0; pedal.bass = 1.0; pedal.treble = 1.0; pedal.bias = 1.0; pedal.biasX = 1.0
|
||||
pedal.gain = 11.0; pedal.bass = 1.0; pedal.treble = 1.0; pedal.bias = 1.0; pedal.biasX = 1.0
|
||||
}
|
||||
#expect(hot.allSatisfy { $0.isFinite }, "\(voice.name) bias+biasX produced non-finite output")
|
||||
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
|
||||
@@ -317,7 +341,7 @@ struct AmpVoicePedalTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for voice in voices {
|
||||
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in
|
||||
pedal.gain = 30.0; pedal.bass = 1.0; pedal.treble = 1.0
|
||||
pedal.gain = 11.0; pedal.bass = 1.0; pedal.treble = 1.0
|
||||
pedal.cab = AmpVoicePedal.cabinetBypassValue
|
||||
}
|
||||
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
|
||||
@@ -401,12 +425,12 @@ struct AmpVoicePedalTests {
|
||||
|
||||
@Test func selectionsRoundTripThroughState() throws {
|
||||
let pedal: CaliforniaAmpPedal = CaliforniaAmpPedal()
|
||||
pedal.gain = 12.0
|
||||
pedal.gain = 8.3
|
||||
pedal.cab = 2.0
|
||||
pedal.bright = 0.8
|
||||
let restored: CaliforniaAmpPedal = CaliforniaAmpPedal()
|
||||
restored.applyState(pedal.captureState())
|
||||
#expect(restored.gain == 12.0 && restored.cab == 2.0 && restored.bright == 0.8,
|
||||
#expect(restored.gain == 8.3 && restored.cab == 2.0 && restored.bright == 0.8,
|
||||
"California controls did not round-trip")
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ struct BoutiqueAmpPedalTests {
|
||||
@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 }
|
||||
let lead: [Float] = try render(v.make) { $0.channel = 1.0; $0.drive = 9.5 }
|
||||
#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")
|
||||
@@ -113,7 +113,7 @@ struct BoutiqueAmpPedalTests {
|
||||
@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 }
|
||||
let high: [Float] = try render(v.make) { $0.channel = 1.0; $0.drive = 10.5 }
|
||||
#expect(windowedSSD(low, high) > 0, "\(v.name) Drive had no effect on the lead channel")
|
||||
}
|
||||
}
|
||||
@@ -121,8 +121,8 @@ struct BoutiqueAmpPedalTests {
|
||||
@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
|
||||
p.gain = 11.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 = 11.0
|
||||
}
|
||||
#expect(peak(hot) <= 1.0 + 1.0e-4, "\(v.name) exceeds the ±1 ceiling on the lead channel")
|
||||
}
|
||||
@@ -150,12 +150,12 @@ struct BoutiqueAmpPedalTests {
|
||||
|
||||
@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.presence = 0.6; pedal.depth = 0.7; pedal.master = 0.8; pedal.drive = 8.3
|
||||
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)
|
||||
#expect(restored.drive == 8.3 && restored.channel == 1.0 && restored.midBoost == 1.0 && restored.cab == 2.0)
|
||||
}
|
||||
|
||||
@Test func registeredInBuiltInRegistry() throws {
|
||||
|
||||
@@ -129,7 +129,7 @@ struct BritishComboAmpPedalTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
|
||||
let hot: [Float] = try render(v.make) { (pedal: BritishComboAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.presence = 1.0
|
||||
|
||||
@@ -99,7 +99,7 @@ struct BritishMasterAmpPedalTests {
|
||||
|
||||
@Test func masterStaysWithinCeiling() throws {
|
||||
let hot: [Float] = try render({ BritishMasterAmpPedal() }) { (p: BritishMasterAmpPedal) in
|
||||
p.gain = 30.0; p.bass = 1.0; p.treble = 1.0; p.presence = 1.0; p.bright = 1.0; p.master = 1.0
|
||||
p.gain = 11.0; p.bass = 1.0; p.treble = 1.0; p.presence = 1.0; p.bright = 1.0; p.master = 1.0
|
||||
}
|
||||
#expect(peak(hot) <= 1.0 + 1.0e-4, "British Master exceeds the ±1 ceiling")
|
||||
}
|
||||
@@ -116,7 +116,7 @@ struct BritishMasterAmpPedalTests {
|
||||
|
||||
@Test func dualChannelSwitchChangesOutput() throws {
|
||||
let clean: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 0.0 }
|
||||
let lead: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 1.0; $0.drive = 15.0 }
|
||||
let lead: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 1.0; $0.drive = 9.0 }
|
||||
#expect(hasNonSilentOutput(clean) && hasNonSilentOutput(lead))
|
||||
#expect(windowedSSD(clean, lead) > 0, "channel switch had no effect")
|
||||
let channel: PedalSwitch? = BritishDualAmpPedal().effectSwitches.first { $0.label == "Channel" }
|
||||
@@ -125,7 +125,7 @@ struct BritishMasterAmpPedalTests {
|
||||
|
||||
@Test func dualDriveAndReverbAndMasterWork() throws {
|
||||
let low: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 1.0; $0.drive = 2.0 }
|
||||
let high: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 1.0; $0.drive = 25.0 }
|
||||
let high: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 1.0; $0.drive = 10.5 }
|
||||
#expect(windowedSSD(low, high) > 0, "Drive had no effect on the lead channel")
|
||||
let dry: [Float] = try render({ BritishDualAmpPedal() }) { $0.reverb = 0.0 }
|
||||
let wet: [Float] = try render({ BritishDualAmpPedal() }) { $0.reverb = 0.9 }
|
||||
@@ -147,19 +147,19 @@ struct BritishMasterAmpPedalTests {
|
||||
|
||||
@Test func dualStaysWithinCeilingOnLeadChannel() throws {
|
||||
let hot: [Float] = try render({ BritishDualAmpPedal() }) { (p: BritishDualAmpPedal) in
|
||||
p.gain = 30.0; p.bass = 1.0; p.treble = 1.0; p.presence = 1.0; p.bright = 1.0
|
||||
p.master = 1.0; p.channel = 1.0; p.drive = 30.0; p.reverb = 1.0
|
||||
p.gain = 11.0; p.bass = 1.0; p.treble = 1.0; p.presence = 1.0; p.bright = 1.0
|
||||
p.master = 1.0; p.channel = 1.0; p.drive = 11.0; p.reverb = 1.0
|
||||
}
|
||||
#expect(peak(hot) <= 1.0 + 1.0e-4, "British Dual exceeds the ±1 ceiling on the lead channel")
|
||||
}
|
||||
|
||||
@Test func dualRoundTrips() throws {
|
||||
let pedal: BritishDualAmpPedal = BritishDualAmpPedal()
|
||||
pedal.master = 0.7; pedal.drive = 12.0; pedal.reverb = 0.5; pedal.channel = 1.0
|
||||
pedal.master = 0.7; pedal.drive = 8.3; pedal.reverb = 0.5; pedal.channel = 1.0
|
||||
pedal.presence = 0.6; pedal.bright = 1.0; pedal.cab = 2.0
|
||||
let restored: BritishDualAmpPedal = BritishDualAmpPedal()
|
||||
restored.applyState(pedal.captureState())
|
||||
#expect(restored.master == 0.7 && restored.drive == 12.0 && restored.reverb == 0.5)
|
||||
#expect(restored.master == 0.7 && restored.drive == 8.3 && restored.reverb == 0.5)
|
||||
#expect(restored.channel == 1.0 && restored.presence == 0.6 && restored.bright == 1.0 && restored.cab == 2.0)
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ struct CaliHiGainAmpPedalTests {
|
||||
|
||||
@Test func staysWithinCeilingWithEQAndGainMaxed() throws {
|
||||
let hot: [Float] = try render { (p: CaliHiGainAmpPedal) in
|
||||
p.gain = 30.0; p.bass = 1.0; p.treble = 1.0; p.master = 1.0; p.channel = 1.0; p.drive = 30.0
|
||||
p.gain = 11.0; p.bass = 1.0; p.treble = 1.0; p.master = 1.0; p.channel = 1.0; p.drive = 11.0
|
||||
p.eq80 = 12.0; p.eq240 = 12.0; p.eq750 = 12.0; p.eq2200 = 12.0; p.eq6600 = 12.0
|
||||
}
|
||||
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
|
||||
|
||||
@@ -61,7 +61,7 @@ struct CharacterAmpsTests {
|
||||
|
||||
@Test func allBuildNonSilentFiniteWithinCeiling() throws {
|
||||
for a: (name: String, make: () -> AmpVoicePedal) in all {
|
||||
let hot: [Float] = try render(a.make) { $0.gain = 30.0; $0.bass = 1.0; $0.treble = 1.0 }
|
||||
let hot: [Float] = try render(a.make) { $0.gain = 11.0; $0.bass = 1.0; $0.treble = 1.0 }
|
||||
#expect(hasNonSilentOutput(hot), "\(a.name) silent")
|
||||
#expect(hot.allSatisfy { $0.isFinite }, "\(a.name) non-finite")
|
||||
#expect(peak(hot) <= 1.0 + 1.0e-4, "\(a.name) exceeds ±1 ceiling: \(peak(hot))")
|
||||
@@ -139,8 +139,8 @@ struct CharacterAmpsTests {
|
||||
|
||||
@Test func anaheimLimiterActsWhenDrivenHot() throws {
|
||||
// Driven hard, the built-in limiter (on) compresses vs bypassed (off) → different output.
|
||||
let limited: [Float] = try render({ AnaheimAmpPedal() }) { $0.gain = 25.0; $0.limiter = 1.0 }
|
||||
let unlimited: [Float] = try render({ AnaheimAmpPedal() }) { $0.gain = 25.0; $0.limiter = 0.0 }
|
||||
let limited: [Float] = try render({ AnaheimAmpPedal() }) { $0.gain = 10.5; $0.limiter = 1.0 }
|
||||
let unlimited: [Float] = try render({ AnaheimAmpPedal() }) { $0.gain = 10.5; $0.limiter = 0.0 }
|
||||
#expect(windowedSSD(limited, unlimited) > 0, "Anaheim limiter had no effect")
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ struct ChimeTopBoostAmpPedalTests {
|
||||
@Test func outputStaysWithinCeilingWithFXEngaged() throws {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
let hot: [Float] = try render { (pedal: ChimeTopBoostAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.brilliant = 1.0
|
||||
|
||||
@@ -100,7 +100,7 @@ struct ChimeVariantsTests {
|
||||
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.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.cut = 0.0
|
||||
|
||||
@@ -58,14 +58,14 @@ struct FullertonDriveAmpPedalTests {
|
||||
// The value is read at build time (rebuildsOnChange); configure runs before build, so the
|
||||
// Drive channel cascades its extra stage.
|
||||
let clean: [Float] = try render { $0.channel = 0.0 }
|
||||
let drive: [Float] = try render { $0.channel = 1.0; $0.drive = 15.0 }
|
||||
let drive: [Float] = try render { $0.channel = 1.0; $0.drive = 9.0 }
|
||||
#expect(hasNonSilentOutput(clean) && hasNonSilentOutput(drive))
|
||||
#expect(windowedSSD(clean, drive) > 0, "channel switch had no effect")
|
||||
}
|
||||
|
||||
@Test func driveKnobChangesDriveChannel() throws {
|
||||
let low: [Float] = try render { $0.channel = 1.0; $0.drive = 2.0 }
|
||||
let high: [Float] = try render { $0.channel = 1.0; $0.drive = 25.0 }
|
||||
let high: [Float] = try render { $0.channel = 1.0; $0.drive = 10.5 }
|
||||
#expect(windowedSSD(low, high) > 0, "Drive knob had no effect on the drive channel")
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ struct FullertonDriveAmpPedalTests {
|
||||
@Test func outputStaysWithinCeilingOnDriveChannel() throws {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
let hot: [Float] = try render { (pedal: FullertonDriveAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.reverb = 1.0
|
||||
pedal.bright = 1.0
|
||||
pedal.channel = 1.0
|
||||
pedal.drive = 30.0
|
||||
pedal.drive = 11.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 on the drive channel")
|
||||
@@ -112,13 +112,13 @@ struct FullertonDriveAmpPedalTests {
|
||||
@Test func controlsRoundTripThroughState() throws {
|
||||
let pedal: FullertonDriveAmpPedal = FullertonDriveAmpPedal()
|
||||
pedal.reverb = 0.6
|
||||
pedal.drive = 12.0
|
||||
pedal.drive = 8.3
|
||||
pedal.bright = 1.0
|
||||
pedal.channel = 1.0
|
||||
pedal.cab = 2.0
|
||||
let restored: FullertonDriveAmpPedal = FullertonDriveAmpPedal()
|
||||
restored.applyState(pedal.captureState())
|
||||
#expect(restored.reverb == 0.6 && restored.drive == 12.0)
|
||||
#expect(restored.reverb == 0.6 && restored.drive == 8.3)
|
||||
#expect(restored.bright == 1.0 && restored.channel == 1.0 && restored.cab == 2.0)
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ struct FullertonReverbAmpPedalTests {
|
||||
@Test func outputStaysWithinCeilingWithFXEngaged() throws {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
let hot: [Float] = try render { (pedal: FullertonReverbAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.reverb = 1.0
|
||||
|
||||
@@ -86,7 +86,7 @@ struct FullertonVariantsTests {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
for v: (name: String, make: () -> FullertonReverbAmpPedal) in variants {
|
||||
let hot: [Float] = try render(v.make) { (pedal: FullertonReverbAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.reverb = 1.0
|
||||
|
||||
@@ -127,7 +127,7 @@ struct JazzCleanAmpPedalTests {
|
||||
// Channel is read at build time (rebuildsOnChange); configure runs before build, so the
|
||||
// Distortion channel cascades its extra gain stage.
|
||||
let clean: [Float] = try renderStereo { $0.channel = 0.0 }.left
|
||||
let dist: [Float] = try renderStereo { $0.channel = 1.0; $0.drive = 18.0 }.left
|
||||
let dist: [Float] = try renderStereo { $0.channel = 1.0; $0.drive = 9.5 }.left
|
||||
#expect(windowedSSD(clean, dist) > 0, "distortion channel had no effect")
|
||||
let channel: PedalSwitch? = JazzCleanAmpPedal().effectSwitches.first { $0.label == "Channel" }
|
||||
#expect(channel?.rebuildsOnChange == true, "Channel switch should rebuild on change")
|
||||
@@ -136,7 +136,7 @@ struct JazzCleanAmpPedalTests {
|
||||
@Test func bothChannelsStayWithinCeilingWithFXEngaged() throws {
|
||||
let ceilingEpsilon: Double = 1.0e-4
|
||||
let (left, right): ([Float], [Float]) = try renderStereo { (pedal: JazzCleanAmpPedal) in
|
||||
pedal.gain = 30.0
|
||||
pedal.gain = 11.0
|
||||
pedal.bass = 1.0
|
||||
pedal.treble = 1.0
|
||||
pedal.reverb = 1.0
|
||||
|
||||
@@ -49,8 +49,8 @@ struct ModernHighGainAmpPedalTests {
|
||||
|
||||
@Test func buildsNonSilentFiniteWithinCeiling() throws {
|
||||
let hot: [Float] = try render { (p: ModernHighGainAmpPedal) in
|
||||
p.gain = 30.0; p.bass = 1.0; p.treble = 1.0; p.master = 1.0; p.channel = 1.0
|
||||
p.drive = 30.0; p.sag = 1.0; p.tight = 1.0
|
||||
p.gain = 11.0; p.bass = 1.0; p.treble = 1.0; p.master = 1.0; p.channel = 1.0
|
||||
p.drive = 11.0; p.sag = 1.0; p.tight = 1.0
|
||||
}
|
||||
#expect(hasNonSilentOutput(hot) && hot.allSatisfy { $0.isFinite })
|
||||
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
|
||||
@@ -58,8 +58,8 @@ struct ModernHighGainAmpPedalTests {
|
||||
}
|
||||
|
||||
@Test func sagChangesOutput() throws {
|
||||
let stiff: [Float] = try render { $0.gain = 20.0; $0.channel = 1.0; $0.sag = 0.0 }
|
||||
let saggy: [Float] = try render { $0.gain = 20.0; $0.channel = 1.0; $0.sag = 1.0 }
|
||||
let stiff: [Float] = try render { $0.gain = 9.8; $0.channel = 1.0; $0.sag = 0.0 }
|
||||
let saggy: [Float] = try render { $0.gain = 9.8; $0.channel = 1.0; $0.sag = 1.0 }
|
||||
#expect(windowedSSD(stiff, saggy) > 0, "Sag had no effect")
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ struct ModernHighGainAmpPedalTests {
|
||||
// must stay positive (attenuation), never go negative (phase inversion). Assert the sag'd
|
||||
// output correlates positively with the stiff one (not an inverted copy).
|
||||
let cfg: (ModernHighGainAmpPedal) -> Void = { (p: ModernHighGainAmpPedal) in
|
||||
p.gain = 20.0; p.channel = 1.0; p.presence = 1.0; p.depth = 1.0
|
||||
p.gain = 9.8; p.channel = 1.0; p.presence = 1.0; p.depth = 1.0
|
||||
}
|
||||
let stiff: [Float] = try render { cfg($0); $0.sag = 0.0 }
|
||||
let saggy: [Float] = try render { cfg($0); $0.sag = 1.0 }
|
||||
@@ -111,11 +111,11 @@ struct ModernHighGainAmpPedalTests {
|
||||
@Test func controlsRoundTripThroughState() throws {
|
||||
let pedal: ModernHighGainAmpPedal = ModernHighGainAmpPedal()
|
||||
pedal.sag = 0.8; pedal.tight = 1.0; pedal.channel = 1.0
|
||||
pedal.drive = 20.0; pedal.master = 0.7; pedal.cab = 2.0
|
||||
pedal.drive = 9.8; pedal.master = 0.7; pedal.cab = 2.0
|
||||
let restored: ModernHighGainAmpPedal = ModernHighGainAmpPedal()
|
||||
restored.applyState(pedal.captureState())
|
||||
#expect(restored.sag == 0.8 && restored.tight == 1.0 && restored.channel == 1.0)
|
||||
#expect(restored.drive == 20.0 && restored.master == 0.7 && restored.cab == 2.0)
|
||||
#expect(restored.drive == 9.8 && restored.master == 0.7 && restored.cab == 2.0)
|
||||
}
|
||||
|
||||
@Test func registeredInBuiltInRegistry() throws {
|
||||
|
||||
Reference in New Issue
Block a user