10 Commits

Author SHA1 Message Date
josh 2fd7eaee57 release: finalize 3.0.0 changelog (date 2026-08-04) 2026-08-05 14:14:32 -07:00
josh 654e80e9c8 docs(help): add Amp Models + Cabinets & Microphones help sections
Two new in-app Help topics for the 3.0 amp features:
- Amp Models: picking an amp, the 1–11 Gain taper, Master (power-amp drive)
  vs Level (clean trim), analog soft-limiting, and the advanced pop-over
  (Sag / Bias / Bias X) reached via the top-right sliders button.
- Cabinets & Microphones: an amp's built-in cab vs a standalone Cabinet
  pedal ("None (direct)" + a Cabinet after the amp), cab/mic voicing, and
  the mic-placement + dual-mic pop-over (Position / Proximity / Mic B /
  Blend / Offset). Notes the models are original DSP, not captures.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-05 14:12:52 -07:00
josh 292261a088 refactor(ui): make widthUnits mean "base width in columns" + tidy overrides
Follow-up cleanup now that card width is content-derived. Redefine widthUnits
as the card's base width in knob columns (1 = 3-wide, 2 = 4-wide) — both the
knob-grid column count and the card's minimum width — with selector/switch rows
able to push wider. Values above 2 no longer do anything.

- Delete the now-misleading widthUnits 3/4 overrides on 11 amps; they inherit
  AmpVoicePedal's 2 (all full-surface amps → the same tight 4-wide card).
- Remove Mutant's redundant override (2 knobs + 2 switches → 3-wide either way).
- Cabinet: keep widthUnits 2 so it's 4-wide like the amps — its Cab/Mic/Mic B
  selector captions (voice names) need the room to stay readable (per request).
- Looper keeps widthUnits 3 (the one pedal still using the flat multiple for its
  bespoke timeline/knobs/transport layout).
- Refresh the widthUnits docs (base + AmpVoicePedal + Cabinet); update the amp
  tests' widthUnits assertions (3/4 → 2; Looper stays 3).

675 tests pass; no visual change to the amps, Cabinet now matches their width.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-05 09:05:40 -07:00
josh a1ce308082 ui(layout): size pedal card width to content, not widthUnits × base
Cards were `220 × widthUnits` wide, so control-sparse multi-unit pedals sat
mostly empty (a 3-unit amp was 660px for a 4-knob row needing ~270; the
2-unit Cabinet was 440 for three selectors). Size the enclosure to its widest
actual row instead — knob grid (columns capped by widthUnits), inline
selectors, or switches — floored at the 3-slot Level·Bypass·Mix footer, and
still widened for a vertical-fader bank. New: Cabinet 440→252, Bluesbreaker
660→330, Boutique/Dual 880→330; 1-unit pedals ~252.

widthUnits now only sets the knob-column cap (≥2 packs 4 across), not raw
width, so all 4-knob amps land at the same tight width regardless of their
3/4 unit value. The looper keeps the flat multiple — its bespoke three-column
timeline/knobs/transport layout genuinely needs the wide card.

