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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
Non-blocking cleanups from the clean review pass:
- EngineConfigView.startEngine: collapse the redundant early-return in the
sample-rate-mismatch branch into the shared tail.
- InputMuteButton: hoist the 0.2s settle duration to a named pulseSettleDuration.
- InputMuteTests: correct a stale "input defaults muted" comment (library default
is audible; the test mutes explicitly).
- Plan doc: setInputMuted(true) runs before engine.start(), not after; note the
addBoard priming.
464 tests pass; macOS app builds.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Phase-lock: reset the overdub recorder write heads (requestReset) and the
player play-heads (playTrigger rising edge) synchronously in startPlayback so
both re-anchor on the same audio block, instead of deferring the trigger an
extra run-loop turn; playTrigger is zeroed on every stop for a clean 0→1 edge.
This also makes overdub actually record under NRT.
Reverse vs overdub: overdub records forward-in-time and can't follow a reversed
play-head. Block engaging overdub while reversed, and make Reverse a
toggleReverse() action that ends any active overdub when engaging reverse (the
footswitch keeps its LED via indicator: $reverse).
resetLoop: gate isPlaying off before clear() so the buffer-clear overlaps at
most one in-flight RT block; corrected the rationale comment.
Docs: fix stale $overdubOn / .empty / .recording references.
Tests: overdubbingTrackAAddsEnergyToTheLoop (NRT overdub records),
overdubBlockedWhileReversed, engagingReverseWhileOverdubbingEndsOverdub.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the one-at-a-time slot model with a synchronized multitrack looper:
four track players summed to one output, track A's first take defining the
master loop length, and tracks B–D recorded as phase-locked overdub layers
on the same grid (overdub recorders run continuously while playing, reset to
the top at play-start, gated per-track by recLevel so only the selected
track layers new input — instant, drift-free overdub toggles).
A single smart Loop footswitch drives the whole transport by state:
record A → set end (quantized) → auto-overdub on wrap → toggle overdub/play;
B–D toggle overdub aligned to A's play-head. Selecting a track ends the
prior overdub. Stop / Cue Stop pause; Loop resumes. Reset returns to clear.
UI: transport row is now Loop / Stop / Cue Stop / Reverse / Reset; the old
action row is replaced by a one-line state indicator; the A/B/C/D timeline
dots are tappable to select a track; every stomp button shows a live caption
of what its next press does (Record → Set End → Overdub → Play, etc.).
Overdub-undo dropped. All transport routines keep the transportGeneration
guard on deferred beat/stop callbacks.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Checkpoint before the multitrack redesign. Adds 4 loop slots (one player
swapped via setBuffer), a play-head timeline with A/B/C/D dots, Loop/Stop/
Cue Stop/Reverse stomp toggles below the knobs, beat-quantized transport,
overdub undo, reverse, and feedback-decay overdub — all reviewed for RT
safety (transportGeneration guards on deferred beat/undo/cue callbacks).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extend the looper into a double-width tempo-aware pedal:
- Beat-quantized transport: record start and loop close both snap to the
next beat via a LyrebirdRoutine waiting on the shared clock; loop length
is an exact whole-beat span. Falls back to immediate/unquantized when no
clock is present.
- Loop-length read-outs (frames/seconds/beats), transport state, and a
sample-clock-derived play-head position for the UI timeline.
- Overdub undo (pre-dub snapshot + restore), reverse playback (live rate
flip), and feedback-decay overdub (overdub preLevel via a Feedback knob).
- Inject the shared LyrebirdClock + SynthesisEngine into Pedal via
PedalBoard/ChainRouter so tempo-aware pedals can reach them.
- New double-width LooperTimelineView (state badge, length read-out,
sweeping play-head) wired into PedalView via Pedal.widthUnits.
Concurrency hardening from RT-safety review: a transportGeneration counter
drops superseded deferred beat/undo callbacks that LyrebirdRoutine.stop()
cannot recall once enqueued; the undo restore is deferred past the RT
overdub gate-close; transport routines use non-blocking stop().
Note: this commit also snapshots pre-existing uncommitted work-in-progress
already in the tree (MIDI control refactor, Tuner, Tempo, preset changes),
which is interleaved with the looper changes through shared files and could
not be split into a separately-building commit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Volume is a CC-mappable [0,1] gain applied after every board's output; mute
is a separate hard gate (not the existing dry bypass), togglable via
Program Change. Both are lagged to avoid clicks and fan out across all
boards from a single ShoeGaze-level setter.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Wrap three Lyrebird 1.2.0 reverb algorithms as pedals, mirroring ReverbPedal
(run the generator pure-wet, let the base Pedal mix blend):
- Plate Reverb — PlateReverb.Audio (Dattorro plate), stereo folded to mono.
Knobs: Decay, Tone, Damp, Mod.
- Room Reverb — GVerb.Audio (FDN room/hall), stereo folded to mono.
Knobs: Size (m), Decay (T60 s), Damp, Tail.
- Spring Reverb — SpringReverb.Audio in mono (stereo:false, no fold).
Knobs: Decay, Tension, Damp.
Each registered across the six touchpoints (type, registry, category .reverb,
palette order, enclosure colour) with a test suite (build+render, param
changes output, knob labels, preset round-trip, registry membership).
339 tests pass; both app targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Root cause of the "highlight right, wrong graph" restart: the autosave held a
midiMap written by an older binding schema (CCTarget was a struct before it
became an enum). Decoding threw, loadRig threw, RigStore.restore failed, and the
app fell back to seeding a single default board — so the graph showed Default
while the highlight (correctly) showed the loaded rig.
ShoeGazeState now decodes midiMap with try?, so an unreadable/incompatible map
drops just the (re-learnable) bindings while version + boards decode strictly.
The rig survives.
Test: a malformed midiMap decodes to nil without throwing. 324 green; both app
targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
captureSwitch stole a Program Change from any prior action, so one footswitch
could only drive one toggle. applyProgram already fires every matching binding,
so this just drops the steal-by-program: one binding per action (re-learning an
action replaces it), and a single PC may drive MANY actions — a "scene" (e.g.
bypass two pedals, or solo a board and bypass another, from one press). Mirrors
the CC multi-target change.
Tests: one PC drives two actions and toggles both; re-learning an action
replaces its program. 323 green; both app targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bug: assigning a CC to a second control invalidated the first. captureCC
stole any binding sharing the CC number, which directly defeats the crossfade
use case. Now one binding per CONTROL (re-learning a control replaces it), and
a single CC may drive MANY controls — map two board levels to one CC, invert
one, for a crossfade.
Bug: at launch the sidebar could highlight a different rig than the loaded
graph. restoreCurrentRig() highlighted a rig from a separate UserDefault that
drifts from the autosave working graph (restored independently). It now derives
the highlight from the actual working graph — matching the library entry whose
state equals it — so the highlight can never disagree with what's shown; an
edited/unsaved session highlights nothing.
Review nits: cache ccMappableControls in resolveCC (one array build per CC
instead of two); explicit type annotations on the mapping-sheet for-loops.
Test: one CC drives two controls with one inverted (crossfade). 322 green;
both app targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Each CC binding gains an "Invert" toggle in the mapping sheet (shown once the
control is bound). Inverting swaps the sweep — CC 0 drives the control to its
max, 127 to its min — so a single expression pedal can crossfade two controls:
map both to the same CC and invert one.
The MIDICCBinding.inverted field and applyCC already honored inversion; this
adds isCCInverted / setCCInverted plus the sheet toggle, and the binding label
now notes "· inverted".
Test: an inverted binding reverses the mapped output. 321 green; both app
targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Maps the rig's "All" button (selectAllBoards — cancel any solo, bring every
board back up) to a Program Change. One-shot (no latch); rig-level, so no
board hint. Appears in the Switches section under Rig Bypass.
Test: PC fires selectAllBoards, clearing an active solo. 320 green; both app
targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The MIDI Mapping sheet's two sections both keyed their ForEach rows on the
enumeration offset (0,1,2…) and the Expression section mixed a bare header
Text with a ForEach. SwiftUI's List reused structurally identical row views
across the sections, so Program-Change switch rows (e.g. "Board 1 · Solo",
"Board 1 · Overdrive · Bypass") leaked into the Expression (CC) section and
their Learn button armed a Program Change instead of a Control Change.
- Rebuild both sections from precomputed row models with globally-unique,
section-namespaced string ids and a single ForEach each; no bare headers.
- CC target is now an enum: `.pedalControl` (a knob/slider) or `.boardLevel`
(the board fader). Board master level is now CC-assignable, shown as
"<Board> · Level".
- CC rows are labelled "<Pedal> · <Control>" (e.g. "Overdrive · Drive").
- Stale-binding + steal-on-reassign now key off an address matcher on the
target enum.
Tests updated for the enum target; added a board-level CC test. 319 green;
both app targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review fixes:
- Remove stale phase-plan references from MIDIController / MIDIMappingSheet
doc-comments (describe current behavior instead).
- insertPedal: a board with no linear pedals but a trailing routing region
now inserts at the head (before the region) instead of appending after it.
- Drop the unused MIDIController.retarget (the app recreates the controller
against a fresh engine rather than re-pointing it).
- CC steal now matches controller AND channel, so per-channel CC bindings
can coexist.
Feature (requested): CC mapping now covers every continuous pedal control,
not just rotary knobs. New PedalControl descriptor + Pedal.ccMappableControls
(knobs followed by effect sliders); the Expression sheet lists them grouped
per pedal with a header, so slider params (e.g. EQ bands) are assignable and
labelled clearly. Knob-first ordering keeps existing CC bindings stable.
Tests: +2 (CC drives a slider control; insert into a region-only board lands
before the region). 318 total green; both app targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Headline: MIDI control for a Behringer FCB1010 (four phases).
- MIDIController (Lyrebird MIDI client): connection indicator via source
polling, background-queue->main-actor hop, MIDI Learn.
- Volume and Wah pedals (Wah reuses the SVF bandpass sweep, driven by
pedal position instead of an envelope follower).
- CC -> any pedal knob (0-127 mapped across the knob range).
- Program Change -> pedal/board/rig toggles: software latch for booleans,
exclusive radio for board solo. Positional addressing with display-name
hints; stale/out-of-range bindings are skipped, not fired.
- Per-rig MIDIMap embedded in ShoeGazeState as an optional field (old rigs
decode to nil; no preset version bump). Central MIDI Mapping sheet with
Learn/Clear per control.
Also included (same working branch):
- Full board bypass and rig bypass (dry passthrough via cascaded
crossfades in BoardOutputMaster), with UI toggles.
- Horizontal pedal picker grouped by category in filter order.
- Drag a palette pedal onto a chain card to insert before it
(ShoeGaze.insertPedal); tap still appends.
- iOS: guard macOS-only .menuStyle(.borderlessButton) to silence the
_UIReparentingView warning; iCloud-unavailable alert; keep the device
awake while audio runs.
Tests: 24 added (Volume/Wah, MIDIMap Codable incl. legacy decode,
CC and PC controller behavior, insert/bypass API). Full suite green;
macOS and iOS app targets build.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Introduce a single shareable document type for rigs and boards:
- ShoeGazeDocument: versioned JSON envelope wrapping either a RigArchive
(one or many rigs) or a BoardVersion, with a tolerant decoder that also
reads the legacy bare-RigArchive and bare-ShoeGazeState shapes.
- Register the .shoegaze UTType (net.realizedsound.shoegaze, conforms to
public.json) in all four demo app Info.plists.
- Migrate library export/import onto the envelope: exportDocumentData() and
a decoder-tolerant importArchive(); RigFileDocument and the Builder
exporter/importer now use .shoegaze. Internal per-rig and board-version
files stay app-private JSON.
- Add OS share-sheet entries via SwiftUI ShareLink: Share per rig in the
library sidebar, Share per version in the board editor, backed by the
Transferable wrappers RigShareItem / BoardShareItem.
Tests: ShoeGazeDocument round-trip and legacy decode, library .shoegaze
export/import round-trip, and a board-document-imports-no-rigs case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The granulators read grains from behind the write head, so each grain
replayed the last grainSize of audio — an audible delay. Rework
StereoGranulator to the straight-through approach (matching Lyrebird's
InputGrain at position 0): grains apply their Hann window and random pan to
the LIVE input sample with no look-back buffer, so there is zero added
latency. Output is normalised by overlap so density doesn't change level.
Drops the circular buffer entirely.
GranulatorPedal / AutoGranulatorPedal are unchanged (same generator API).
Generator tests (seeded determinism, zero-spread centering, full-spread
L/R separation) still hold. Suite 271.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- StereoGranulator generator: records mono input into a circular buffer and
replays overlapping Hann-windowed grains, each randomly panned by `spread`
(0 = centred, 1 = full field). Voice pool + control-rate grain size /
overlap / spread, all pre-allocated; inlined xorshift64 for grain pans.
- GranulatorPedal (.widener): Grain / Overlap / Spread.
- AutoGranulatorPedal (.widener): grain size tracks input level via
AmplitudeFollower → LinLin, with a Response switch (Loud→Short / Loud→Long)
selected by a CrossFade. Min/Max Grain / Overlap / Spread.
- Pedal picker (PedalPaletteView): cards colour-coded by a new PedalCategory
(Gain/Dynamics/EQ&Filter/Modulation/Pitch/Delay/Reverb/Texture) plus a
"filter by type" menu defaulting to All.
Tests: generator (seeded determinism + stereo-spread L/R separation) and
both pedals (build/non-silent, param/response changes, knobs, registry,
preset round-trip). Suite 271.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>