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:
2026-08-04 10:42:35 -07:00
parent da2c3328ee
commit f9ddd6b160
41 changed files with 151 additions and 106 deletions
@@ -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 {