Commit Graph

112 Commits

Author SHA1 Message Date
josh 8a08264fb4 feat(amps): Fender blackface variants — Fullerton Deluxe & Princeton (Phase 1)
Make FullertonReverbAmpPedal open with a name-taking designated init, then derive
two lower-headroom blackface combos that inherit its reverb + tremolo + bright
control surface and differ only in voicing:

- Fullerton Deluxe — 1×12, power-amp drive 2.2 (earlier breakup than the Twin's
  1.5), americanCombo cab, slightly less bass.
- Fullerton Princeton — 1×10, drive 2.6 (breaks up earliest), Vintage Dark cab,
  least bass, a shade darker.

Both override powerAmpDriveInput (headroom via power-amp saturation) and
powerAmpOversample → 4 for the harder drive. Registered across all 6 sites as
.amp. 7 tests (variants differ from Twin + each other, inherited reverb/bright,
ceiling at max gain, inherited control surface + oversample 4, round-trip,
registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 11:55:23 -07:00
josh 48dce06f5a fix(amps): master review follow-ups — tone-proving test, headroom, default
- britishMasterDrivesPowerAmp now uses an RMS-normalized SSD so it proves Master
  changes the *waveshape* (power-amp saturation), not merely level — a raw SSD
  couldn't distinguish the two, and distinguishing them is the whole point vs
  `level`.
- Add powerAmpOversample hook (default 2); British overrides to 4 so the higher
  Master drive (up to 5.0 vs the fixed 1.5) has anti-alias headroom.
- British Master default 0.3 → 0.22 so it maps to ≈1.5 drive, keeping the amp's
  out-of-box tone unchanged.
- Add a max-Master (gain 30 + Master 1.0) ceiling test; DocC no longer links the
  private powerAmpDrive symbol.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 09:59:59 -07:00
josh b9a63eeaf5 feat(amps): master-volume enabler + Master knob on British
Add powerAmpDriveInput hook to AmpVoicePedal: an overridable drive into the
power-amp TriodeStage, defaulting to the fixed powerAmpDrive so the five existing
amps are byte-for-byte unchanged. A master-volume amp overrides it with a live
knob mapped to a drive range — so Master pushes the power-amp stage into
saturation (real master-volume behaviour), unlike `level`, which only attenuates
the finished output post-cab/post-limiter.

British gains a Master knob (LinLin [0,1] → power-amp drive [0.5, 5.0]): crank
Gain for preamp grind, set Master for power-amp saturation. signatureKnobs now
[Presence, Master]. Other current amps are non-master (Fender blackface, Vox,
JC) and keep the fixed drive.

Tests: Master changes the power-amp tone (not just level), round-trips through
state; British control-surface updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 09:53:03 -07:00
josh 9588d77137 docs(amps): genericize AmpVoicePedal base doc
Review nit: the base-class doc enumerated every subclass, needing an edit per
new amp. Describe the family generically instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 09:23:34 -07:00
josh 5d8e655dab feat(amps): Chime Top Boost — full Vox-style control surface
Full-surface counterpart to the basic Chime voice, modeling the AC-style top-boost
combo. Reuses the AmpVoicePedal hooks:
- inputShaping: Brilliant switch (pre-preamp treble shelf, identity when off).
- onboardEffects: tremolo (Speed/Intensity), gated by a Tremolo footswitch. No
  onboard reverb (always outboard on these amps).
- shapeVoice: the Cut control (post-power-amp low-pass swept 9k→2.5k).

ChimeTopBoostAmpPedal (.vox): Gain/Bass/Mid/Treble + Cut/Speed/Intensity knobs,
Brilliant + Tremolo switches, Cab selector (defaults to Bright 1×12); widthUnits 3.
Registered across registry/type/category/palette/enclosure; Help acknowledgment
lists its tone stack. 10 tests (Cut, tremolo intensity/speed, brilliant, tremolo
footswitch bit-exact bypass, ceiling with FX, control surface, round-trip, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 09:18:17 -07:00
josh 17a0845225 fix(ui): harden horizontal switch row layout
Switches now lay out side by side (HStack). Polish so it degrades cleanly:
- PedalSwitchView caption: lineLimit(1) — no wrap → no height jitter between
  switches sharing a row.
- switchRow: .top alignment so segment bars stay level; doc updated (no longer
  "one per row").
- MutantPedal: widthUnits 2 so its Sweep (2-way) + Mode (3-way) switches sit
  side by side without cramping in a single-width card.

UI-only; no audio/state changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 09:07:22 -07:00
josh 29b1747533 fix(amps): Jazz Clean chorus depth range + true stereo tests
Review fixes:
- chorusDepth was defaulted 0.3 with a 0..1 range, but the Chorus generator's
  depth is a fraction of the delay time — that's ~30-300× the classic-chorus
  band and produces pitch wobble, not lush chorus. Retune to default 0.005,
  range 0.0005...0.015 (matching the ModulationPedal precedent).
- Tests now render the widener as true stereo (outputBusRight + split master),
  asserting L≠R when the chorus is engaged and bit-exact L==R when bypassed, and
  checking the ±1 ceiling on BOTH channels — the prior suite only exercised the
  left channel.
- AmpVoicePedal base doc lists Jazz Clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 08:20:23 -07:00
josh 102715ded1 feat(amps): Jazz Clean — stereo-chorus solid-state amp
First stereo (widener) amp, modeling the JC-style ultra-clean combo whose
signature is a lush stereo chorus fed to two power amps / speakers.

Refactor AmpVoicePedal.effect() into two reusable, behavior-preserving pieces:
- preCabinetCore(_:)  — inputShaping → preamp → tone → onboardEffects → power → shapeVoice (mono)
- cabinetAndLimit(_:) — selected cab convolver → tanh soft-limit → Clip(±1) (per channel)
effect() = cabinetAndLimit(preCabinetCore(dry)); the four existing amps are
unchanged (verified by their suites).

JazzCleanAmpPedal (widener, .fender): mono core (with spring reverb + bright)
→ Chorus (mono → stereo split) → per-channel cabinetAndLimit. Controls:
Gain/Bass/Mid/Treble + Reverb/Rate/Depth knobs, Bright + Chorus switches, Cab
selector; widthUnits 3; defaults to the Full-Range cab for a hi-fi voice. The
Chorus footswitch gates the wet mix to 0 (dry pass-through, Rate/Depth kept).

Registered across registry/type/category/palette/enclosure; Help acknowledgment
lists its tone stack. 10 tests (chorus rate/depth, reverb, bright, footswitch
bit-exact bypass, ceiling with FX, stereo/control-surface config, round-trip,
registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 08:12:27 -07:00
josh 27fb6e6898 fix(amps): disambiguate Reverb footswitch label; comment bypass test
Review nits: rename the reverb-enable switch "Reverb" → "Reverb FX" so it no
longer collides with the "Reverb" level knob in the flat control surface
(clearer, better for VoiceOver). Note in the vibrato bypass test why the
differing speed between the two renders is intentional (depth gated to 0 makes
the LFO a constant regardless of frequency).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 07:59:12 -07:00
josh a9e91ef08c feat(amps): Reverb + Vibrato footswitches on Fullerton Reverb
Model the amp's two-button footswitch: Reverb and Vibrato switches that bypass
each onboard effect to a dry pass-through while preserving the knob positions.
Both gate live by scaling the wet amount to zero — reverb mix → 0 (SpringReverb
passes dry), tremolo depth → 0 (LFO collapses to a constant 1.0) — so Off is a
true identity and no rebuild is needed.

reverbEnabled / vibratoEnabled default on. Tests assert each footswitch-off is a
bit-exact pass-through (equals the knob-at-zero render) and differs when engaged;
state round-trip and control-surface exposure updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 07:52:23 -07:00
josh c9795f7305 docs+test(amps): Fullerton review nits
- AmpVoicePedal class doc lists Fullerton Reverb as a subclass.
- Ceiling test exercises the tremolo path (intensity/speed set).
- amp-modeling-2.0-plan S2 notes the Fullerton Reverb full-surface block.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 07:10:46 -07:00
josh 6718914ee0 feat(amps): Fullerton Reverb — full control surface (reverb + tremolo + bright)
First combo amp with onboard effects, modeling the American blackface clean
voice. Adds two overridable hooks to AmpVoicePedal so an amp can insert stages
without touching the fixed chain:
- inputShaping(_:)   — pre-preamp (bright switch here)
- onboardEffects(_:) — after tone stack, before power amp (reverb + tremolo here)

FullertonReverbAmpPedal (.fender):
- Spring reverb (SpringReverb) with a Reverb mix knob.
- Tremolo (unipolar sine gain LFO) with Speed + Intensity knobs; defaults off so
  the amp opens as a clean reverbed platform. ("Vibrato" channel is really AM.)
- Bright switch: a pre-preamp high-shelf whose gain is scaled by the toggle, so
  Off is a true identity and the switch is live (no rebuild).
- Full surface: Gain/Bass/Mid/Treble + Reverb/Speed/Intensity knobs, Bright
  switch, Cab selector; widthUnits 3.

Registered across registry / type / category / palette / enclosure color; Help
acknowledgment lists its tone stack. 9 tests (FX effect, ceiling with FX on,
control surface, state round-trip, registry).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-03 07:03:51 -07:00
josh 544a07d569 fix(amps): true ±1 ceiling — hard safety clamp after the tanh stage
Review follow-up: the tanh output stage soft-limits but does not strictly bound
output — its DC-blocker (Nyquist gain ~1.0025) and the halfband oversampling
filters can leave a sub-percent transient overshoot above ±1, which the DAC
would still clip. The prior "can never overshoot" doc claim was overstated.

Add a final Clip(±1) after the tanh: the tanh does the musical analog-style
soft-limiting, the clamp only catches the inaudible ripple residue, so the amp
stage provably never emits a sample past ±1. Docs corrected (soft-limit is a
digital safety ceiling placed after the cab, not literal circuit order; master
Level ≤ 1 carries the ceiling through). Ceiling test tightened 1.05 → 1.0+1e-4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 21:15:16 -07:00
josh fb50538e84 feat(amps): analog-style tanh output stage (no digital clipping)
The cab convolution and signature shelves can push amp output past ±1, which
would hard-clip the DAC. A real amp has no brickwall — the output transformer /
speaker soft-compress. Add a symmetric tanh output stage (TriodeStage bias 0,
2× oversampled) as the final node of AmpVoicePedal.effect(), after the cab.

Unit small-signal gain leaves clean playing untouched; peaks asymptote to ±1.
Combined with the attenuate-only master Level and fully-wet mix, the amp can no
longer overshoot into a hard digital clip. Test: every voice driven at max gain
+ tone stays within the digital ceiling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 21:09:30 -07:00
josh e1ed4e348c fix(cab): NaN-safe selector compare; correct applyState doc contract
Re-review follow-ups:
- rebuildSelectorValues sanitizes non-finite node values to a sentinel so the
  before/after recall compare (uses !=) can't be forced true by NaN != NaN,
  which would trigger a needless rebuild on every recall.
- ShoeGaze.applyState doc no longer claims "without rebuilding the engine graph":
  it now documents that a board is rebuilt (with the one-block-glitch caveat)
  when a rebuildsOnChange selector value differs from the live rig.

Iteration-during-mutation in applyState confirmed safe: zip over the stored
[PedalBoard] array snapshots it (COW), and PedalBoard is a final class, so
rebuildBoard mutating self.boards mid-loop does not disturb the iteration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 20:36:21 -07:00
josh 3fe6b8a50a fix(cab): rebuild board on lightweight recall of a topology selector
Review follow-up to the single-convolver cab change. Now that only the selected
cabinet voice's convolver is built, any path that changes the selector value
without rebuilding leaves audio on the stale convolver. The UI drag already
rebuilds; the gap was ShoeGaze.applyState (lightweight scene recall), which
applies param snapshots to live pedals without a rebuild.

- Pedal.rebuildSelectorValues: values of effectSelectors flagged rebuildsOnChange.
- applyState/applySegmentParams/applyBranchParams: detect when a rebuildsOnChange
  selector value actually changes during recall and rebuild only those boards;
  boards without such a selector keep the cheap live-apply path.
- CabinetVoice.voice(atSelectorValue:): guard non-finite and clamp in Double
  space so Int() can never trap on a corrupt preset value.
- Doc fixes: CabinetPedal.cabinet and AmpVoicePedal chain diagram no longer claim
  a live Select.

MIDI CC is unaffected: selectors are not in ccMappableControls (knobs + sliders
only). Tests: recall changing the cab voice rebuilds and applies; recall with an
unchanged voice does not rebuild.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 20:27:39 -07:00
josh 59370ee5dd perf(cab): instantiate only the selected cabinet convolver
The cab selector was a Select over one ConvolutionReverb per CabinetVoice, and
Select evaluates every input each block — so all 8 voices' partitioned-FFT
convolvers ran continuously (7/8 discarded), per CabinetPedal and per amp voice.

Build only the selected voice's convolver. The cab selector is now
rebuildsOnChange: committing a new stop asks the host to rebuild the board
(same mechanism the Neural Amp model loader uses), which re-enters effect()
with the new voice. One convolver runs instead of N; cost moves to a brief
rebuild on cab switch (cabs are set-and-forget).

- PedalSelectorKnob: add rebuildsOnChange flag.
- PedalSelectorKnobView: fire onCommit on drag-end when the stop changed.
- PedalView: wire onCommit → pedalRebuildAction for rebuildsOnChange selectors.
- CabinetVoice.voice(atSelectorValue:): rounded/clamped index → voice.
- CabinetPedal + AmpVoicePedal: single ConvolutionReverb for the selected voice.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 20:16:42 -07:00
josh 8a266a33dc fix(cab): keep modernStack breakup in-band; doc + test follow-ups
Review fixes:
- modernStack.breakupHz 4500 → 3800 so the cone-breakup peak sits below the
  4000 Hz low-pass (was the only voice with breakup > lowPass, which rolled off
  most of the intended boost).
- CabinetIRFactory class doc: list the full 7-stage chain (breakup + notch were
  missing).
- Tests: add loFiIsDarkerThanFullRange and breakupPeakLiftsUpperMid for
  per-voice differentiation; drop the hard-coded voice count in
  voiceNamesAreUnique.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 18:54:45 -07:00
josh ec4e7dc5a4 feat(cab): 5 new cabinet voices + notch/breakup IR shaping
Expand CabinetVoice from 3 to 8 synthesized voicings (all original code, no
captures): add Modern 4×12, Boutique 2×12, Bright 1×12, Full-Range (FRFR),
and Lo-Fi 1×8.

Extend the IR synthesis model with two per-voice stages so the voices reach
character the old 4-band curve could not:
- cone-"breakup" peak (narrow upper-mid bite/clank, breakupQ 2.0)
- mid interference "notch" (comb-filter dip ~1.2–2.5 kHz, notchQ 2.5)

Both are RBJ peaking biquads; gain 0 = identity, so a voice can disable either
(Full-Range runs a flat notch). Chain is now HP → LP×2 → body → presence →
breakup → notch. New tests: FRFR top-end extension, notch mid-dip, 8-voice
name uniqueness.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 18:49:08 -07:00
josh 733e979c1b docs(amps): restore Select all-inputs CPU note; update 2.0 plan for voice split
Review follow-ups (non-blocking):
- AmpVoicePedal.effect doc: note the cab Select evaluates every ConvolutionReverb
  each block regardless of selection (bounded fixed CPU), carried over from the
  removed AmpPedal.
- amp-modeling-2.0-plan.md S2: describe the three-pedal voice split
  (California/British/Chime + AmpVoicePedal base) instead of the old single
  model-selector design.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 14:53:09 -07:00
josh 1b247cf766 feat(amps): split combined Amp pedal into California/British/Chime voices
Replace the single AmpPedal (a model-selector pedal) with three dedicated
amp-voice blocks, each fixing one tone-stack model and adding a signature
control so the per-amp UI can be customized:

- AmpVoicePedal: open base — shared Gain/Bass/Mid/Treble/Cab chain
  (TriodeStage preamp → ToneStack → TriodeStage power amp → shapeVoice →
  ConvolutionReverb cab), overridable toneStackModel/summary/signatureKnobs/
  shapeVoice.
- CaliforniaAmpPedal (.fender): Bright high-shelf, clean-leaning gain default.
- BritishAmpPedal (.marshall): Presence high-shelf, crunch gain default.
- ChimeAmpPedal (.vox): Cut low-pass, top-boost jangle.

Registered in PedalRegistry / PedalType / PedalCategory / palette order /
enclosure colors. Help acknowledgment updated for the three tone stacks.
12 new tests in AmpVoicePedalTests; removed AmpPedal + its tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-02 14:47:07 -07:00
josh 23d607b9fc feat(ui): amp-head layout + Neural Amp model loader (S4)
- AmpPedal: double-width (widthUnits 2) amp-head card so the four tone knobs +
  Amp/Cab selectors + master aren't cramped. Uses the generic single-column
  content (no greedy Spacers → no flow-canvas height issue).
- Neural Amp model loader: PedalView renders, for a NeuralAmpPedal, a "Load
  Model…" picker (.fileImporter for .json) plus the loaded model's filename.
  Picking sets Pedal.resourcePath and asks the host to rebuild the board so the
  model applies live. Picker + AppKit stay in the UI layer (core imports none).
- New `pedalRebuildAction` environment value (@MainActor @Sendable), installed by
  ShoeGazeBuilderView; it resolves the pedal's board via a new branch-aware
  `ShoeGaze.board(containing:)` (finds pedals inside parallel / stereo-split
  branches, not just the main chain) and rebuilds it via the live-safe
  `rebuildBoard(_:from:)`.

Tests: AmpPedal widthUnits == 2; board(containing:) finds main + branch pedals
and returns nil for a stranger. Full suite 502. (SwiftUI loader flow needs
on-device visual QA.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-01 22:26:14 -07:00
josh 40fa590196 feat(pedals): Neural Amp pedal (S3) + PedalState resource path; Lyrebird 1.7.1
Bump Lyrebird to 1.7.1 (ProteusModelImporter) and add a neural amp-capture pedal.

- NeuralAmpPedal: loads a GuitarML Proteus/NeuralPi model (via ProteusModelImporter)
  and runs it with LSTMAmp on the gain-trimmed input; passes through clean when no
  model is loaded. Model files are user-supplied, not bundled (GuitarML = GPL-3.0).
- PedalState gains an optional `resourcePath` (backward-compatible, decodeIfPresent)
  and Pedal a matching `resourcePath` property, wired through captureState/applyState
  — so the loaded model file persists across rig save/load. The neural pedal reads it
  at build() (applied on rebuild). This foundation also unblocks a future
  custom-cabinet-IR path.
- Registered in PedalRegistry / PedalType / PedalCategory (.gain) / palette /
  enclosure color; Help acknowledges the GuitarML model format.

Tests: no-model passthrough; loaded model transforms output & differs from
passthrough; gain affects modeled output; resourcePath round-trips through
PedalState; gain knob exposed; registry resolves "Neural Amp". Full suite 501.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-01 20:48:44 -07:00
josh fe31eb6d7d feat(pedals): component Amp pedal (S2) on Lyrebird 1.7
Bump Lyrebird dependency to 1.7.0 and add a full white-box amp built on its new
amp-modeling core.

AmpPedal chain: preamp TriodeStage(drive: gain) → ToneStack(bass/mid/treble,
model) → gentle power-amp TriodeStage → speaker-cabinet ConvolutionReverb. The
tone-stack model (Fender/Marshall/Vox) and cabinet voice are each built per
option and picked live with Select, so both round-trip through the rig save
format. Fully wet (Level is master; Mix hidden).

Controls: Gain, Bass, Mid, Treble knobs + Amp / Cab selectors. Registered in
PedalRegistry / PedalType / PedalCategory (.gain) / palette / enclosure color;
Help acknowledgments cite the Yeh & Smith tone-stack model.

Tests: builds/non-silent/finite; gain, tone, amp-model, and cab all change the
output; controls exposed; amp/cab selections round-trip through PedalState;
registry resolves "Amp". Full suite 494.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-01 20:11:50 -07:00
josh 4a5d4009f6 feat(pedals): Cabinet IR pedal (S1) with synthesized cab voices
First amp-modeling increment (ShoeGaze 2.0, plan S1). No Lyrebird change —
reuses ConvolutionReverb + LyrebirdBuffer.

- CabinetPedal: builds one ConvolutionReverb per built-in voice at build() time
  and picks the active one with a `Select` driven by the persisted `cabinet`
  selector — live cab switching that round-trips through the rig save format.
- CabinetVoice + CabinetIRFactory: three built-in voicings synthesized in code
  (impulse through an RBJ biquad cascade — HP, true 4th-order Butterworth LP,
  body + presence peaks), so the bundled cab set is our own MIT content (no
  third-party IR licensing). Filter centre frequencies are Nyquist-clamped.
- Registered in PedalRegistry / PedalType / PedalCategory (.filter) / palette;
  README pedal count + catalog updated.

User-supplied captured .wav cab IRs are a planned follow-up (needs a persisted
file-path field PedalState doesn't yet carry).

Tests: IR is finite, peak-normalized, mono; rolls off lows and highs; voices
differ; selector exposed; selection changes output and round-trips through
PedalState; pedal builds, non-silent, resolves from the registry. Suite 486.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-01 17:13:08 -07:00
josh 8983e8829e feat(pedals): oversample nonlinear drive stages; Sustainer safety limiter
Anti-aliasing (Tier 1): every hard nonlinearity ran at the engine rate, so the
harmonics it generated folded back as inharmonic aliasing — worst on loud/bright
input at high drive. Add two oversampled RT generators built on Lyrebird's
halfband up/down-samplers and move the drive pedals onto them:

- OversampledSaturator (+ SaturationCurve) — tanh / normalised soft-clip /
  tanh+hard-clip curves at 2× or 4×. DistortionPedal now does its tanh→gain→hard
  clip at 4× (clip before the tone low-pass), with a final hard clip after the
  low-pass to re-establish the strict output bound; FuzzPedal (tanh) and
  OverdrivePedal (soft-clip) at 2×.
- OversampledRingModulator — input × sine carrier at 2×, carrier synthesized at
  the oversampled rate so the sum sideband can't alias. Phase wraps both
  directions (safe for negative carrier frequencies) and a sampleRate guard
  prevents NaN latching. RingModulatorPedal uses it.

Dynamics (Tier 2): SustainerPedal gains an opt-in Safety switch (off by default)
that inserts a brick-wall LookAheadLimiter after its compressor to catch the
transient overshoot a low-threshold/high-makeup setting can push past full scale.

Tests: generator-level alias-reduction proofs (Goertzel alias/fundamental ratio
vs a naive base-rate baseline) for both oversampled generators, hard-clip/soft
bounds, negative-carrier stability, distortion output-bound at high drive, and
Sustainer safety switch exposure + peak-capping. Full suite 478 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-31 20:41:06 -07:00
josh e697789bd7 feat(pedals): limiter Release knob + compressor safety limiter; bump Lyrebird 1.6.4
Consume Lyrebird 1.6.4, which decouples LookAheadLimiter's release time from
its look-ahead window.

- LimiterPedal: add a Release knob (0.01–0.5 s) wired to the new
  LookAheadLimiter.releaseTime. A too-fast release modulated the gain within a
  low-frequency cycle and distorted sustained notes when driven hard.
- CompressorPedal: add an opt-in Safety switch (off by default) that inserts a
  brick-wall LookAheadLimiter after the compressor to catch transient overshoot
  that could clip the output. Built as both branches with Select picking live;
  engaging it adds the limiter's short look-ahead delay.

Tests cover the new knob/switch exposure, release-time effect, and that the
safety limiter caps peaks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-31 18:22:43 -07:00
josh 551b650d45 Fix tuner leaking its pitch signal into the audio output
TunerTap wrote its pitch-capture generator to the scratch bus via output(bus:),
which always builds an Out.Audio — so the write went to *audio*-bus memory at the
control bus's index. Control-bus indices are low, so they collide with the
hardware output buses (e.g. index 1 = right channel), and because the tap runs
.after(mainGroup) the write lands after the master's rig-mute gate. Result: the
tracked frequency (e.g. 82 Hz) was summed onto an output channel, bypassing the
mute — audible as crackle while the pitch was unstable, stopping once a note
locked. Confirmed by render: the leaked value appears verbatim on the output bus.

Route through controlOutput (Out.Control → control-bus memory) instead. The
scratch bus is a control bus; it was only ever meant to give the engine a reason
to evaluate the side-effecting capture generator, and nothing reads it.

Test engagedTunerDoesNotLeakIntoOutput renders a muted rig with the tuner engaged
and asserts the settled output tail is silent (fails without the fix — the tail
carries the leaked pitch value; passes with it). 465 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 19:58:41 -07:00
josh e36074e9d3 Review fix: prime input-mute ramp + mute before engine start
Two blocking findings from external review:

1. UIParamNode itself ramps from previousOutputValue (seeded at the compile-time
   default, advanced only by RT render — update() doesn't touch it) to the target
   over the first block. So a node told to start muted still ramped full-gain→0
   across block 0; the earlier "hard gate" only moved the leak from Lag to the
   param's own ramp. The mutedInputRendersSilent test passed by accident (the
   test-loop tone is quiet in that first block).
   Fix: prime previousOutputValue to the target. Race-free before a node is
   spliced into the graph (addBoard) and safe on a spliced node while the engine
   is stopped; a running engine keeps the ramp as a click-free live toggle. New
   setInputMuteGain(_:muted:seedRamp:) / primeInputMute helpers; setInputMuted
   seeds only when engine.isRunning == false.

2. EngineConfigView.startEngine called setInputMuted(true) AFTER engine.start(),
   so the engine came up unmuted for the first blocks. Moved it before start()
   (engine stopped there, so the gain is seeded with no ramp).

Also: correct the setInputMuted doc (abrupt kill-switch, not "smoothed").
Regression test stoppedMutePrimesNodesSoTheresNoStartRamp asserts the ramp start
equals the target (no pending ramp) after a stopped mute and for a board added
while muted. 464 tests pass; both app targets build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 21:34:46 -07:00
josh b29c8848ef Review fix: exact-silence input mute (hard kill-switch gate)
External review found the lagged mute gate leaks a faint transient (~-54 dB) on
its first blocks: Lag seeds its state at 0, so gating on a lagged value never
starts at exactly zero on a rig that comes up muted — the moment the mute is
meant to keep things quiet. Measured directly via an NRT render.

- Gate the input with a hard, un-lagged kill switch `(inputMute - 1) * -1` in
  both HardwareInputPassThrough and TestLoopTap. A muted node is then exactly
  silent from the first sample; a kill-switch mute is expected to be abrupt.
  Drop the now-unused muteLagTime constant.
- Flip the library default to `inputMuted = false` (audible). Muting is the app's
  Start-time policy (EngineConfigView already re-asserts muted on user Start), so
  headless/offline library use isn't forced silent and render tests that route the
  test-loop through a board no longer depend on a leak to see signal. The pulsing
  glow now also starts at engine Start rather than before it.
- Tests: add render-level mutedInputRendersSilent (exact silence) and
  unmutedInputRendersSignal; update the default-state and MIDI-latch expectations;
  drop the StereoRouting un-mutes that the leak had made necessary.
- Plan doc: correct the mute default / gate description and the UserDefaults note.

463 tests pass; both app targets build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 16:03:50 -07:00
josh cc3a986cde Persist I/O + input via the rig, not UserDefaults
The rig snapshot already stores inputSource + input/output channel counts and
syncs them via the autosave envelope and the iCloud rig library. Make that the
single source of truth instead of the parallel UserDefaults path.

- RigStore.restore applies the saved channel layout (applyChannelLayout) before
  loadRig, while stopped at launch, so a saved live-input channel validates
  against the restored count instead of falling back to the test loop. The
  general loadRig policy (don't force layout mid-session) is unchanged.
- applyInputSource and the engine-config onConfigApplied now autosave, so input
  and I/O changes are captured into the rig immediately.
- Remove the UserDefaults keys and read/write sites: ShoeGaze.inputSelection
  (builder view + iOS model) and the ShoeGaze.inputChannels/outputChannels keys
  added earlier (EngineConfigView + both app targets build at the default layout
  now; RigStore.restore supplies the rig's layout).
- Fresh-launch default: the seed paths set inputSource = liveInput(0) when the
  engine has an input channel, so a first launch listens to the instrument. A
  restored rig keeps its own saved input; the view's on-appear hook only requests
  mic access for a restored live selection (test-loop fallback on denial).

Test: RigStore.restoreAppliesSavedChannelLayoutAndInput. 461 tests pass; both
app targets build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 15:34:23 -07:00
josh 5987ec7b78 Add input mute + persist engine I/O counts
Input mute: a hard gate on the signal feeding every board (guitar / mic),
distinct from the rig-output mute. Each board input writer (TestLoopTap /
HardwareInputPassThrough) gains a lagged @UIParam mute gain; ShoeGaze holds
inputMuted (default true), drives every input node, and brings newly-added
boards up at the current state. A deliberate user Start re-asserts the mute so
a fresh engine is silent until the player un-mutes — cutting accidental noise.
Toggle sits beside the Start/Stop transport and is MIDI mappable
(MIDIMap.Action.inputMute). First launch now defaults to live In 0 instead of
the test-loop arpeggio.

I/O persistence: the engine's input/output channel counts now persist to
UserDefaults (written by EngineConfigView, restored by the app targets at
engine construction), so a multi-channel setup survives relaunch and a saved
live-input channel stays valid — fixing the input selection reverting to the
test loop after a restart.

Tests: InputMuteTests (default-muted, node driving, per-board adoption, live
path) + a MIDI PC input-mute latch test. StereoRouting render tests un-mute
before rendering. 460 tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 15:17:51 -07:00
josh 7e39842eb2 2.1.1: ignore MIDI CC on tempo-synced parameters
A CC bound to a pedal parameter locked to a note division is now ignored while
synced — the value is tempo-derived and a CC write would be overwritten on the next
tempo change. Index-stable: ccMappableControls is unchanged (persisted bindings resolve
by position), and only the CC *write* is skipped. MIDIController.applyCC checks
Pedal.isNodeTempoSynced(_:) (node-identity match against tempoSyncableParams) and
skips the update; the binding stays intact and resumes control once set back to Free.

Test: MIDIControllerCCTests.ccIsIgnoredWhileParameterIsTempoSynced. 455 tests pass.
Docs: CHANGELOG.md, RELEASES.md, plan MIDI section updated to "implemented".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 09:00:24 -07:00
josh 2772abdc56 Release 2.1.0: tempo-synced pedal parameters, editable BPM, control mapping badges
Tempo sync
- Lock a delay time or modulation LFO rate to a note division (whole..sixteenth,
  dotted, triplet) of the shared clock. Value is derived from the tempo and follows
  tap tempo, the stepper, the editable BPM field, and MIDI.
- Delay time: Delay, FeedbackDelay, PingPong, ReverseDelay, MultiTap (per tap).
  LFO rate (inverse mapping): Tremolo, Vibrato, Chorus, Flanger, Phaser, Modulation.
- Core types NoteDivision / TempoSync / TempoSyncableParam; Pedal.tempoSyncableParams /
  tempoSync / applyTempoSync / setSync; ShoeGaze.setBpm broadcast recomputes all pedals;
  tempoSync persisted in PedalState (lenient decode) and recomputed on load + recall.
- Observable TempoSyncRevision so the sync badge refreshes on any state-change path.

UI
- Division picker with drawn music-notation glyphs (NoteGlyphView + rasterized cache):
  noteheads, stems, flags, augmentation dot, bracketed 3 for triplets. Presented as a
  height-capped popover so it stays on-screen on iOS.
- Editable BPM text field: integer-only, live-filtered, clamped 30-300, commit on
  return / Done / blur.
- Divisions that clamp at the current tempo are disabled in the picker; an active
  clamped sync shows a warning marker.
- In-context control mapping badges (PC / CC / KEY) per pedal control, with a legend.

Delays
- Maximum delay time raised to 5 s across the delay pedals (was 1-2 s).

Docs: CHANGELOG.md, RELEASES.md, docs/plans/2.2-tempo-synced-parameters.md.
All 454 tests pass; passed lyrebird_external_review (RT-safe, main-thread param writes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 08:47:22 -07:00
josh a33d5488c9 Add computer-keyboard control mapping
Bind letter/digit keys (with Shift/Control/Option; Command reserved for
menu shortcuts) to the same rig toggle Actions a MIDI Program-Change
footswitch drives. Keys reuse MIDIController's perform(_:) dispatch via a
new .key learn target and ingestKey(_:modifiers:).

Key capture is platform-specific: macOS installs an AppKit
NSEvent.addLocalMonitorForEvents(.keyDown) monitor (SwiftUI .onKeyPress
only delivers to the focused view); iOS uses .onKeyPress with the root
made focusable/focused, reclaiming focus when a text-field modal closes.
Both gate on the first responder not being a text field so typing is
never hijacked, filter key-repeat, and reserve Command for the menu.

MIDIMap gains keys:[KeyBinding] and a KeyModifiers OptionSet, both with
tolerant Codable decode so old rigs (no keys / no modifiers) still load
with switches/ccs intact. The mapping sheet is unified: each switch row
shows its footswitch (PC) and key bindings with per-source learn/clear,
and the sheet is retitled "MIDI / Control Mapping".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 15:03:12 -07:00
josh e051521c04 Release 2.0.0: metronome, rig mute + shortcuts, set-list ordering, per-rig persistence
- Visual metronome tempo indicator (pendulum playhead) replacing the flashing LED
- Rig Mute (Cmd-Z) hard-silence, distinct from Bypass Rig; wired to header, board menu, MIDI
- Keyboard shortcuts: Cmd-1..9 board switch, Cmd-Shift-1..0 set-list rig load, Cmd-Z mute
  (macOS native menus + iOS/iPadOS hardware keyboards)
- Rig set-list ordering: drag or Move Up/Down in the picker; order saved and archive-portable
- Persist tempo, input selection, and engine I/O with a rig (I/O applied via opt-in
  applyChannelLayout, not forced on load)
- Fix archive import colliding set-list positions with existing rigs
- Remove ShoeGazeDemo / ShoeGazeiOSDemo apps and projects; keep the two Builder apps
- Bump marketing version to 2.0.0 on both Builder projects; pin Lyrebird 1.2.3
- Add CHANGELOG.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 12:30:45 -07:00
josh d07247e40e Address review: drop stale doc + dead looperTimeline property
- LooperPedal.widthUnits doc updated "double-width" -> triple-width.
- Remove the now-unreachable looperTimeline property (LooperTimelineView is
  rendered from looperColumnarContent; the columnar branch always intercepts
  the looper before defaultContent).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 13:11:12 -07:00
josh bdfbe04713 Looper: wide 3-column layout to fit tall pedal without scrolling
The looper stacked too many sections to fit the board canvas. Render it (only)
in a wide, three-column layout at widthUnits = 3:

- Left column: loop timeline, Free/Sync switch, Reset footswitch.
- Centre column: the four effect knobs (2×2) over a Level + Bypass footer, with
  the Mix slot reserved empty so Bypass stays horizontally centred like a normal
  pedal.
- Right column: transport footswitches in a 2×2 grid — Record / Reverse over
  Stop / Cue Stop (ordered by label).

Every other pedal keeps the default single-column section stack (extracted into
PedalView.defaultContent, no behaviour change).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 13:05:57 -07:00
josh 5090a9255f Looper reverse fix + header layout compaction + tempo toggle
Looper:
- Reverse now continues from the current play-head instead of jumping to
  duration-minus-position; anchor-based position tracking survives direction
  changes. Sync mode defers the flip to the next beat; Free applies immediately.
- Sync switch relabeled "Sync to Tempo".

Tempo/Tuner:
- Add a Tempo on/off toggle (ShoeGaze.setTempoEnabled) that hides the indicator
  and forces every tempo-dependent pedal switch (PedalSwitch.tempoDependent) off;
  PedalSwitchView disables such switches via the shoeGazeTempoEnabled environment.
- Tuner readout laid out inline; Tempo/Tuner pinned to fixed heights so toggling
  state no longer shifts surrounding layout.

Header:
- Collapsed to two rows: title + Tempo/Tuner (left, stacked) and engine options
  over input controls (right, trailing-aligned). TAP is a standard-height button.
- Removed the redundant Boards button; moved Clear into the board bar.
- Fixed the rig mute glyph size so toggling mute doesn't shift the volume row.

Help: added a Looper section documenting transport, Free/Sync, knobs, tracks,
and MIDI-assignable actions.

Tests: TempoEnableTests + looper reverse/deferral coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-04 12:31:11 -07:00
josh b6f1d78066 Looper: MIDI-mappable A/B/C/D track taps
Add looperTrack(index:) PedalActionKind dispatched to LooperPedal.tapTrack, and
Track A–D rows in the MIDI mapping sheet (one per track, up to trackCount). A
mapped switch/Program Change taps the dot — selecting the track, or muting it
when it's already selected and recorded — matching the timeline dots. Covered
by pedalActionTapsLooperTrack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 18:54:47 -07:00
josh 296ca1b24e Looper: per-track mute via the A/B/C/D dots
Each track player now runs through a smoothed per-track mute gate. Tapping a
track dot selects it (as before); tapping the already-selected, recorded track
toggles its mute (tapTrack). Muted dots dim and show a slash. Mutes clear on
reset and don't survive a rebuild. Covered by tapTrackSelectsThenMutesRecordedTrack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 17:29:16 -07:00
josh 3ef39a7a0d Looper: MIDI-mappable Sync, cycling through the switch options
Add a looperSyncToggle PedalActionKind (dispatched to LooperPedal.cycleSyncMode)
and a Sync row in the MIDI mapping sheet. A mapped switch/Program Change
oscillates the control through its positions on each press, via a reusable
PedalSwitch.nextValue(after:) that advances to the next option and wraps — so
this generalises to any multi-position switch, not just the two-state Sync.

Tests: cycleSyncModeOscillatesThroughOptions, pedalActionCyclesLooperSync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 17:24:50 -07:00
josh 5dafc00d98 Looper: add Sync / Free transport mode toggle
New syncToBeat switch (Free / Sync, default Sync) rendered as a segmented
control below the knobs and persisted with the rig. When off, runQuantized
applies transport immediately (freeform — loop length is whatever you play,
not beat-measured) even with a clock present; when on, record start / loop
close arm to the next beat as before. Not reset by resetLoop / resetForRebuild
so the mode sticks. Covered by freeformModeRecordsImmediatelyDespiteClock.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 17:16:13 -07:00
josh fb3e2d2653 Looper: make effect() idempotent across graph rebuilds
The engine re-invokes build()/effect() via rebuildGraph() on every add —
including the re-adds a board edit (reorder, insert/remove a neighbour, toggle
a split) or a rig load performs on the same instance. effect() appended to the
per-track arrays (buffers/players/overdubRecorders/overdubGates) each time, so a
second build doubled them, desyncing the generators from the fixed-size state
arrays and leaving the whole looper UI/transport wrong — a broken state that
stuck and reproduced from a saved rig. Reset the arrays and transport state at
the top of effect() (resetForRebuild) so a rebuild starts clean; the freshly
re-allocated buffers are empty, so returning to the clear state is correct.

Regression: rebuildDoesNotDoubleTrackGenerators (two effect() calls keep each
array at trackCount).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 17:07:48 -07:00
josh ae067ac6d7 Looper: regression coverage for record-after-reset (both paths)
Add quantizedRecordsAgainAfterReset, driving the beat-quantized
applyQuantizedTransport generation-guard path across a reset, plus the
immediate-path recordsAgainAfterReset. Both confirm the transport state
machine re-enters recording/playing correctly after a reset. Expose
applyQuantizedTransport / QuantizedAction as internal for the test seam.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 16:58:18 -07:00
josh 6f651b6e17 Looper: reset also clears reverse and the transient notice
resetLoop() left `reverse` untouched, so after a reset with reverse engaged the
next take's auto-overdub on track A was silently blocked (closeMasterAndPlay
skips overdub while reversed) and playback ran backward — the "record/overdub
after reset looks broken" report. Reset now returns to forward playback and
also clears any lingering engine-stop/rig-change notice so it can't mask the
fresh state indicator. Covered by recordsAgainAfterReset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 16:52:18 -07:00
josh 67d4434220 Looper: address review — router pedals + doc fixes
allPedals() (used by stopEngine / teardown to notify pedals) now also walks
ChainRouter branch boards, so a looper placed in a parallel-router branch gets
engineDidStop() / rigWillTeardown() like any other. Factor the per-board walk
into pedals(in:).

Restore addBoard()'s doc comment (it was displaced above stopEngine when that
method was inserted) and document the engine-stopped precondition on
Pedal.rigWillTeardown().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 16:34:45 -07:00
josh b99a526df6 Looper: MIDI-mappable transport; clean-through + Playback balance
MIDI: add looperStop / looperCueStop / looperReverse PedalActionKind cases and
dispatch them (stopPlayback / toggleStopAtLoopEnd / toggleReverse). The MIDI
mapping sheet now lists Record / Stop / Cue Stop / Reverse / Reset as
Program-Change-mappable switch actions for each looper pedal (previously only
Bypass was surfaced).

Mix: the clean guitar now always passes through at full level and the loop bank
is summed on top (dry + loop·gate) instead of crossfading dry against the loop.
The Playback knob therefore sets the looped-vs-live balance. Hide the confusing
wet/dry Mix knob for the looper via a new Pedal.showsMixControl (mix stays fully
wet); other pedals are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 16:08:25 -07:00
josh d728bfa72a Looper: also reset on rig teardown
Add a Pedal.rigWillTeardown() hook fired for every pedal at the top of
ShoeGaze.teardown() (rig load / clear / input-source change), while the pedal
is still live. LooperPedal resets and posts a notice, sharing the path with
engineDidStop() — so a looper stops its background routines cleanly and logs
before its instance is discarded across a rig change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 15:25:12 -07:00
josh fee7892101 Looper: stomp-style Reset button; reset on engine stop
Reset now renders as an LED + footswitch like the other transport buttons —
its LED lights whenever there's something to reset (any non-clear state),
driven off a phase didSet.

Add a Pedal.engineDidStop() hook, invoked for every pedal by a new
ShoeGaze.stopEngine() that the user-facing Stop control now calls (transient
stop-around-rebuild sequences still call engine.stop() directly, so pedals
keep state across a restart). LooperPedal overrides it to return to the clear
state, post to LyrebirdMessageCenter, and briefly show "Looper reset — engine
stopped." on its own card via the state indicator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 15:20:33 -07:00