Files
ShoeGaze/docs/amp-modeling-2.0-plan.md
T
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

113 lines
6.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ShoeGaze 2.0 — Amp Modeling Plan
Adds guitar-amp modeling to ShoeGaze. Core DSP primitives that don't yet exist land in
Lyrebird and ship as **Lyrebird 1.7**; the amp pedals + UI land in ShoeGaze and ship as
**ShoeGaze 2.0**.
Feasibility basis: the public literature is deep (WDF/DAFx for white-box, NAM/GuitarML for
black-box), and Lyrebird already provides most of the DSP (oversampling, waveshapers, the full
filter suite, `SampleLoop` per-sample feedback, partitioned FFT convolution via
`ConvolutionReverb`, WAV IR loading via `LyrebirdBuffer.read(filePath:)`, and the
`PhysicalModels` precedent for nonlinear stateful per-sample DSP). The only genuine gap is a
real-time neural-inference kernel.
## Versioning & repo strategy
- **Lyrebird → 1.7.0** for every core addition. Dev repo is BitBucket (`origin`, SSH); public
release repo is mooo. Cut 1.7 once the needed core subset is merged to `main`: RELEASES entry,
tag `v1.7.0`, push BitBucket, then `/lyrebird_release_prep` → commit/tag → push mooo
(**HTTPS, force `-c http.version=HTTP/1.1`** — mooo's HTTP2 is flaky).
- **ShoeGaze → 2.0.0**. `origin` is mooo (HTTPS). Bump `Package.swift` dependency to
`from: "1.7.0"` once 1.7 is released; bump `MARKETING_VERSION` to `2.0.0` at the end.
- **Dev-time cross-repo:** ShoeGaze work needing unreleased Lyrebird uses
`swift package edit lyrebird --path <dev-repo>` locally, then drops the override and bumps
`from:` after 1.7 ships. (Same flow used for the 1.6.4 work.)
## Branch + review gates (apply to every feature below)
**Lyrebird feature** (`feat/<name>` off `main`):
1. `swift test` green.
2. Guards as applicable: `check-docc.sh`, `check-doc-snippets.sh`; if a public generator init
changes, regenerate the DSL registry and run `generate-dsl-registry.sh --check`.
3. `/lyrebird_review` clean (no blocking findings) — re-run until clean.
4. FF/merge to `main`. Append phase entry to `phase_history.md`.
**ShoeGaze feature** (`feat/<name>` off `main`):
1. `swift test` green.
2. `/lyrebird_external_review` clean (RT-safety on any new Generators).
3. Merge to `main`.
New public RT generators require a deterministic input→output test (not just "not silent") —
e.g. the Goertzel alias-ratio pattern used for the oversampled saturators.
## Phase 0 — Decisions (no code)
- **Neural kernel strategy:** (a) hand-written Swift LSTM/GRU (Proteus-size), or (b) bridge
RTNeural (C++) via the existing `LyrebirdC` target. **Recommend (a)** first — pure Swift keeps
the Linux/Windows port intact (see the cross-platform feasibility work) and Proteus-size LSTMs
are small. Keep (b) as an optional fast-path later.
- **White-box depth:** full nodal/WDF vs static triode waveshaper + oversampling. **Recommend
static-waveshaper triode stages first** (Koren/Dempwolf transfer curves), add a minimal WDF
core later only if the voicing demands true bidirectional stages.
## Lyrebird 1.7 — core additions
Only what has no existing primitive. Each is its own branch + `/lyrebird_review`.
- **L1 · ToneStack generator** (`feat/tonestack`) — passive Fender/Marshall/Vox tone-stack IIR
(Yeh coefficients), control-rate coefficient updates. Filters exist but not this specific
topology as a first-class, model-selectable block.
- **L2 · Triode preamp stage** (`feat/triode-stage`) — nonlinear tube gain stage: bias +
coupling cap + Koren/Dempwolf static curve, **built-in 2×/4× oversampling** (reuse the
halfband primitives), grid-conduction asymmetry. The white-box building block.
- **L3 · Neural inference generator** (`feat/neural-inference`) — RT-safe LSTM/GRU (and later
WaveNet) as a `GeneratorBase` subclass: weights preloaded at `init` into pre-allocated
matrices, alloc-free/lock-free per-sample matmul on the render thread (same discipline as the
physical models). Plus a weight-container loader for NAM `.nam` / Proteus JSON.
- **L4 · (optional) WDF core** (`feat/wdf-core`) — minimal wave-digital adaptors (series/parallel
/R/C/diode + triode root with a **bounded, alloc-free Newton solve**). Defer unless L2 proves
insufficient.
- **L0 · Verify, likely no-op:** cabinet convolution + WAV IR loading already exist
(`ConvolutionReverb`, `LyrebirdBuffer.read`). Confirm the convolver is comfortable with
cab-length IRs (tens of ms) at low latency; only add a thin general `Convolution` alias if the
reverb framing is awkward for cabs. **Probably needs no 1.7 change.**
Cut **Lyrebird 1.7.0** after L1–L3 (and L0 if touched) are merged.
## ShoeGaze 2.0 — amp pedals + UI
- **S1 · Cabinet IR pedal** (`feat/cabinet-pedal`) — wraps `ConvolutionReverb` + a bundled/loadable
IR set + IR picker. **No Lyrebird dependency change — ships on 1.6.4.** Quick win; can land
before 1.7. Pair with an oversampled `Waveshaper` for an immediate amp-ish chain.
- **S2 · Component amp pedals** (`feat/amp-component` → `feat/amp-voices`, needs 1.7 L1+L2) —
input → gain → oversampled triode stage(s) → tone stack → power-amp stage → cabinet IR.
Shipped as three dedicated amp-voice blocks — **California** (Fender-style, Bright shelf),
**British** (Marshall-style, Presence shelf), **Chime** (Vox-style, Cut low-pass) — rather than
a single model-selector pedal, so each voice fixes its tone-stack model and exposes its own
signature control. Shared base: `AmpVoicePedal`.
- **S3 · Neural amp pedal** (`feat/amp-neural`, needs 1.7 L3) — loads NAM/Proteus captures;
model browser; DI-in → neural → (optional) cabinet IR.
- **S4 · Amp UI** (`feat/amp-ui`) — amp-head-style card: Gain, Bass/Mid/Treble/Presence, Master,
Cab select, Model select; MIDI/CC mapping; larger `widthUnits`. (Mind the flow-canvas height:
no greedy vertical `Spacer`s — see the looper fix.)
- **S5 · Rigs, presets, release** — factory amp rigs; docs; bump dep to Lyrebird 1.7, app to
2.0.0; tag + push mooo (HTTP/1.1).
## Suggested order
1. S1 cabinet pedal (independent, ships on 1.6.4).
2. Lyrebird 1.7: L1 tone stack → L2 triode → L3 neural (each branch + review); cut 1.7.
3. ShoeGaze: S2 component amp, then S3 neural amp; S4 UI alongside; S5 release 2.0.
## Risks / open items
- **RT budget:** stacked oversampled stages + convolution + neural can be heavy. Measure with the
CPU meter; consider `ParallelGroup` for independent chains.
- **Neural portability:** Swift kernel preserves the cross-platform port; an RTNeural C++ bridge
would not — decide in Phase 0.
- **WDF Newton solve** must be strictly alloc-free with bounded iterations to satisfy RT rules.
- **Licensing:** vet cab-IR and NAM-model licenses before bundling any factory content.
- **Anti-aliasing:** every nonlinear stage oversamples (the halfband primitives are proven);
neural distortion aliases too — consider the fine-tuning / oversampling mitigations from the
recent literature if artifacts appear.