675 tests pass (view geometry; no logic change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-04 19:02:50 -07:00
josh 685bf5833e docs(changelog): note the Noise Gate pop fix + Attack/Release under 3.0.0 2026-08-04 16:45:46 -07:00
josh 5a3cbeb372 fix(noise-gate): smooth asymmetric close + Attack/Release knobs
Reported bug: a sustained note popped into a different tone mid-decay (~3.63s
in the user's recording). Root cause confirmed by rendering the user's rig with
their input file: the gate keyed off the raw guitar and, as a note decayed
through the threshold, snapped its gain 1.0 -> floor in ~10 ms (symmetric 10 ms
Lag). With heavy downstream gain (the rig's Fuzz, ~50x) amplifying that step,
the ~-9 dB duck read as an audible pop.

Fix: replace the symmetric Lag with an asymmetric LagUpDown — fast open (so a
note's attack isn't softened) / slow close (fades the gate shut and rides out
envelope chatter at the threshold). Verified against the user's input file: the
gate gain now fades 1.0 -> floor smoothly over ~70 ms, monotonic, no snap.

Feature (per request): expose Attack (open) and Release (close) time as knobs
in the advanced pop-over rather than a separate near-duplicate "Vari" gate.
Placed in advancedKnobs so they persist append-only in advancedValues — gates
saved before this load with the timing at defaults, no migration (verified by
test). Release default 0.08 = the smooth close; range 10 ms..500 ms.

Tests: gate close lingers longer with a longer Release and the default lingers
well past a fast close (guards the pop fix + the Release control); Attack/
Release exposed in the pop-over (not the face), round-trip through state, and a
legacy no-advancedValues preset defaults the timing. 675 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-04 16:41:27 -07:00
josh 11ce3f47d2 ui(palette): move Cabinet to row 2 between Routing and Amp Model
The Cabinet got its own category (row 1, effects) in the last change; move it
to the second row so the rig-structure blocks read left-to-right as
Routing | Cabinet | Amp Model. Split a cabinetGroup out of effectGroups and
render it between the Routing cards and the amp group in the horizontal picker.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-04 11:48:18 -07:00
josh da68864f36 chore(release): prep 3.0.0 — amp-modeling suite (no tag yet)
Stamp the amp-modeling release as 3.0.0 (headline major on top of the last
released v2.1.3):

- MARKETING_VERSION -> 3.0.0 on both ShoeGazeBuilder (macOS, was a stray 2.1.6)
  and ShoeGazeBuilderiOS (was 2.0.0); bump build numbers.
- CHANGELOG: add the [3.0.0] entry rolling up the whole amp cycle (26 amps +
  onboard FX, analog output limiting, master volume, Sag/Bias/Bias X pop-over,
  cabinet mic modeling + placement + dual-mic, decoupled cab, 1–11 gain taper,
  palette Amp/Cabinet categories). Dated "Unreleased".

No git tag — the maintainer will tag v3.0.0 after play-testing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-04 11:23:26 -07:00
josh ebc660898d docs(amp): reattach powerAmpDrive comment after the dial constants 2026-08-04 10:47:47 -07:00
josh f9ddd6b160 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>
2026-08-04 10:42:35 -07:00
52 changed files with 468 additions and 189 deletions
+65
View File
@@ -4,6 +4,71 @@ All notable changes to ShoeGaze are recorded here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
[semantic versioning](https://semver.org/spec/v2.0.0.html). [semantic versioning](https://semver.org/spec/v2.0.0.html).
## [3.0.0] — 2026-08-04
The big one: ShoeGaze becomes an amp-modeling rig. This release adds a full lineup of
tube-amp voices — each with its own tone stack, onboard effects, and control surface —
plus a deep speaker-cabinet and microphone section. Everything is original DSP built in
code from the Lyrebird engine; there are no third-party captures or IR packs.
### Added
- **26 amp-model pedals**, grouped in their own **Amp Model** palette category:
- **Fullerton** blackface combos — Fullerton Reverb, Deluxe, Ivy League, Drive — with
spring reverb, tremolo, and a Bright switch.
- **California** and **Jazz Clean** clean machines.
- **British** stack and combo voices — British, Plexi, JTM, Bluesbreaker, Master, Dual —
from early crunch to hot-rodded master-volume lead.
- **Chime** top-boost family — Chime, Chime 15, Chime Normal, Chime Baby, Chime Top
Boost — with the classic Cut control.
- **Boutique and high-gain** — Boutique Lead, Boutique OD, Cali Hi-Gain (with an onboard
5-band graphic EQ), and Modern High-Gain (Sag + Tight).
- **Character amps** — Command, Citrus, Sixties Combo, Magna Vibrato (true pitch
vibrato), and Anaheim (a solid-state-preamp / tube-power-amp hybrid with a built-in
limiter).
Each amp carries its own tone-stack voicing, a selectable speaker cabinet, and a real
**master volume** that drives the power-amp stage — not just an output trim.
- **Analog-style output limiting.** Every amp ends in a soft `tanh` saturation into a hard
±1 ceiling, so a driven amp compresses like the real thing instead of digitally clipping.
- **Power-amp feel controls**, tucked behind an advanced pop-over (the sliders button at the
top-right of the amp card): **Sag** (power-supply droop and bloom), **Bias**, and **Bias X**
(bias balance).
- **A full speaker-cabinet and microphone section** on the Cabinet pedal, now in its own
**Cabinet** palette category next to the amps:
- **Cabinet voices** — eight synthesized speaker voicings.
- **Microphone modeling** — No Mic / Dynamic / Ribbon / Condenser, folded into the cab
response.
- **Mic placement** — Position (on-axis ↔ cone edge) and Proximity (distance / bass lift).
- **Dual-mic blend** — add a second mic with its own blend and spacing (comb) control,
the classic two-mic technique.
- A transparent look-ahead limiter on the cabinet output.
### Changed
- **Gain and Drive now read 1–11** — yes, they go to eleven — with a musical taper: fine
control at the bottom of the dial, full saturation at the top, instead of a raw internal
number.
- **The cabinet is now a separate pedal you place in the chain.** Amps keep a built-in cab,
plus a **None (direct)** option so you can run a dedicated Cabinet block (and, later, your
own impulse response) after the amp.
- **Palette:** the Amp Model and Cabinet categories sit together, and the Cabinet card is
double-width to fit its cab / mic / second-mic selectors.
### Fixed
- **Noise Gate no longer pops as a note decays.** The gate now opens fast and closes gently
(a slow, tunable fade) instead of snapping shut when a sustained note falls through the
threshold — previously that abrupt step, amplified by downstream gain (e.g. a fuzz), was
audible as a pop / sudden tone change. New **Attack** and **Release** timing knobs (in the
gate's advanced pop-over) dial the close from tight to a gradual swell.
### Notes
- All amp, cabinet, and microphone models are original DSP generated in code — not captures
of any specific hardware, speaker, microphone, or IR pack. Tube tone stacks follow the
published Yeh & Smith analysis of the classic passive tone-stack circuit.
## [2.1.3] — 2026-07-13 ## [2.1.3] — 2026-07-13
A tuner fix. Engaging the chromatic tuner could crackle or pop through the output — A tuner fix. Engaging the chromatic tuner could crackle or pop through the output —
@@ -163,7 +163,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -175,7 +175,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 2.1.6; MARKETING_VERSION = 3.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@@ -193,7 +193,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = ShoeGazeBuilder/Info.plist; INFOPLIST_FILE = ShoeGazeBuilder/Info.plist;
@@ -204,7 +204,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 2.1.6; MARKETING_VERSION = 3.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilder;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_EMIT_LOC_STRINGS = YES;
@@ -165,7 +165,7 @@
CODE_SIGNING_REQUIRED = NO; CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements; CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 8;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist; INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze; INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze;
@@ -175,7 +175,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 2.0.0; MARKETING_VERSION = 3.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos; SDKROOT = iphoneos;
@@ -194,7 +194,7 @@
CODE_SIGNING_REQUIRED = NO; CODE_SIGNING_REQUIRED = NO;
CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements; CODE_SIGN_ENTITLEMENTS = ShoeGazeBuilderiOS/ShoeGazeBuilderiOS.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7; CURRENT_PROJECT_VERSION = 8;
INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist; INFOPLIST_FILE = ShoeGazeBuilderiOS/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze; INFOPLIST_KEY_CFBundleDisplayName = ShoeGaze;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.music";
@@ -203,7 +203,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 2.0.0; MARKETING_VERSION = 3.0.0;
PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS; PRODUCT_BUNDLE_IDENTIFIER = net.realizedsound.ShoeGazeBuilderiOS;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos; SDKROOT = iphoneos;
+6 -2
View File
@@ -143,8 +143,12 @@ open class Pedal: SynthesizerBase {
open func rigWillTeardown() {} open func rigWillTeardown() {}
/// Number of standard enclosure widths this pedal's card occupies in the UI. Defaults /// Number of standard enclosure widths this pedal's card occupies in the UI. Defaults
/// to `1`. A control-dense pedal (e.g. the looper) overrides to `2` for a wider card. /// to `1`. This sets the card's **base width in knob columns**: `1` = a three-wide card, `≥ 2` =
/// The UI multiplies its base enclosure width by this factor; `1` is the normal stompbox. /// four-wide (and the knob grid packs that many across). It is both the grid's column count and
/// the card's minimum width, so a `2` pedal is a four-wide card even with few knobs (e.g. the
/// Cabinet, to keep its selector captions readable). A pedal whose selector/switch row is wider
/// still pushes wider; values above `2` add nothing. (The looper is the sole exception: it
/// overrides the UI to a fixed multi-column layout scaled by this value.)
open var widthUnits: Int { 1 } open var widthUnits: Int { 1 }
/// `true` when the board has placed this pedal in a stereo (width-2) region. /// `true` when the board has placed this pedal in a stereo (width-2) region.
@@ -41,8 +41,10 @@ open class AmpVoicePedal: Pedal {
// MARK: - Common parameters // MARK: - Common parameters
/// Preamp drive into the first tube stage. Range [1, 30]. /// Preamp **Gain** dial in `[1, 11]` (yes, it goes to eleven). Mapped to the tube-drive range
@UIParam public var gain: Double = 6.0 /// `[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]. /// Tone-stack bass control in [0, 1].
@UIParam public var bass: Double = 0.5 @UIParam public var bass: Double = 0.5
/// Tone-stack mid control in [0, 1]. /// Tone-stack mid control in [0, 1].
@@ -152,7 +154,19 @@ open class AmpVoicePedal: Pedal {
/// - Parameter signal: The post-`inputShaping` input signal. /// - Parameter signal: The post-`inputShaping` input signal.
/// - Returns: The preamp output fed into the tone stack. /// - Returns: The preamp output fed into the tone stack.
open func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { 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 /// Drive into the power-amp `TriodeStage`. Defaults to the fixed power-amp drive. Two kinds of
@@ -238,6 +252,13 @@ open class AmpVoicePedal: Pedal {
/// Generic `PedalSwitch` off / on values, shared by every amp that publishes switches. /// Generic `PedalSwitch` off / on values, shared by every amp that publishes switches.
let switchOffValue: Double = 0.0 let switchOffValue: Double = 0.0
let switchOnValue: Double = 1.0 let switchOnValue: Double = 1.0
/// 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
/// Fixed power-amp stage drive (gentler than the preamp). /// Fixed power-amp stage drive (gentler than the preamp).
private let powerAmpDrive: Double = 1.5 private let powerAmpDrive: Double = 1.5
/// Power-amp grid bias at `bias = 0` (coldest) and `bias = 1` (hottest). Symmetric about `0`, so /// Power-amp grid bias at `bias = 0` (coldest) and `bias = 1` (hottest). Symmetric about `0`, so
@@ -274,7 +295,7 @@ open class AmpVoicePedal: Pedal {
/// just above ±1, guaranteeing the amp stage never emits a sample the DAC would clip. /// just above ±1, guaranteeing the amp stage never emits a sample the DAC would clip.
private let outputCeiling: Double = 1.0 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 let toneRange: ClosedRange<Double> = 0.0 ... 1.0
/// Range for a signature control that maps [0, 1] (Bright / Presence / Cut amount). /// Range for a signature control that maps [0, 1] (Bright / Presence / Cut amount).
let signatureRange: ClosedRange<Double> = 0.0 ... 1.0 let signatureRange: ClosedRange<Double> = 0.0 ... 1.0
@@ -295,7 +316,8 @@ open class AmpVoicePedal: Pedal {
/// The amp is fully wet (it replaces the dry signal); hide the Mix control. /// The amp is fully wet (it replaces the dry signal); hide the Mix control.
public override var showsMixControl: Bool { false } public override var showsMixControl: Bool { false }
/// Amp-head-style double-width card. /// Amps use a four-wide knob grid for their Gain/Bass/Mid/Treble + signature controls (the card
/// width is sized to content — see `PedalView.enclosureWidth`).
public override var widthUnits: Int { 2 } public override var widthUnits: Int { 2 }
public override var summary: String { summaryText } public override var summary: String { summaryText }
@@ -75,9 +75,6 @@ public final class AnaheimAmpPedal: AmpVoicePedal {
] ]
} }
/// Wider card for the three switches.
public override var widthUnits: Int { 3 }
/// Creates an Anaheim amp. /// Creates an Anaheim amp.
/// ///
/// - Parameters: /// - Parameters:
@@ -85,7 +82,7 @@ public final class AnaheimAmpPedal: AmpVoicePedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Anaheim", inputBus: inputBus, outputBus: outputBus) 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 cab = 0.0 // American 1×12
} }
@@ -98,7 +95,7 @@ public final class AnaheimAmpPedal: AmpVoicePedal {
/// Symmetric (solid-state-flavoured) preamp stage — `bias 0`, no even-harmonic tube warmth. /// Symmetric (solid-state-flavoured) preamp stage — `bias 0`, no even-harmonic tube warmth.
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { 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 /// 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 @UIParam public var depth: Double = 0.3
/// Master volume in [0, 1] → power-amp drive in [`masterMinDrive`, `masterMaxDrive`]. /// Master volume in [0, 1] → power-amp drive in [`masterMinDrive`, `masterMaxDrive`].
@UIParam public var master: Double = 0.5 @UIParam public var master: Double = 0.5
/// Lead-channel preamp gain (the cascaded stage). Range [1, 30]. /// Lead-channel preamp gain (the cascaded stage). Dial [1, 11], tapered to tube drive.
@UIParam public var drive: Double = 10.0 @UIParam public var drive: Double = 7.77
/// Channel select: `0` = Clean, `1` = Lead (the cascaded gain stage). /// Channel select: `0` = Clean, `1` = Lead (the cascaded gain stage).
@UIParam public var channel: Double = 0.0 @UIParam public var channel: Double = 0.0
@@ -38,7 +38,7 @@ open class BoutiqueAmpPedal: AmpVoicePedal {
private let masterMaxDrive: Double = 5.0 private let masterMaxDrive: Double = 5.0
private let channelThreshold: Double = 0.5 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 toneStackModel: ToneStackModel { .marshall }
public override var signatureKnobs: [PedalKnob] { public override var signatureKnobs: [PedalKnob] {
@@ -70,15 +70,12 @@ open class BoutiqueAmpPedal: AmpVoicePedal {
} }
public override var powerAmpOversample: Int { 4 } 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 /// 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. /// board-build time (the switch is `rebuildsOnChange`), so only the selected channel is built.
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let clean: any ValidGeneratorInput = super.preampStage(signal) let clean: any ValidGeneratorInput = super.preampStage(signal)
guard channel >= channelThreshold else { return clean } 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. /// 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Boutique Lead", inputBus: inputBus, outputBus: outputBus) super.init(name: "Boutique Lead", inputBus: inputBus, outputBus: outputBus)
gain = 6.0 gain = 6.27
drive = 14.0 // hot singing lead drive = 8.76 // hot singing lead
cab = 1.0 // British 4×12 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Boutique OD", inputBus: inputBus, outputBus: outputBus) super.init(name: "Boutique OD", inputBus: inputBus, outputBus: outputBus)
gain = 5.0 gain = 5.73
drive = 10.0 drive = 7.77
cab = 0.0 // American 1×12 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "British", inputBus: inputBus, outputBus: outputBus) 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 cab = 1.0 // default to the British 4×12 cab
} }
@@ -36,9 +36,6 @@ public final class BritishBluesbreakerAmpPedal: BritishComboAmpPedal {
] ]
} }
/// Wider card for the extra tremolo knobs plus the Bright and Tremolo switches.
public override var widthUnits: Int { 3 }
/// The base Bright switch plus a Tremolo footswitch (compose `super` so Bright stays in sync). /// The base Bright switch plus a Tremolo footswitch (compose `super` so Bright stays in sync).
public override var effectSwitches: [PedalSwitch] { public override var effectSwitches: [PedalSwitch] {
super.effectSwitches + [ super.effectSwitches + [
@@ -60,7 +57,7 @@ public final class BritishBluesbreakerAmpPedal: BritishComboAmpPedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "British Bluesbreaker", inputBus: inputBus, outputBus: outputBus) 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) 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`]. /// Master volume in [0, 1] → power-amp drive in [`masterMinDrive`, `masterMaxDrive`].
@UIParam public var master: Double = 0.5 @UIParam public var master: Double = 0.5
/// Lead-channel preamp gain (the cascaded stage). Range [1, 30]. /// Lead-channel preamp gain (the cascaded stage). Dial [1, 11], tapered to tube drive.
@UIParam public var drive: Double = 8.0 @UIParam public var drive: Double = 7.11
/// Spring-reverb wet mix in [0, 1]. /// Spring-reverb wet mix in [0, 1].
@UIParam public var reverb: Double = 0.2 @UIParam public var reverb: Double = 0.2
/// Channel select: `0` = Clean, `1` = Lead (the cascaded gain stage). /// 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 private let masterMaxDrive: Double = 5.0
/// Channel-select threshold: `>= this` selects the Lead channel. /// Channel-select threshold: `>= this` selects the Lead channel.
private let channelThreshold: Double = 0.5 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 private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0
public override var summaryText: String { public override var summaryText: String {
@@ -63,9 +63,6 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
} }
public override var powerAmpOversample: Int { 4 } public override var powerAmpOversample: Int { 4 }
/// Wider card for the extra Master/Drive/Reverb knobs plus the Bright and Channel switches.
public override var widthUnits: Int { 4 }
/// Creates a British Dual amp. /// Creates a British Dual amp.
/// ///
/// - Parameters: /// - Parameters:
@@ -73,7 +70,7 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "British Dual", inputBus: inputBus, outputBus: outputBus) super.init(name: "British Dual", inputBus: inputBus, outputBus: outputBus)
gain = 5.0 gain = 5.73
cab = 1.0 // British 4×12 cab = 1.0 // British 4×12
} }
@@ -82,7 +79,7 @@ public final class BritishDualAmpPedal: BritishComboAmpPedal {
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let clean: any ValidGeneratorInput = super.preampStage(signal) let clean: any ValidGeneratorInput = super.preampStage(signal)
guard channel >= channelThreshold else { return clean } 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). /// 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "British JTM", inputBus: inputBus, outputBus: outputBus) 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 treble = 0.5 // a shade rounder on top
cab = 1.0 // British 4×12 cab = 1.0 // British 4×12
} }
@@ -34,9 +34,6 @@ public final class BritishMasterAmpPedal: BritishComboAmpPedal {
} }
public override var powerAmpOversample: Int { 4 } public override var powerAmpOversample: Int { 4 }
/// Wider card for the Presence/Master knobs plus the Bright switch.
public override var widthUnits: Int { 3 }
/// Creates a British Master amp. /// Creates a British Master amp.
/// ///
/// - Parameters: /// - Parameters:
@@ -44,13 +41,13 @@ public final class BritishMasterAmpPedal: BritishComboAmpPedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "British Master", inputBus: inputBus, outputBus: outputBus) 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 cab = 1.0 // British 4×12
} }
/// Cascaded two-stage preamp: the base stage, then a second `TriodeStage` also driven by `Gain`. /// Cascaded two-stage preamp: the base stage, then a second `TriodeStage` also driven by `Gain`.
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let stage1: any ValidGeneratorInput = super.preampStage(signal) 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "British Plexi", inputBus: inputBus, outputBus: outputBus) 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 cab = 1.0 // British 4×12
} }
} }
@@ -51,8 +51,8 @@ public final class CabinetPedal: Pedal {
"Speaker-cabinet impulse-response convolution with selectable built-in voicings." "Speaker-cabinet impulse-response convolution with selectable built-in voicings."
} }
/// Double-width card — three selectors (Cab / Mic / Mic B) need the room; at single width the /// Four-wide card (same as the amps), so the Cab / Mic / Mic B selector captions — cabinet and
/// dials crowd and the leading selector's caption clips. /// mic voice names — stay readable rather than crowding.
public override var widthUnits: Int { 2 } public override var widthUnits: Int { 2 }
// MARK: - Parameters // MARK: - Parameters
@@ -62,8 +62,8 @@ public final class CaliHiGainAmpPedal: BoutiqueAmpPedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Cali Hi-Gain", inputBus: inputBus, outputBus: outputBus) super.init(name: "Cali Hi-Gain", inputBus: inputBus, outputBus: outputBus)
gain = 6.0 gain = 6.27
drive = 16.0 // hot Mark-style lead drive = 9.15 // hot Mark-style lead
cab = 1.0 // British 4×12 — tight and aggressive 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "California", inputBus: inputBus, outputBus: outputBus) 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 { 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public convenience init(inputBus: Int = 0, outputBus: Int = 0) { public convenience init(inputBus: Int = 0, outputBus: Int = 0) {
self.init(name: "Chime", inputBus: inputBus, outputBus: outputBus) self.init(name: "Chime", inputBus: inputBus, outputBus: outputBus)
gain = 5.0 gain = 5.73
} }
public override func shapeVoice(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Chime Baby", inputBus: inputBus, outputBus: outputBus) super.init(name: "Chime Baby", inputBus: inputBus, outputBus: outputBus)
gain = 6.0 gain = 6.27
bass = 0.4 // small speaker, less low end bass = 0.4 // small speaker, less low end
cab = 7.0 // Lo-Fi 1×8 — the small, boxy voice 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Chime 15", inputBus: inputBus, outputBus: outputBus) 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 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Chime Normal", inputBus: inputBus, outputBus: outputBus) 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 treble = 0.5 // rounder top than the top-boost voice
cut = 0.3 // a shade darker by default cut = 0.3 // a shade darker by default
cab = 0.0 // American 1×12 — plainer than the bright cab cab = 0.0 // American 1×12 — plainer than the bright cab
@@ -65,9 +65,6 @@ public final class ChimeTopBoostAmpPedal: AmpVoicePedal {
] ]
} }
/// Wider card for the extra Cut/tremolo knobs plus the Brilliant and Tremolo switches.
public override var widthUnits: Int { 3 }
// MARK: - Init // MARK: - Init
/// Creates a Chime Top Boost amp. /// Creates a Chime Top Boost amp.
@@ -77,7 +74,7 @@ public final class ChimeTopBoostAmpPedal: AmpVoicePedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Chime Top Boost", inputBus: inputBus, outputBus: outputBus) 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 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Citrus", inputBus: inputBus, outputBus: outputBus) super.init(name: "Citrus", inputBus: inputBus, outputBus: outputBus)
gain = 6.0 gain = 6.27
cab = 1.0 // British 4×12 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Command", inputBus: inputBus, outputBus: outputBus) 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 treble = 0.55 // a touch of hi-fi top
cab = 1.0 // British 4×12 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Fullerton Deluxe", inputBus: inputBus, outputBus: outputBus) 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 bass = 0.45 // a touch less low end than the 2×12
cab = 0.0 // American 1×12 cab = 0.0 // American 1×12
} }
@@ -19,8 +19,8 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
/// Spring-reverb wet mix in [0, 1]. /// Spring-reverb wet mix in [0, 1].
@UIParam public var reverb: Double = 0.25 @UIParam public var reverb: Double = 0.25
/// Drive-channel preamp gain (the cascaded overdrive stage). Range [1, 30]. /// Drive-channel preamp gain (the cascaded overdrive stage). Dial [1, 11], tapered to tube drive.
@UIParam public var drive: Double = 8.0 @UIParam public var drive: Double = 7.11
/// Bright switch: `0` = flat, `1` = treble shelf engaged. /// Bright switch: `0` = flat, `1` = treble shelf engaged.
@UIParam public var bright: Double = 0.0 @UIParam public var bright: Double = 0.0
/// Channel select: `0` = Clean, `1` = Drive (the cascaded overdrive stage). /// 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 channelThreshold: Double = 0.5
private let reverbRange: ClosedRange<Double> = 0.0 ... 1.0 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 toneStackModel: ToneStackModel { .fender }
public override var summaryText: String { public override var summaryText: String {
@@ -48,9 +48,6 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
] ]
} }
/// Wider card for the Reverb/Drive knobs plus the Bright and Channel switches.
public override var widthUnits: Int { 3 }
public override var effectSwitches: [PedalSwitch] { public override var effectSwitches: [PedalSwitch] {
[ [
PedalSwitch( PedalSwitch(
@@ -80,7 +77,7 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Fullerton Drive", inputBus: inputBus, outputBus: outputBus) super.init(name: "Fullerton Drive", inputBus: inputBus, outputBus: outputBus)
gain = 4.0 gain = 5.08
cab = 0.0 // American 1×12 cab = 0.0 // American 1×12
} }
@@ -97,7 +94,7 @@ public final class FullertonDriveAmpPedal: AmpVoicePedal {
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let clean: any ValidGeneratorInput = super.preampStage(signal) let clean: any ValidGeneratorInput = super.preampStage(signal)
guard channel >= channelThreshold else { return clean } 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). /// 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Fullerton Ivy League", inputBus: inputBus, outputBus: outputBus) 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 bass = 0.4 // least low end of the trio
treble = 0.55 // a shade darker treble = 0.55 // a shade darker
cab = 2.0 // Vintage Dark — the small, dark 1×10 voice cab = 2.0 // Vintage Dark — the small, dark 1×10 voice
@@ -68,9 +68,6 @@ open class FullertonReverbAmpPedal: AmpVoicePedal {
] ]
} }
/// Wider card to hold the extra reverb/tremolo knobs plus the Bright switch.
public override var widthUnits: Int { 3 }
// MARK: - Init // MARK: - Init
/// Creates a Fullerton Reverb amp. /// Creates a Fullerton Reverb amp.
@@ -83,7 +80,7 @@ open class FullertonReverbAmpPedal: AmpVoicePedal {
/// inheriting the shared reverb + tremolo + bright control surface. /// inheriting the shared reverb + tremolo + bright control surface.
public convenience init(inputBus: Int = 0, outputBus: Int = 0) { public convenience init(inputBus: Int = 0, outputBus: Int = 0) {
self.init(name: "Fullerton Reverb", inputBus: inputBus, outputBus: outputBus) 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 // MARK: - Switches
@@ -38,8 +38,8 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
@UIParam public var bright: Double = 0.0 @UIParam public var bright: Double = 0.0
/// Chorus footswitch: `1` = chorus engaged (stereo), `0` = bypassed (dry, mono-equivalent). /// Chorus footswitch: `1` = chorus engaged (stereo), `0` = bypassed (dry, mono-equivalent).
@UIParam public var chorusEnabled: Double = 1.0 @UIParam public var chorusEnabled: Double = 1.0
/// Drive-channel preamp gain (the onboard distortion). Range [1, 30]. /// Drive-channel preamp gain (the onboard distortion). Dial [1, 11], tapered to tube drive.
@UIParam public var drive: Double = 8.0 @UIParam public var drive: Double = 7.11
/// Channel select: `0` = Clean, `1` = Distortion (the cascaded onboard-distortion stage). /// Channel select: `0` = Clean, `1` = Distortion (the cascaded onboard-distortion stage).
@UIParam public var channel: Double = 0.0 @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 reverbRange: ClosedRange<Double> = 0.0 ... 1.0
private let chorusRateRange: ClosedRange<Double> = 0.1 ... 5.0 private let chorusRateRange: ClosedRange<Double> = 0.1 ... 5.0
private let chorusDepthRange: ClosedRange<Double> = 0.0005 ... 0.015 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 // MARK: - Voice configuration
@@ -82,9 +82,6 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
/// Stereo output — the chorus feeds two independent power-amp/cabinet channels. /// Stereo output — the chorus feeds two independent power-amp/cabinet channels.
public override var channelKind: PedalChannelKind { .widener } public override var channelKind: PedalChannelKind { .widener }
/// Wider card for the reverb/chorus knobs plus the Bright and Chorus switches.
public override var widthUnits: Int { 3 }
// MARK: - Init // MARK: - Init
/// Creates a Jazz Clean amp. /// Creates a Jazz Clean amp.
@@ -94,7 +91,7 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Jazz Clean", inputBus: inputBus, outputBus: outputBus) 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 cab = 6.0 // Full-Range (FRFR) — the hi-fi, least-coloured voice
} }
@@ -136,7 +133,7 @@ public final class JazzCleanAmpPedal: AmpVoicePedal {
public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput { public override func preampStage(_ signal: any ValidGeneratorInput) -> any ValidGeneratorInput {
let clean: any ValidGeneratorInput = super.preampStage(signal) let clean: any ValidGeneratorInput = super.preampStage(signal)
guard channel >= channelThreshold else { return clean } 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 // MARK: - Hooks
@@ -57,9 +57,6 @@ public final class MagnaVibratoAmpPedal: AmpVoicePedal {
] ]
} }
/// Wider card for the vibrato knobs plus the Vibrato switch.
public override var widthUnits: Int { 3 }
/// Creates a Magna Vibrato amp. /// Creates a Magna Vibrato amp.
/// ///
/// - Parameters: /// - Parameters:
@@ -67,7 +64,7 @@ public final class MagnaVibratoAmpPedal: AmpVoicePedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Magna Vibrato", inputBus: inputBus, outputBus: outputBus) 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 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`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Modern High-Gain", inputBus: inputBus, outputBus: outputBus) super.init(name: "Modern High-Gain", inputBus: inputBus, outputBus: outputBus)
gain = 7.0 gain = 6.72
drive = 18.0 // hottest lead of the lineup drive = 9.50 // hottest lead of the lineup
cab = 1.0 // British 4×12 — tight, aggressive cab = 1.0 // British 4×12 — tight, aggressive
sag = 0.3 // rectifier bloom on by default (shared power-amp Sag from AmpVoicePedal) sag = 0.3 // rectifier bloom on by default (shared power-amp Sag from AmpVoicePedal)
} }
@@ -31,10 +31,6 @@ public final class MutantPedal: Pedal {
"Envelope-following auto-wah / funk filter that opens with your picking." "Envelope-following auto-wah / funk filter that opens with your picking."
} }
/// Double-width so the two switches — Sweep (2-way) and the 3-way Mode — sit side by side
/// without cramping now that switches lay out horizontally.
public override var widthUnits: Int { 2 }
// MARK: - Parameters // MARK: - Parameters
/// Filter response selector. `0` = lowpass, `1` = bandpass, `2` = highpass. Driven by a three-state switch. /// Filter response selector. `0` = lowpass, `1` = bandpass, `2` = highpass. Driven by a three-state switch.
@@ -14,15 +14,17 @@ import LyrebirdUI
/// dry ─┬─────────────────────────────────────────────────────────┐ /// dry ─┬─────────────────────────────────────────────────────────┐
/// └→ AmplitudeFollower → Schmidt(lo: thr, hi: thr×ratio) │ /// └→ AmplitudeFollower → Schmidt(lo: thr, hi: thr×ratio) │
/// → LinLin(0…1 → floor…1) │ /// → LinLin(0…1 → floor…1) │
/// → Lag(smooth) ───────────── × ──┴→ mono out /// → LagUpDown(fast open/slow close) × ─┴→ mono out
/// ``` /// ```
/// ///
/// An `AmplitudeFollower` tracks the dry signal level. A Schmitt trigger turns that /// An `AmplitudeFollower` tracks the dry signal level. A Schmitt trigger turns that
/// envelope into an open/closed gate with hysteresis (opens above `threshold × openRatio`, /// envelope into an open/closed gate with hysteresis (opens above `threshold × openRatio`,
/// closes below `threshold`) so the gate does not chatter around the threshold. The 0/1 /// closes below `threshold`) so the gate does not chatter around the threshold. The 0/1
/// gate is mapped to a gain in `[floor, 1]` and smoothed before multiplying the dry signal: /// gate is mapped to a gain in `[floor, 1]` and smoothed **asymmetrically** — opening fast so a
/// when the gate is closed the signal is attenuated to `floor` rather than hard-muted, so /// note's attack isn't softened, closing slowly so the gate fades shut instead of snapping (a fast
/// `floor` sets how much of the quiet signal/noise tail bleeds through. /// close popped audibly when heavy downstream gain amplified the step). When the gate is closed the
/// signal is attenuated to `floor` rather than hard-muted, so `floor` sets how much of the quiet
/// signal/noise tail bleeds through.
/// ///
/// The wet/dry mix and bypass switching are handled by the `Pedal` base class. /// The wet/dry mix and bypass switching are handled by the `Pedal` base class.
/// ///
@@ -35,6 +37,8 @@ import LyrebirdUI
/// the gate. Range `[0, 0.2]`. Defaults to `0.02`. /// the gate. Range `[0, 0.2]`. Defaults to `0.02`.
/// - floor: Residual gain applied while the gate is closed, in `[0, 1]`. `0` = full /// - floor: Residual gain applied while the gate is closed, in `[0, 1]`. `0` = full
/// mute, `1` = no gating. Range `[0, 1]`. Defaults to `0.0`. /// mute, `1` = no gating. Range `[0, 1]`. Defaults to `0.0`.
/// - attack: Gate open time in seconds (advanced pop-over). Range `[0.001, 0.05]`. Defaults to `0.005`.
/// - release: Gate close time in seconds (advanced pop-over). Range `[0.01, 0.5]`. Defaults to `0.08`.
public final class NoiseGatePedal: Pedal { public final class NoiseGatePedal: Pedal {
/// One-line description shown in the picker and info panel. /// One-line description shown in the picker and info panel.
@@ -50,6 +54,15 @@ public final class NoiseGatePedal: Pedal {
/// Residual gain while closed, [0, 1]. Range [0, 1]. /// Residual gain while closed, [0, 1]. Range [0, 1].
@UIParam public var floor: Double = 0.0 @UIParam public var floor: Double = 0.0
/// Gate **Attack** (open time) in seconds — how fast the gate opens on a note. Short keeps
/// transients crisp. Range `[0.001, 0.05]`. Surfaced in the advanced pop-over.
@UIParam public var attack: Double = 0.005
/// Gate **Release** (close time) in seconds — how gradually the gate fades shut as a note decays
/// through the threshold. Short = a tight, fast gate; long = a gentle swell-down (and it rides
/// out chatter at the threshold). Range `[0.01, 0.5]`. Surfaced in the advanced pop-over.
@UIParam public var release: Double = 0.08
// MARK: - Constants // MARK: - Constants
/// Default wet/dry blend — fully wet; the gate sits in-line. /// Default wet/dry blend — fully wet; the gate sits in-line.
@@ -65,8 +78,11 @@ public final class NoiseGatePedal: Pedal {
/// below `threshold`, giving hysteresis that prevents chatter near the threshold. /// below `threshold`, giving hysteresis that prevents chatter near the threshold.
private let openRatio: Double = 2.0 private let openRatio: Double = 2.0
/// Gain-smoothing lag time, in seconds — removes the click of an instantaneous 0↔1 gate. // Gate-gain smoothing is **asymmetric** (``attack`` open / ``release`` close) so the gate opens
private let gainSmoothTime: Double = 0.01 // promptly (a new note's attack isn't softened) but closes gently. A fast symmetric close
// snapped the gain from unity to `floor` in ~10 ms, which — with heavy downstream gain
// (fuzz/boost) amplifying the step — read as an audible "pop" as a sustained note decayed
// through the threshold. A slower `release` fades the gate shut instead and rides out chatter.
/// Gate signal bounds for the `LinLin` floor map. /// Gate signal bounds for the `LinLin` floor map.
private let gateLo: Double = 0.0 private let gateLo: Double = 0.0
@@ -83,6 +99,12 @@ public final class NoiseGatePedal: Pedal {
/// Floor knob range (residual gain). /// Floor knob range (residual gain).
private let floorRange: ClosedRange<Double> = 0.0 ... 1.0 private let floorRange: ClosedRange<Double> = 0.0 ... 1.0
/// Attack (open-time) knob range, seconds.
private let attackRange: ClosedRange<Double> = 0.001 ... 0.05
/// Release (close-time) knob range, seconds.
private let releaseRange: ClosedRange<Double> = 0.01 ... 0.5
public override var effectKnobs: [PedalKnob] { public override var effectKnobs: [PedalKnob] {
[ [
PedalKnob(label: "Threshold", node: $threshold, range: thresholdRange), PedalKnob(label: "Threshold", node: $threshold, range: thresholdRange),
@@ -90,6 +112,16 @@ public final class NoiseGatePedal: Pedal {
] ]
} }
/// Timing controls, tucked behind the pedal card's advanced pop-over: **Attack** (open time) and
/// **Release** (close time). Live nodes, append-only in `advancedValues` — a gate saved before
/// these existed loads with them at their defaults, no migration.
public override var advancedKnobs: [PedalKnob] {
[
PedalKnob(label: "Attack", node: $attack, range: attackRange),
PedalKnob(label: "Release", node: $release, range: releaseRange),
]
}
// MARK: - Init // MARK: - Init
/// Creates a noise-gate pedal. /// Creates a noise-gate pedal.
@@ -141,10 +173,12 @@ public final class NoiseGatePedal: Pedal {
outHi: openGain outHi: openGain
) )
// Smooth the gain to remove the click of an instantaneous gate transition. // Smooth the gain asymmetrically: open fast (prompt on a note), close slowly (gentle fade,
let smoothed: Lag.Audio = Lag.Audio( // no pop, and it rides out chatter as the envelope hovers at the threshold).
let smoothed: LagUpDown.Audio = LagUpDown.Audio(
input: gain, input: gain,
time: gainSmoothTime lagUp: $attack,
lagDown: $release
) )
return dry * smoothed return dry * smoothed
@@ -54,9 +54,6 @@ public final class SixtiesComboAmpPedal: AmpVoicePedal {
public override var powerAmpOversample: Int { 4 } public override var powerAmpOversample: Int { 4 }
public override var powerAmpDriveInput: any ValidGeneratorInput { grittyPowerDrive } public override var powerAmpDriveInput: any ValidGeneratorInput { grittyPowerDrive }
/// Wider card for the tremolo knobs plus the Tremolo switch.
public override var widthUnits: Int { 3 }
/// Creates a Sixties Combo amp. /// Creates a Sixties Combo amp.
/// ///
/// - Parameters: /// - Parameters:
@@ -64,7 +61,7 @@ public final class SixtiesComboAmpPedal: AmpVoicePedal {
/// - outputBus: Audio bus index to write the processed output to. Defaults to `0`. /// - outputBus: Audio bus index to write the processed output to. Defaults to `0`.
public init(inputBus: Int = 0, outputBus: Int = 0) { public init(inputBus: Int = 0, outputBus: Int = 0) {
super.init(name: "Sixties Combo", inputBus: inputBus, outputBus: outputBus) 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 cab = 2.0 // Vintage Dark — small, dark
} }
+51
View File
@@ -95,6 +95,57 @@ public struct HelpView: View {
+ "the top ten map to ⌘⇧1–⌘⇧0.", + "the top ten map to ⌘⇧1–⌘⇧0.",
] ]
) )
topicSection(
icon: "amplifier",
title: "Amp Models",
intro: "Amp Model pedals are complete guitar amplifiers — preamp, tone stack, power "
+ "amp, and a built-in speaker cabinet in one pedal. They live in the Amp Model "
+ "row of the palette.",
steps: [
"Pick an amp from the Amp Model category. Each has its own voice: Gain (preamp "
+ "drive), a Bass / Mid / Treble tone stack, and a Cab selector for its "
+ "built-in speaker. Full-surface amps add signature controls — Master, "
+ "Presence, Reverb, Tremolo, a channel switch, and so on.",
"Gain (and a drive channel's Drive) read 1–11 with a musical taper: most of the "
+ "usable grit spreads across the dial, with full saturation at the top.",
"Master vs Level: Master drives the power-amp stage — turning it up saturates the "
+ "amp like a real master volume. Level is a clean output trim applied after "
+ "the amp; it changes loudness, not tone.",
"No digital clipping: every amp ends in an analog-style soft limiter, so a driven "
+ "amp compresses toward its ceiling instead of clipping harshly.",
"Advanced controls (the sliders button at the top-right of the amp card open a "
+ "pop-over): Sag, Bias, and Bias X — power-amp \"feel\" controls kept off the "
+ "main face. Sag models power-supply droop and bloom (compression and touch "
+ "response as you dig in); Bias sets the power tubes' operating point (cold = "
+ "tighter, more bite; hot = warmer, rounder); Bias X balances the push-pull "
+ "pair to shift the harmonic character. All are subtle set-and-leave voicing "
+ "controls that default to neutral.",
]
)
topicSection(
icon: "hifispeaker",
title: "Cabinets & Microphones",
intro: "Every amp has a built-in cabinet, but you can also run a dedicated Cabinet "
+ "pedal for full speaker-and-microphone control.",
steps: [
"Built-in vs standalone: an amp's Cab selector picks its onboard speaker voicing "
+ "— the quick path, one knob. For deeper control, set the amp's Cab to "
+ "\"None (direct)\" and add a Cabinet pedal after it. (On \"None\" the amp "
+ "sounds raw and fizzy by itself — expected; the Cabinet pedal is what "
+ "supplies the speaker.)",
"The Cabinet pedal's Cab selector chooses the speaker voicing, and Mic chooses the "
+ "microphone — Dynamic, Ribbon, Condenser, or No Mic. The mic colour is baked "
+ "into the same speaker response, so it costs nothing extra.",
"Mic placement (the Cabinet's advanced pop-over, again via the top-right sliders "
+ "button): Position moves the mic from on-axis (bright, on the dust cap) "
+ "toward the cone edge (darker, smoother); Proximity runs from a distant, "
+ "flat low end to a close-mic'd bass lift.",
"Dual-mic (same pop-over): set Mic B to a second microphone to blend two mics. "
+ "Mic Blend sets the A/B balance; Mic Offset spaces them apart for the comb "
+ "colour of a real two-mic setup (a set-and-leave spacing control — sweeping "
+ "it live acts like a flanger).",
]
)
topicSection( topicSection(
icon: "repeat", icon: "repeat",
title: "The Looper Pedal", title: "The Looper Pedal",
@@ -160,15 +160,21 @@ public struct PedalPaletteView: View {
} }
/// The `.amp` bucket on its own, or `nil` when no amp models are visible. Split out so the /// The `.amp` bucket on its own, or `nil` when no amp models are visible. Split out so the
/// horizontal picker can drop the (large) amp list into the ROUTING row instead of letting it /// horizontal picker can drop the (large) amp list into the second row (with Routing and the
/// stretch the head of the effects row. /// Cabinet) instead of letting it stretch the head of the effects row.
private var ampGroup: (category: PedalCategory, names: [String])? { private var ampGroup: (category: PedalCategory, names: [String])? {
groupedVisiblePedals.first { $0.category == .amp } groupedVisiblePedals.first { $0.category == .amp }
} }
/// Visible pedal groups excluding the amp models — everything the effects row shows. /// The `.cabinet` bucket on its own, or `nil` when no cabinet is visible. Sits on the second row
/// between Routing and the amp models (rig-structure controls grouped together).
private var cabinetGroup: (category: PedalCategory, names: [String])? {
groupedVisiblePedals.first { $0.category == .cabinet }
}
/// Visible pedal groups excluding the amp models and the cabinet — the actual effects row (row 1).
private var effectGroups: [(category: PedalCategory, names: [String])] { private var effectGroups: [(category: PedalCategory, names: [String])] {
groupedVisiblePedals.filter { $0.category != .amp } groupedVisiblePedals.filter { $0.category != .amp && $0.category != .cabinet }
} }
// MARK: - Body // MARK: - Body
@@ -232,6 +238,16 @@ public struct PedalPaletteView: View {
} }
} }
} }
if let cabinet: (category: PedalCategory, names: [String]) = cabinetGroup {
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
categoryLabel(cabinet.category)
HStack(alignment: .top, spacing: PedalPaletteView.rowSpacing) {
ForEach(cabinet.names, id: \.self) { name in
pedalRow(name)
}
}
}
}
if let amps: (category: PedalCategory, names: [String]) = ampGroup { if let amps: (category: PedalCategory, names: [String]) = ampGroup {
VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) { VStack(alignment: .leading, spacing: PedalPaletteView.rowSpacing) {
categoryLabel(amps.category) categoryLabel(amps.category)
+28 -9
View File
@@ -422,9 +422,12 @@ public struct PedalView: View {
// MARK: - Layout constants // MARK: - Layout constants
/// Wide enough for three ~55 pt knobs (dial + label + value) plus padding in a /// Base card width — used by the looper's fixed multi-unit layout. Other pedals size to content
/// single row, so the effect controls never overlap. /// via ``enclosureColumnWidth`` (see `enclosureWidth(for:)`).
private static let enclosureWidth: CGFloat = 220 private static let enclosureWidth: CGFloat = 220
/// Per-column width for the content-sized enclosure — one knob/selector/switch slot (a ~50 pt
/// dial plus its caption). Card width = `2·padding + columns·this + (columns−1)·knobSpacing`.
private static let enclosureColumnWidth: CGFloat = 68
private static let enclosureCornerRadius: CGFloat = 12 private static let enclosureCornerRadius: CGFloat = 12
private static let enclosurePadding: CGFloat = 14 private static let enclosurePadding: CGFloat = 14
private static let screwInset: CGFloat = 6 private static let screwInset: CGFloat = 6
@@ -958,19 +961,35 @@ public struct PedalView: View {
} }
} }
/// Enclosure width — the base stompbox width scaled by the pedal's `widthUnits` /// Enclosure width, sized to the pedal's **content** rather than a flat `widthUnits × base`
/// (a control-dense pedal such as the looper asks for a double-width card), widened /// multiple (which left control-sparse multi-unit cards — amps, the Cabinet — mostly empty).
/// further to fit a wide vertical-fader bank (e.g. a multi-band graphic EQ) so its ///
/// faders are never clipped. /// The card is `columns` wide, where `columns` is the pedal's base knob-grid width from
/// `widthUnits` (`1` → `knobColumnCount`, `≥ 2` → `wideKnobColumnCount`) — so a `widthUnits: 2`
/// pedal is always a four-wide card even if it carries fewer knobs (this is how the Cabinet
/// matches the amps so its selector captions stay readable). A pedal whose selector or switch row
/// is wider than that pushes wider still. It is widened further to fit a vertical-fader bank
/// (e.g. a multi-band graphic EQ) so its faders are never clipped.
///
/// The looper is the exception: its bespoke three-column layout (timeline · knobs · transport)
/// genuinely needs the full multi-unit width, so it keeps the flat multiple.
private func enclosureWidth(for sliders: [PedalSlider]) -> CGFloat { private func enclosureWidth(for sliders: [PedalSlider]) -> CGFloat {
let unitWidth: CGFloat = PedalView.enclosureWidth * CGFloat(max(1, pedal.widthUnits)) if pedal is LooperPedal {
return PedalView.enclosureWidth * CGFloat(max(1, pedal.widthUnits))
}
let gridColumns: Int = pedal.widthUnits >= 2 ? PedalView.wideKnobColumnCount : PedalView.knobColumnCount
let columns: Int = max(gridColumns, inlineSelectors.count, pedal.effectSwitches.count)
let contentWidth: CGFloat = 2 * PedalView.enclosurePadding
+ CGFloat(columns) * PedalView.enclosureColumnWidth
+ CGFloat(max(0, columns - 1)) * PedalView.knobSpacing
let sliderCount: Int = sliders.count let sliderCount: Int = sliders.count
guard sliderCount > 0 else { return unitWidth } guard sliderCount > 0 else { return contentWidth }
let bankContentWidth: CGFloat = let bankContentWidth: CGFloat =
CGFloat(sliderCount) * PedalView.sliderBankItemWidth CGFloat(sliderCount) * PedalView.sliderBankItemWidth
+ CGFloat(max(0, sliderCount - 1)) * PedalView.sliderBankSpacing + CGFloat(max(0, sliderCount - 1)) * PedalView.sliderBankSpacing
let needed: CGFloat = bankContentWidth + 2 * PedalView.enclosurePadding let needed: CGFloat = bankContentWidth + 2 * PedalView.enclosurePadding
return max(unitWidth, needed) return max(contentWidth, needed)
} }
/// Bottom control row: the `Level` knob, the bypass switch, and the `Mix` knob, /// Bottom control row: the `Level` knob, the bypass switch, and the `Mix` knob,
@@ -87,11 +87,35 @@ struct AmpVoicePedalTests {
@Test func gainChangesOutput() throws { @Test func gainChangesOutput() throws {
for voice in voices { for voice in voices {
let clean: [Float] = try render(voice.make) { $0.gain = 2.0 } 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") #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 { @Test func toneControlsChangeOutput() throws {
for voice in voices { for voice in voices {
let dark: [Float] = try render(voice.make) { $0.treble = 0.0; $0.bass = 1.0 } 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 let ceilingEpsilon: Double = 1.0e-4
for voice in voices { for voice in voices {
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 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: // 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 // a pure level change collapses to ~0, so a clearly-positive normalized SSD proves genuine
// power-amp saturation. // power-amp saturation.
let low: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 12.0; $0.master = 0.1 } let low: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 8.3; $0.master = 0.1 }
let high: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 12.0; $0.master = 1.0 } let high: [Float] = try render({ BritishAmpPedal() }) { $0.gain = 8.3; $0.master = 1.0 }
#expect(hasNonSilentOutput(low) && hasNonSilentOutput(high)) #expect(hasNonSilentOutput(low) && hasNonSilentOutput(high))
#expect(rmsNormalizedSSD(low, high) > 1.0e-3, "Master changed level but not tone (no power-amp saturation)") #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 { @Test func britishStaysWithinCeilingAtMaxMaster() throws {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
let hot: [Float] = try render({ BritishAmpPedal() }) { (pedal: BritishAmpPedal) in let hot: [Float] = try render({ BritishAmpPedal() }) { (pedal: BritishAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.master = 1.0 pedal.master = 1.0
@@ -187,8 +211,8 @@ struct AmpVoicePedalTests {
@Test func sagChangesOutput() throws { @Test func sagChangesOutput() throws {
for voice in voices { for voice in voices {
let stiff: [Float] = try render(voice.make) { $0.gain = 20.0; $0.sag = 0.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 = 20.0; $0.sag = 1.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") #expect(windowedSSD(stiff, saggy) > 0, "\(voice.name) Sag had no effect")
} }
} }
@@ -201,7 +225,7 @@ struct AmpVoicePedalTests {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
for voice in voices { for voice in voices {
let cfg: (AmpVoicePedal) -> Void = { (p: AmpVoicePedal) in 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 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 } 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 // 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. // waveshape change), not merely the level. RMS-normalize so a pure level difference collapses.
for voice in voices { for voice in voices {
let cold: [Float] = try render(voice.make) { $0.gain = 22.0; $0.bias = 0.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 = 22.0; $0.bias = 1.0 } let hot: [Float] = try render(voice.make) { $0.gain = 10.2; $0.bias = 1.0 }
#expect(hasNonSilentOutput(cold) && hasNonSilentOutput(hot)) #expect(hasNonSilentOutput(cold) && hasNonSilentOutput(hot))
#expect(rmsNormalizedSSD(cold, hot) > 1.0e-4, "\(voice.name) Bias changed level but not waveshape") #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 // harmonic mix (a waveshape change), not merely the level. RMS-normalize so a pure level
// difference collapses. // difference collapses.
for voice in voices { for voice in voices {
let balanced: [Float] = try render(voice.make) { $0.gain = 22.0; $0.biasX = 0.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 = 22.0; $0.biasX = 1.0 } let imbalanced: [Float] = try render(voice.make) { $0.gain = 10.2; $0.biasX = 1.0 }
#expect(hasNonSilentOutput(balanced) && hasNonSilentOutput(imbalanced)) #expect(hasNonSilentOutput(balanced) && hasNonSilentOutput(imbalanced))
#expect(rmsNormalizedSSD(balanced, imbalanced) > 1.0e-4, #expect(rmsNormalizedSSD(balanced, imbalanced) > 1.0e-4,
"\(voice.name) Bias X changed level but not waveshape") "\(voice.name) Bias X changed level but not waveshape")
@@ -256,7 +280,7 @@ struct AmpVoicePedalTests {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
for voice in voices { for voice in voices {
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in 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))) } 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") #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 let ceilingEpsilon: Double = 1.0e-4
for voice in voices { for voice in voices {
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in 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") #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))) } 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 let ceilingEpsilon: Double = 1.0e-4
for voice in voices { for voice in voices {
let hot: [Float] = try render(voice.make) { (pedal: AmpVoicePedal) in 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 pedal.cab = AmpVoicePedal.cabinetBypassValue
} }
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) } let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
@@ -401,12 +425,12 @@ struct AmpVoicePedalTests {
@Test func selectionsRoundTripThroughState() throws { @Test func selectionsRoundTripThroughState() throws {
let pedal: CaliforniaAmpPedal = CaliforniaAmpPedal() let pedal: CaliforniaAmpPedal = CaliforniaAmpPedal()
pedal.gain = 12.0 pedal.gain = 8.3
pedal.cab = 2.0 pedal.cab = 2.0
pedal.bright = 0.8 pedal.bright = 0.8
let restored: CaliforniaAmpPedal = CaliforniaAmpPedal() let restored: CaliforniaAmpPedal = CaliforniaAmpPedal()
restored.applyState(pedal.captureState()) 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") "California controls did not round-trip")
} }
@@ -84,7 +84,7 @@ struct BoutiqueAmpPedalTests {
@Test func channelSwitchChangesOutputAndRebuilds() throws { @Test func channelSwitchChangesOutputAndRebuilds() throws {
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices { for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
let clean: [Float] = try render(v.make) { $0.channel = 0.0 } 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") #expect(windowedSSD(clean, lead) > 0, "\(v.name) channel switch had no effect")
let channel: PedalSwitch? = v.make().effectSwitches.first { $0.label == "Channel" } let channel: PedalSwitch? = v.make().effectSwitches.first { $0.label == "Channel" }
#expect(channel?.rebuildsOnChange == true, "\(v.name) Channel should rebuild on change") #expect(channel?.rebuildsOnChange == true, "\(v.name) Channel should rebuild on change")
@@ -113,7 +113,7 @@ struct BoutiqueAmpPedalTests {
@Test func driveKnobChangesLeadChannel() throws { @Test func driveKnobChangesLeadChannel() throws {
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices { for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
let low: [Float] = try render(v.make) { $0.channel = 1.0; $0.drive = 2.0 } 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") #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 { @Test func stayWithinCeilingOnLeadChannel() throws {
for v: (name: String, make: () -> BoutiqueAmpPedal) in voices { for v: (name: String, make: () -> BoutiqueAmpPedal) in voices {
let hot: [Float] = try render(v.make) { (p: BoutiqueAmpPedal) in let hot: [Float] = try render(v.make) { (p: BoutiqueAmpPedal) in
p.gain = 30.0; p.bass = 1.0; p.treble = 1.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 = 30.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") #expect(peak(hot) <= 1.0 + 1.0e-4, "\(v.name) exceeds the ±1 ceiling on the lead channel")
} }
@@ -133,7 +133,7 @@ struct BoutiqueAmpPedalTests {
#expect(lead.effectKnobs.map { $0.label } #expect(lead.effectKnobs.map { $0.label }
== ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"]) == ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"])
#expect(lead.effectSwitches.map { $0.label } == ["Channel"]) #expect(lead.effectSwitches.map { $0.label } == ["Channel"])
#expect(lead.widthUnits == 4) #expect(lead.widthUnits == 2)
#expect(lead.toneStackModel == .soldano) #expect(lead.toneStackModel == .soldano)
#expect(lead.powerAmpOversample == 4) #expect(lead.powerAmpOversample == 4)
@@ -150,12 +150,12 @@ struct BoutiqueAmpPedalTests {
@Test func roundTripsThroughState() throws { @Test func roundTripsThroughState() throws {
let pedal: BoutiqueODAmpPedal = BoutiqueODAmpPedal() 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 pedal.channel = 1.0; pedal.midBoost = 1.0; pedal.cab = 2.0
let restored: BoutiqueODAmpPedal = BoutiqueODAmpPedal() let restored: BoutiqueODAmpPedal = BoutiqueODAmpPedal()
restored.applyState(pedal.captureState()) restored.applyState(pedal.captureState())
#expect(restored.presence == 0.6 && restored.depth == 0.7 && restored.master == 0.8) #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 { @Test func registeredInBuiltInRegistry() throws {
@@ -108,7 +108,7 @@ struct BritishComboAmpPedalTests {
let pedal: BritishBluesbreakerAmpPedal = BritishBluesbreakerAmpPedal() let pedal: BritishBluesbreakerAmpPedal = BritishBluesbreakerAmpPedal()
#expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Presence", "Speed", "Intensity"]) #expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Presence", "Speed", "Intensity"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Tremolo"]) #expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Tremolo"])
#expect(pedal.widthUnits == 3) #expect(pedal.widthUnits == 2)
} }
@Test func bluesbreakerTremoloIntensityChangesOutput() throws { @Test func bluesbreakerTremoloIntensityChangesOutput() throws {
@@ -129,7 +129,7 @@ struct BritishComboAmpPedalTests {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
for v: (name: String, make: () -> BritishComboAmpPedal) in voices { for v: (name: String, make: () -> BritishComboAmpPedal) in voices {
let hot: [Float] = try render(v.make) { (pedal: BritishComboAmpPedal) in let hot: [Float] = try render(v.make) { (pedal: BritishComboAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.presence = 1.0 pedal.presence = 1.0
@@ -92,14 +92,14 @@ struct BritishMasterAmpPedalTests {
let pedal: BritishMasterAmpPedal = BritishMasterAmpPedal() let pedal: BritishMasterAmpPedal = BritishMasterAmpPedal()
#expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Presence", "Master"]) #expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Presence", "Master"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright"]) #expect(pedal.effectSwitches.map { $0.label } == ["Bright"])
#expect(pedal.widthUnits == 3) #expect(pedal.widthUnits == 2)
#expect(pedal.toneStackModel == .marshall) #expect(pedal.toneStackModel == .marshall)
#expect(pedal.powerAmpOversample == 4) #expect(pedal.powerAmpOversample == 4)
} }
@Test func masterStaysWithinCeiling() throws { @Test func masterStaysWithinCeiling() throws {
let hot: [Float] = try render({ BritishMasterAmpPedal() }) { (p: BritishMasterAmpPedal) in 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") #expect(peak(hot) <= 1.0 + 1.0e-4, "British Master exceeds the ±1 ceiling")
} }
@@ -116,7 +116,7 @@ struct BritishMasterAmpPedalTests {
@Test func dualChannelSwitchChangesOutput() throws { @Test func dualChannelSwitchChangesOutput() throws {
let clean: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 0.0 } 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(hasNonSilentOutput(clean) && hasNonSilentOutput(lead))
#expect(windowedSSD(clean, lead) > 0, "channel switch had no effect") #expect(windowedSSD(clean, lead) > 0, "channel switch had no effect")
let channel: PedalSwitch? = BritishDualAmpPedal().effectSwitches.first { $0.label == "Channel" } let channel: PedalSwitch? = BritishDualAmpPedal().effectSwitches.first { $0.label == "Channel" }
@@ -125,7 +125,7 @@ struct BritishMasterAmpPedalTests {
@Test func dualDriveAndReverbAndMasterWork() throws { @Test func dualDriveAndReverbAndMasterWork() throws {
let low: [Float] = try render({ BritishDualAmpPedal() }) { $0.channel = 1.0; $0.drive = 2.0 } 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") #expect(windowedSSD(low, high) > 0, "Drive had no effect on the lead channel")
let dry: [Float] = try render({ BritishDualAmpPedal() }) { $0.reverb = 0.0 } let dry: [Float] = try render({ BritishDualAmpPedal() }) { $0.reverb = 0.0 }
let wet: [Float] = try render({ BritishDualAmpPedal() }) { $0.reverb = 0.9 } let wet: [Float] = try render({ BritishDualAmpPedal() }) { $0.reverb = 0.9 }
@@ -140,26 +140,26 @@ struct BritishMasterAmpPedalTests {
#expect(pedal.effectKnobs.map { $0.label } #expect(pedal.effectKnobs.map { $0.label }
== ["Gain", "Bass", "Mid", "Treble", "Presence", "Master", "Drive", "Reverb"]) == ["Gain", "Bass", "Mid", "Treble", "Presence", "Master", "Drive", "Reverb"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Channel"]) #expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Channel"])
#expect(pedal.widthUnits == 4) #expect(pedal.widthUnits == 2)
#expect(pedal.toneStackModel == .marshall) #expect(pedal.toneStackModel == .marshall)
#expect(pedal.powerAmpOversample == 4) #expect(pedal.powerAmpOversample == 4)
} }
@Test func dualStaysWithinCeilingOnLeadChannel() throws { @Test func dualStaysWithinCeilingOnLeadChannel() throws {
let hot: [Float] = try render({ BritishDualAmpPedal() }) { (p: BritishDualAmpPedal) in 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.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 = 30.0; p.reverb = 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") #expect(peak(hot) <= 1.0 + 1.0e-4, "British Dual exceeds the ±1 ceiling on the lead channel")
} }
@Test func dualRoundTrips() throws { @Test func dualRoundTrips() throws {
let pedal: BritishDualAmpPedal = BritishDualAmpPedal() 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 pedal.presence = 0.6; pedal.bright = 1.0; pedal.cab = 2.0
let restored: BritishDualAmpPedal = BritishDualAmpPedal() let restored: BritishDualAmpPedal = BritishDualAmpPedal()
restored.applyState(pedal.captureState()) 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) #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 { @Test func staysWithinCeilingWithEQAndGainMaxed() throws {
let hot: [Float] = try render { (p: CaliHiGainAmpPedal) in 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 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))) } let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
@@ -85,7 +85,7 @@ struct CaliHiGainAmpPedalTests {
== ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"]) == ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"])
#expect(pedal.effectSliders.map { $0.label } == ["80", "240", "750", "2.2k", "6.6k"]) #expect(pedal.effectSliders.map { $0.label } == ["80", "240", "750", "2.2k", "6.6k"])
#expect(pedal.effectSwitches.map { $0.label } == ["Channel"]) #expect(pedal.effectSwitches.map { $0.label } == ["Channel"])
#expect(pedal.widthUnits == 4) #expect(pedal.widthUnits == 2)
#expect(pedal.toneStackModel == .mesa) #expect(pedal.toneStackModel == .mesa)
} }
@@ -61,7 +61,7 @@ struct CharacterAmpsTests {
@Test func allBuildNonSilentFiniteWithinCeiling() throws { @Test func allBuildNonSilentFiniteWithinCeiling() throws {
for a: (name: String, make: () -> AmpVoicePedal) in all { 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(hasNonSilentOutput(hot), "\(a.name) silent")
#expect(hot.allSatisfy { $0.isFinite }, "\(a.name) non-finite") #expect(hot.allSatisfy { $0.isFinite }, "\(a.name) non-finite")
#expect(peak(hot) <= 1.0 + 1.0e-4, "\(a.name) exceeds ±1 ceiling: \(peak(hot))") #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 { @Test func anaheimLimiterActsWhenDrivenHot() throws {
// Driven hard, the built-in limiter (on) compresses vs bypassed (off) → different output. // 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 limited: [Float] = try render({ AnaheimAmpPedal() }) { $0.gain = 10.5; $0.limiter = 1.0 }
let unlimited: [Float] = try render({ AnaheimAmpPedal() }) { $0.gain = 25.0; $0.limiter = 0.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") #expect(windowedSSD(limited, unlimited) > 0, "Anaheim limiter had no effect")
} }
@@ -92,7 +92,7 @@ struct ChimeTopBoostAmpPedalTests {
@Test func outputStaysWithinCeilingWithFXEngaged() throws { @Test func outputStaysWithinCeilingWithFXEngaged() throws {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
let hot: [Float] = try render { (pedal: ChimeTopBoostAmpPedal) in let hot: [Float] = try render { (pedal: ChimeTopBoostAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.brilliant = 1.0 pedal.brilliant = 1.0
@@ -111,7 +111,7 @@ struct ChimeTopBoostAmpPedalTests {
#expect(pedal.effectSwitches.map { $0.label } == ["Brilliant", "Tremolo"]) #expect(pedal.effectSwitches.map { $0.label } == ["Brilliant", "Tremolo"])
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"]) #expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
#expect(pedal.effectSelectors.first?.rebuildsOnChange == true) #expect(pedal.effectSelectors.first?.rebuildsOnChange == true)
#expect(pedal.widthUnits == 3) #expect(pedal.widthUnits == 2)
#expect(pedal.showsMixControl == false) #expect(pedal.showsMixControl == false)
#expect(pedal.toneStackModel == .vox) #expect(pedal.toneStackModel == .vox)
} }
@@ -100,7 +100,7 @@ struct ChimeVariantsTests {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
for v: (name: String, make: () -> ChimeAmpPedal) in variants { for v: (name: String, make: () -> ChimeAmpPedal) in variants {
let hot: [Float] = try render(v.make) { (pedal: ChimeAmpPedal) in let hot: [Float] = try render(v.make) { (pedal: ChimeAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.cut = 0.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 // The value is read at build time (rebuildsOnChange); configure runs before build, so the
// Drive channel cascades its extra stage. // Drive channel cascades its extra stage.
let clean: [Float] = try render { $0.channel = 0.0 } 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(hasNonSilentOutput(clean) && hasNonSilentOutput(drive))
#expect(windowedSSD(clean, drive) > 0, "channel switch had no effect") #expect(windowedSSD(clean, drive) > 0, "channel switch had no effect")
} }
@Test func driveKnobChangesDriveChannel() throws { @Test func driveKnobChangesDriveChannel() throws {
let low: [Float] = try render { $0.channel = 1.0; $0.drive = 2.0 } 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") #expect(windowedSSD(low, high) > 0, "Drive knob had no effect on the drive channel")
} }
@@ -87,13 +87,13 @@ struct FullertonDriveAmpPedalTests {
@Test func outputStaysWithinCeilingOnDriveChannel() throws { @Test func outputStaysWithinCeilingOnDriveChannel() throws {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
let hot: [Float] = try render { (pedal: FullertonDriveAmpPedal) in let hot: [Float] = try render { (pedal: FullertonDriveAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.reverb = 1.0 pedal.reverb = 1.0
pedal.bright = 1.0 pedal.bright = 1.0
pedal.channel = 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))) } 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") #expect(peak <= 1.0 + ceilingEpsilon, "peak \(peak) exceeds the ±1 ceiling on the drive channel")
@@ -105,20 +105,20 @@ struct FullertonDriveAmpPedalTests {
#expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Reverb", "Drive"]) #expect(pedal.effectKnobs.map { $0.label } == ["Gain", "Bass", "Mid", "Treble", "Reverb", "Drive"])
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Channel"]) #expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Channel"])
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"]) #expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
#expect(pedal.widthUnits == 3) #expect(pedal.widthUnits == 2)
#expect(pedal.toneStackModel == .fender) #expect(pedal.toneStackModel == .fender)
} }
@Test func controlsRoundTripThroughState() throws { @Test func controlsRoundTripThroughState() throws {
let pedal: FullertonDriveAmpPedal = FullertonDriveAmpPedal() let pedal: FullertonDriveAmpPedal = FullertonDriveAmpPedal()
pedal.reverb = 0.6 pedal.reverb = 0.6
pedal.drive = 12.0 pedal.drive = 8.3
pedal.bright = 1.0 pedal.bright = 1.0
pedal.channel = 1.0 pedal.channel = 1.0
pedal.cab = 2.0 pedal.cab = 2.0
let restored: FullertonDriveAmpPedal = FullertonDriveAmpPedal() let restored: FullertonDriveAmpPedal = FullertonDriveAmpPedal()
restored.applyState(pedal.captureState()) 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) #expect(restored.bright == 1.0 && restored.channel == 1.0 && restored.cab == 2.0)
} }
@@ -103,7 +103,7 @@ struct FullertonReverbAmpPedalTests {
@Test func outputStaysWithinCeilingWithFXEngaged() throws { @Test func outputStaysWithinCeilingWithFXEngaged() throws {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
let hot: [Float] = try render { (pedal: FullertonReverbAmpPedal) in let hot: [Float] = try render { (pedal: FullertonReverbAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.reverb = 1.0 pedal.reverb = 1.0
@@ -123,7 +123,7 @@ struct FullertonReverbAmpPedalTests {
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Reverb FX", "Vibrato"]) #expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Reverb FX", "Vibrato"])
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"]) #expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
#expect(pedal.effectSelectors.first?.rebuildsOnChange == true) #expect(pedal.effectSelectors.first?.rebuildsOnChange == true)
#expect(pedal.widthUnits == 3) #expect(pedal.widthUnits == 2)
#expect(pedal.showsMixControl == false) #expect(pedal.showsMixControl == false)
#expect(pedal.toneStackModel == .fender) #expect(pedal.toneStackModel == .fender)
} }
@@ -86,7 +86,7 @@ struct FullertonVariantsTests {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
for v: (name: String, make: () -> FullertonReverbAmpPedal) in variants { for v: (name: String, make: () -> FullertonReverbAmpPedal) in variants {
let hot: [Float] = try render(v.make) { (pedal: FullertonReverbAmpPedal) in let hot: [Float] = try render(v.make) { (pedal: FullertonReverbAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.reverb = 1.0 pedal.reverb = 1.0
@@ -105,7 +105,7 @@ struct FullertonVariantsTests {
== ["Gain", "Bass", "Mid", "Treble", "Reverb", "Speed", "Intensity"], "\(v.name) knobs") == ["Gain", "Bass", "Mid", "Treble", "Reverb", "Speed", "Intensity"], "\(v.name) knobs")
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Reverb FX", "Vibrato"], "\(v.name) switches") #expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Reverb FX", "Vibrato"], "\(v.name) switches")
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"], "\(v.name) selectors") #expect(pedal.effectSelectors.map { $0.label } == ["Cab"], "\(v.name) selectors")
#expect(pedal.widthUnits == 3, "\(v.name) width") #expect(pedal.widthUnits == 2, "\(v.name) width")
#expect(pedal.toneStackModel == .fender, "\(v.name) tone stack") #expect(pedal.toneStackModel == .fender, "\(v.name) tone stack")
#expect(pedal.powerAmpOversample == 4, "\(v.name) should oversample the harder-driven power amp at 4×") #expect(pedal.powerAmpOversample == 4, "\(v.name) should oversample the harder-driven power amp at 4×")
} }
@@ -127,7 +127,7 @@ struct JazzCleanAmpPedalTests {
// Channel is read at build time (rebuildsOnChange); configure runs before build, so the // Channel is read at build time (rebuildsOnChange); configure runs before build, so the
// Distortion channel cascades its extra gain stage. // Distortion channel cascades its extra gain stage.
let clean: [Float] = try renderStereo { $0.channel = 0.0 }.left 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") #expect(windowedSSD(clean, dist) > 0, "distortion channel had no effect")
let channel: PedalSwitch? = JazzCleanAmpPedal().effectSwitches.first { $0.label == "Channel" } let channel: PedalSwitch? = JazzCleanAmpPedal().effectSwitches.first { $0.label == "Channel" }
#expect(channel?.rebuildsOnChange == true, "Channel switch should rebuild on change") #expect(channel?.rebuildsOnChange == true, "Channel switch should rebuild on change")
@@ -136,7 +136,7 @@ struct JazzCleanAmpPedalTests {
@Test func bothChannelsStayWithinCeilingWithFXEngaged() throws { @Test func bothChannelsStayWithinCeilingWithFXEngaged() throws {
let ceilingEpsilon: Double = 1.0e-4 let ceilingEpsilon: Double = 1.0e-4
let (left, right): ([Float], [Float]) = try renderStereo { (pedal: JazzCleanAmpPedal) in let (left, right): ([Float], [Float]) = try renderStereo { (pedal: JazzCleanAmpPedal) in
pedal.gain = 30.0 pedal.gain = 11.0
pedal.bass = 1.0 pedal.bass = 1.0
pedal.treble = 1.0 pedal.treble = 1.0
pedal.reverb = 1.0 pedal.reverb = 1.0
@@ -155,7 +155,7 @@ struct JazzCleanAmpPedalTests {
#expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Chorus", "Channel"]) #expect(pedal.effectSwitches.map { $0.label } == ["Bright", "Chorus", "Channel"])
#expect(pedal.effectSelectors.map { $0.label } == ["Cab"]) #expect(pedal.effectSelectors.map { $0.label } == ["Cab"])
#expect(pedal.effectSelectors.first?.rebuildsOnChange == true) #expect(pedal.effectSelectors.first?.rebuildsOnChange == true)
#expect(pedal.widthUnits == 3) #expect(pedal.widthUnits == 2)
#expect(pedal.showsMixControl == false) #expect(pedal.showsMixControl == false)
#expect(pedal.channelKind == .widener, "Jazz Clean should be a stereo widener") #expect(pedal.channelKind == .widener, "Jazz Clean should be a stereo widener")
#expect(pedal.toneStackModel == .fender) #expect(pedal.toneStackModel == .fender)
@@ -49,8 +49,8 @@ struct ModernHighGainAmpPedalTests {
@Test func buildsNonSilentFiniteWithinCeiling() throws { @Test func buildsNonSilentFiniteWithinCeiling() throws {
let hot: [Float] = try render { (p: ModernHighGainAmpPedal) in 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.gain = 11.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.drive = 11.0; p.sag = 1.0; p.tight = 1.0
} }
#expect(hasNonSilentOutput(hot) && hot.allSatisfy { $0.isFinite }) #expect(hasNonSilentOutput(hot) && hot.allSatisfy { $0.isFinite })
let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) } let peak: Double = hot.reduce(0.0) { Swift.max($0, abs(Double($1))) }
@@ -58,8 +58,8 @@ struct ModernHighGainAmpPedalTests {
} }
@Test func sagChangesOutput() throws { @Test func sagChangesOutput() throws {
let stiff: [Float] = try render { $0.gain = 20.0; $0.channel = 1.0; $0.sag = 0.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 = 20.0; $0.channel = 1.0; $0.sag = 1.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") #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 // must stay positive (attenuation), never go negative (phase inversion). Assert the sag'd
// output correlates positively with the stiff one (not an inverted copy). // output correlates positively with the stiff one (not an inverted copy).
let cfg: (ModernHighGainAmpPedal) -> Void = { (p: ModernHighGainAmpPedal) in 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 stiff: [Float] = try render { cfg($0); $0.sag = 0.0 }
let saggy: [Float] = try render { cfg($0); $0.sag = 1.0 } let saggy: [Float] = try render { cfg($0); $0.sag = 1.0 }
@@ -103,7 +103,7 @@ struct ModernHighGainAmpPedalTests {
== ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"]) == ["Gain", "Bass", "Mid", "Treble", "Presence", "Depth", "Master", "Drive"])
#expect(pedal.advancedKnobs.map { $0.label } == ["Sag", "Bias", "Bias X"]) #expect(pedal.advancedKnobs.map { $0.label } == ["Sag", "Bias", "Bias X"])
#expect(pedal.effectSwitches.map { $0.label } == ["Channel", "Tight"]) #expect(pedal.effectSwitches.map { $0.label } == ["Channel", "Tight"])
#expect(pedal.widthUnits == 4) #expect(pedal.widthUnits == 2)
#expect(pedal.toneStackModel == .mesa) #expect(pedal.toneStackModel == .mesa)
#expect(pedal.sag == 0.3, "Modern High-Gain keeps rectifier sag on by default") #expect(pedal.sag == 0.3, "Modern High-Gain keeps rectifier sag on by default")
} }
@@ -111,11 +111,11 @@ struct ModernHighGainAmpPedalTests {
@Test func controlsRoundTripThroughState() throws { @Test func controlsRoundTripThroughState() throws {
let pedal: ModernHighGainAmpPedal = ModernHighGainAmpPedal() let pedal: ModernHighGainAmpPedal = ModernHighGainAmpPedal()
pedal.sag = 0.8; pedal.tight = 1.0; pedal.channel = 1.0 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() let restored: ModernHighGainAmpPedal = ModernHighGainAmpPedal()
restored.applyState(pedal.captureState()) restored.applyState(pedal.captureState())
#expect(restored.sag == 0.8 && restored.tight == 1.0 && restored.channel == 1.0) #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 { @Test func registeredInBuiltInRegistry() throws {
@@ -89,4 +89,85 @@ struct NoiseGatePedalTests {
let samples: [Float] = try render(threshold: 0.95, floor: 1.0) let samples: [Float] = try render(threshold: 0.95, floor: 1.0)
#expect(hasNonSilentOutput(samples), "Unity-floor gate muted the signal") #expect(hasNonSilentOutput(samples), "Unity-floor gate muted the signal")
} }
/// A sine that steps from loud (0.3, gate open) down to a constant below-threshold level (0.03)
/// over 50 ms and holds there — so the gate opens, then closes, while the source level stays
/// constant. That isolates the gate's close fade (release-dependent) from any source decay.
/// `Line` holds its `end` value after `dur`, giving the sustained low tail.
private final class DecaySineSource: SynthesizerBase {
private let bus: Int
init(bus: Int) { self.bus = bus; super.init() }
override func build() {
output(bus: bus, source: OscSin.Audio(freq: 220.0) * Line.Control(start: 0.3, end: 0.03, dur: 0.05))
}
}
/// Energy in the gate's *close window* — the source steps down through the threshold ~50 ms in
/// then holds a constant below-threshold level, so the output energy after that reflects only how
/// long the gate lingers before it finishes fading shut. A longer `release` = more lingering
/// energy; a snap close = little. (floor 0, so once fully closed the tail is silent.)
private func closeWindowEnergy(release: Double) throws -> Double {
let sampleRate: Double = 48000.0
let (engine, url): (SynthesisEngine, URL) = makeNRTEngine(duration: 0.6, sampleRate: sampleRate)
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: DecaySineSource = DecaySineSource(bus: srcBus.index)
let gate: NoiseGatePedal = NoiseGatePedal(inputBus: srcBus.index, outputBus: dstBus.index)
gate.sampleRate = sampleRate
gate.threshold = 0.06
gate.floor = 0.0
gate.release = release
let master: TestRouteMaster = TestRouteMaster(inputBusIndex: dstBus.index)
try engine.add(source)
try engine.add(gate, position: NodePosition.after(source))
try engine.add(master, position: NodePosition.after(gate))
try engine.start()
let inter: [Float] = readStereoCAF(url: url, sampleRate: sampleRate)
let mono: [Double] = stride(from: 0, to: inter.count, by: 2).map { Double(inter[$0]) }
let start: Int = Int(0.12 * sampleRate) // after the step-down; the gate is closing/closed
var energy: Double = 0.0
for i: Int in start..<mono.count { energy += mono[i] * mono[i] }
return energy
}
@Test func releaseTunesCloseTime() throws {
// A long Release lets the gate linger (more energy through the close) vs a short Release that
// snaps shut — and the shipped default (0.08) lingers well past a near-instant close, so the
// gate fades rather than pops. Guards both the Release control and the pop fix.
let fast: Double = try closeWindowEnergy(release: 0.02)
let slow: Double = try closeWindowEnergy(release: 0.4)
let deflt: Double = try closeWindowEnergy(release: 0.08)
#expect(slow > fast * 1.5, "long Release did not linger longer than short (fast=\(fast) slow=\(slow))")
#expect(deflt > fast * 1.2, "default close is nearly as abrupt as the fast close (\(deflt) vs \(fast))")
}
@Test func exposesAttackReleaseInAdvancedPopover() throws {
#expect(NoiseGatePedal().advancedKnobs.map { $0.label } == ["Attack", "Release"])
// Attack/Release are pop-over only — not on the face.
let face: [String] = NoiseGatePedal().effectKnobs.map { $0.label }
#expect(face == ["Threshold", "Floor"])
}
@Test func attackReleaseRoundTripThroughState() throws {
let pedal: NoiseGatePedal = NoiseGatePedal()
pedal.attack = 0.02
pedal.release = 0.3
let restored: NoiseGatePedal = NoiseGatePedal()
restored.applyState(pedal.captureState())
#expect(restored.attack == 0.02 && restored.release == 0.3, "Attack/Release did not round-trip")
}
@Test func legacyGateWithoutAdvancedValuesDefaultsTiming() throws {
// A gate saved before Attack/Release existed has empty advancedValues → timing defaults, and
// Threshold/Floor still restore correctly (append-only, no migration).
let legacy: PedalState = PedalState(
id: UUID(), type: "Noise Gate",
knobValues: [0.03, 0.4, 1.0, 0.7], selectorValues: [], advancedValues: [], bypass: 0.0)
let pedal: NoiseGatePedal = NoiseGatePedal()
pedal.applyState(legacy)
#expect(pedal.threshold == 0.03 && pedal.floor == 0.4, "legacy Threshold/Floor mis-mapped")
#expect(pedal.attack == 0.005 && pedal.release == 0.08, "legacy gate should default Attack/Release")
}
} }