8000 feat(knobs): Ableton-style active-range arc on knobs + FX encoders by johannboehme · Pull Request #58 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

feat(knobs): Ableton-style active-range arc on knobs + FX encoders - #58 8000

Merged
johannboehme merged 1 commit into
mainfrom
knob-active-arc
Jun 20, 2026
Merged

johannboehme merged 1 commit into
mainfrom
knob-active-arc

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Was

Jeder Drehregler bekommt einen prägnanten, farbcodierten Aktivbogen im Ableton-Stil, der von „neutral" bis zum aktuellen Wert läuft — damit man den exakten Stand auf einen Blick sieht. Die skeuomorphe Optik (Body, Knurling, Cap, Highlights) bleibt komplett unangetastet.

Änderungen

  • Knob.tsx (PILL OFFSET / USER OVERRIDE, VOL): Bogen als Außenring direkt hinter der Tick-Skala. Unipolare Ranges (VOL) füllen vom Minimum, bipolare (PILL OFFSET) wachsen aus der Null-Mitte.
    • Behebt nebenbei einen latenten 90°-Versatz: Tick-Ring und sein oranges Fill waren gegen die Nadel verdreht (Totzone links statt unten). Ticks, Fill, Bogen und Nadel nutzen jetzt dieselbe -90°-Konvention wie der FX-Encoder → alles zeigt gleich, Totzone unten wie bei echter Hardware.
  • FxHardwarePanel.tsx (FX-Encoder): Bogen als innerer Glühring dicht um den schwarzen Knob-Body, im Encoder-Tint (hot/cobalt). Bipolare Params (RATE, BEND, TRAIL, …) wachsen aus der Center-Detent, lineare vom Skalenanfang.

Beide nutzen eine blasse Voll-Schiene für den ungenutzten Bereich und einen weichen Glow unter dem Aktivbogen (Doppel-Stroke, kein teurer SVG-Filter).

Verifikation

  • tsc --noEmit sauber.
  • Playwright-Screenshots über alle Fälle: unipolar (min→max), bipolar (−/0/+), beide FX-Encoder (linear PUNCH + bipolar RATE). In jedem Fall endet der Bogen exakt an der Nadel, Ticks und Bogen decken sich, keine Konsolen-Fehler.

🤖 Generated with Claude Code

8000
A bold, colour-coded arc now traces from "neutral" to the current value
around every rotary control, so the exact position reads at a glance —
without touching the skeuomorphic body.

- Knob.tsx: arc as an outer ring just past the tick scale; unipolar
  ranges fill from min, bipolar ranges (e.g. PILL OFFSET) grow from the
  zero-crossing. Also fixes a latent 90° offset — the tick ring and its
  orange fill were rotated a quarter-turn off the indicator; both now use
  the same -90° convention as the FX encoder, so ticks, fill, arc and
  needle all agree and the dead-zone sits at the bottom.
- FxHardwarePanel.tsx: arc as an inner ring hugging the black knob body,
  in the encoder tint (hot/cobalt); bipolar params grow from the centre
  detent, linear from the scale start.

Both use a faint full-sweep track for the unused range and a soft glow
under the active arc (double-stroke, no SVG filter).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@johannboehme
johannboehme merged commit e978231 into main Jun 20, 2026
1 check passed
@johannboehme
johannboehme deleted the knob-active-arc branch June 20, 2026 13:40
johannboehme added a commit that referenced this pull request Jun 20, 2026
…acros/effect, Ableton-style sidechain scope (#61)

* fix(fx): terminate dangling punch-in holds so they can't lock/grow forever

A persistent (recording) FX hold whose pad pointer-up never arrived — window
blur, tab switch, or the auto-stop at song end — stayed in `fxHolds` forever:
its `outS` kept growing on the next play and clearAllFx couldn't remove it
(clear-all preserves live recordings by design, which is correct). The pad
deliberately skips setPointerCapture for multi-touch, so a lost pointer-up
is realistic.

- store.setPlaying(false) now finalizes every persistent hold via the normal
  release path → it becomes an ordinary committed capsule (erasable/clearable).
- FxPad adds an off-pad release guard (window pointerup/pointercancel/blur)
  and an unmount cleanup, both ending only persistent holds — preview holds
  latch by design.
- clearAllFx left unchanged (the inverted-filter diagnosis was wrong; its
  filter matches the X-hold-to-clear contract).

Tests cover finalize-on-stop, post-finalize deletability, and that clear-all
still preserves a genuinely live recording.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(fx): uniform modulation engine (envelope ⊗ lfo|sidechain), pure+tested

New `fx/modulation.ts` — the single source of truth for P-FX intensity:
- intensity = envelope (always on) ⊗ one time-modulator (LFO XOR sidechain),
  blended by `depth`; returns { level, phase }.
- Beat divisions derive from the REAL bpm (60/bpm·beats), not a hardcoded
  120. `bipolarRateLabel` and `bipolarRatePeriodS` share one table, so the
  displayed division can never disagree with what renders (kills the old
  UI↔backend inversion). TE direction: near-centre = slowest, far = fastest.
- beat-synced LFO is grid-anchored in master-time → pulses land on the song
  beats with a crisp onset, independent of where the punch started.
- LFO shapes (sine/triangle/saw/ramp/square) peak on the beat at phase 0.
- sidechain follower: threshold → normalize → asymmetric one-pole
  (attack/release) → invert, as a reusable curve so renderer and the
  preview band agree exactly.

Pure module, no store/DOM/time-source deps. 15 unit tests. Not yet wired
into the render path (next commits).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(fx): route render intensity through the modulation engine (parity-safe)

Wire `computeIntensity` into the live descriptor so P-FX intensity is the
unified envelope ⊗ (lfo|sidechain). Legacy fx (only an `envelope`) are
wrapped as a depth-0 modulation → identical render (all 38 existing
build-descriptor tests pass unchanged).

- PunchFx gains optional `modulation`; FrameFx gains optional `phase`
  (centralized cycle phase for effects with internal geometry).
- buildFx now takes tMaster and reads bpm/beatPhaseS/beatsPerBar/audioEnv
  from the snapshot; sidechain follower curves are memoized per
  (audio-env, config).
- defaultReadSnapshot threads real bpm + grid phase (selectors/timing) and
  the new store `audioEnv` field (+ setAudioEnv; null until Part D fills it
  from decoded PCM).

New tests prove the live path: beat-synced LFO modulates on/off the beat at
the real BPM, sidechain follows the master envelope (loud→stronger, culled
below threshold), and legacy fx stay bit-identical.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(fx): uniform modulation end-to-end — catalog macros, store, sidechain data, export

Wires the engine into every effect and both render paths.

Catalog: each effect now exposes exactly 2 opinionated linear macros (no
bipolar). Removed bipolarPeriodS/lfoPhase/oneShotPhase/BEAT_STOPS_S — no
effect runs its own LFO; intensity arrives centrally via applyWetness. Per
effect: VIGN DEPTH/EDGE · RGB SPLIT/ANGLE · UV GLOW/TINT · WEAR AGE/ROLL
(tracking-bar drift now from master-time) · ZOOM PUNCH/PUSH · ECHO
SPREAD/FEED · TAPE STOP/WARP. 3-backend parity kept (shader uniforms fed
from t / macros / wetness, no .wgsl/.frag source changes).

Store: per-kind `fxModulations` (ModConfig = timeMod+depth+lfo+side) with
setFxTimeMod/setFxModDepth/setFxLfo/setFxSidechain; beginFxHold freezes the
full Modulation (envelope ⊗ modulator) into each new capsule. Persisted via
PunchFxRecord.modulation so it round-trips. New `audioEnv` (master-loudness
curve) computed at load from the already-decoded PCM (buildLoudnessEnvelope).

Descriptor: the selected kind's live ModConfig drives the preview
(recording-head); committed fx keep their baked modulation. legacyModulation
+ followerFor centralized in modulation.ts and shared by preview + export.

Export parity: compositor runs the same computeIntensity; bpm/beatPhase +
the sidechain audioEnv thread jobs.ts → worker → edit.ts → compositor
(audioEnv only built when an fx actually uses sidechain).

DEFAULT_MODULATION depth 0 → new fx are envelope-only until the user
engages the modulator. Engine/store/descriptor/export tests green (179).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(fx-ui): M-screen with LFO|sidechain toggle + Ableton-style sidechain scope

Adds the modulation control surface to the FX hardware panel, reusing the
existing TE chrome (LCD phosphor/scanlines, screws, brushed metal, JetBrains
Mono, SegmentedControl).

- ScreenModeColumn gains a third "M" button (P/E/M); ScreenMode is now
  params|env|mod. Lcd renders LcdModView in mod mode (LFO/SIDE readout:
  shape glyph + rate label, or THR%, plus DEPTH and SYNC/GATE state).
- ModControls in the encoder slot: SegmentedControl LFO|SIDE →
  setFxTimeMod. LFO branch = shape cycler (∿△◺◹⊓) + RATE knob (shows
  bipolarRateLabel — note division on the synced hal
8FEA
f, Hz on the free
  half) + DEPTH + SYNC toggle. SIDE branch = ATK/REL/DEPTH knobs + INV
  toggle.
- SidechainScope.tsx (new): phosphor-LCD widget drawing the master
  audioEnv as a filled loudness curve, a draggable dashed THRESHOLD line
  (window pointerup/blur drag guard → setFxSidechain), and the resulting
  effect-strength preview band via buildFollowerCurve tinted in the kind's
  capsuleColor, plus a playhead line. "NO AUDIO" placeholder when audioEnv
  is null. The panel grows only in mod+SIDE so the scope gets a strip
  under the controls; every other panel state stays pixel-identical.
- New mini primitives (MiniKnob/MiniToggle/ShapeButton) for the modulator
  controls (the existing Encoder is bound to fxDefaults).

Full suite green (1119 tests), tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(fx): sidechain showed "NO AUDIO" — set audioEnv after loadJob, not before

The master-loudness envelope was computed and stored before loadJob ran,
but loadJob resets per-job state (including audioEnv) to null — so the
value was immediately clobbered and the sidechain scope always read empty.
Move the setAudioEnv call to after loadJob completes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(fx-ui): LFO/sidechain knobs reuse the canonical Encoder look

The M-screen modulation controls were bespoke MiniKnobs that didn't match
the FX macro knobs. Extract a shared presentational `EncoderKnob` from
`Encoder` (etched scale, the #58 active-range arc, body/cap/indicator, drag
+ click-on-scale + double-click reset + off-window release guard; props
value/min/max/kind/tint/label/onChange/onReset/size). `Encoder` is now a
thin fxDefaults-bound wrapper (macro knobs unchanged); ModControls renders
RATE/DEPTH (LFO) and ATK/REL/DEPTH (sidechain) via EncoderKnob at size 36.
MiniKnob deleted. SYNC/INV reuse MiniToggle, SHAPE the ShapeButton — same
hardware family. tsc clean, 1149 unit tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat(fx-ui): zoomed scrolling sidechain scope + readable knob values

The scope drew the whole song squashed to ~270 buckets — individual hits
were unreadable, so you couldn't tune a threshold to the kick. Replace it
with an Ableton-style zoomed window:
- ~8 beats wide, playhead-centred, scrolls with playback; sampled per-pixel
  so each kick/snare is a clear separate peak.
- faint beat grid-lines (downbeats brighter) from bpm/beatPhase so you can
  see exactly where the beats fall and tune the threshold against them.
- master loudness fill + the tinted effect-strength band (memoized follower
  curve, sampled in the window) responding live; threshold line + readout.

Also: the SIDE-mode LCD now shows the actual knob values (THR / DEP / A ms /
R ms) so ATK/REL/DEPTH aren't opaque. tsc clean, 696 editor tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(fx-ui): sidechain scope draws on the arrangement axis (aligns with timeline)

The scope drew the loudness in raw master-audio time centred on the master
playhead (currentTime), while the timeline's MASTER·AUDIO lane draws in
arrangement/timeline time. In a long-form arrangement those are two
different orderings of the same audio, so the peaks didn't line up.

Now the scope is centred on timelineT and every window x is mapped
arr→master (arrToMaster) before sampling the master-indexed loudness +
follower curve; beat grid-lines use the arrangement beat anchor
(arrBeatPhaseS). Same musical content as the timeline → peaks correspond.
(It's still a zoomed ~8-beat detail view, so it shows fewer beats than the
full timeline span; exact 1:1 would need the timeline's view range lifted
to the store.) tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(fx): sidechain peaks line up with the timeline (peak env, centred, 120fps)

The scope's peaks sat a beat-fraction off the timeline's audio peaks even on
the same axis: the envelope was RMS with window-START placement, so it both
read off the transient (energy lives in the note body) and led by up to a
full window. The timeline draws a min/max PEAK waveform.

Match it: build a PEAK (max-abs) envelope, window CENTRED on each timestamp,
at 120 fps. The envelope's peaks now sit on the loudest samples — the kick
transients — exactly where the timeline shows them, and the sidechain
triggers on the transient (what you actually want to tune to). Arr→master
mapping is unchanged (shared with the timeline audio lane), so multi-pill /
long-form stays aligned. tsc clean; envelope + modulation tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(fx-ui): sidechain scope is a 1:1 lens over the timeline (no offset, no wobble)

The scope had its own playhead-centred window in master time; the timeline
draws in arrangement time over a different, paged window — so even with the
same audio source the peaks landed off, and centring on the (per-frame)
playhead made the waveform shimmer ("wabern") while playing.

Now the scope reconstructs the timeline's EXACT visible window from the
shared ui.zoom + ui.scrollX + totalArrDuration(segments) (liveTimelineRange
is always [0, arrTotal]), maps every column arr→master before sampling the
amplitude envelope, and draws PEAK-bucketed columns (max per column) instead
of point samples. Result: peaks line up 1:1 with the timeline audio lane,
the playhead sits at its true position, and the waveform is stable as the
window pages. Long-form / multi-pill stays correct because the arr→master
mapping and the segment set are exactly the timeline's. tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(fx): kill sidechain time-scaling drift + pin alignment with tests

Root cause of the drift (peaks further off the deeper into the track): the
amplitude envelope stored the REQUESTED fps (120) but hop is whole-sample
rounded (22050/120 = 183.75 → 184), so the true rate is 22050/184 = 119.84.
Sampling at index = t·120 read t·22080 instead of t·22050 — a 0.14% time
scale error = ~0.4s off at 5 minutes. Store the true rate (sampleRate/hop).

Hardening so it can't silently regress:
- export `sampleEnv` from modulation (single sampler for follower/render/scope).
- add `timelineVisibleWindow(arrTotal, zoom, scrollX)` to arrangement-time as
  the one source of the timeline's visible window; the scope uses it.
- tests: envelope time-axis accuracy at 22.05/44.1/48 kHz at 300s (would have
  caught the drift); scope window == timeline window across zoom/scroll;
  arr→master == the timeline's inline projection in every segment incl. a
  duplicate; and an end-to-end check that a transient lands in the same column
  in scope and timeline deep in a reordered long-form arrangement.

703 editor tests green, tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* polish(fx-ui): full-width sidechain scope + adaptive per-column peak

Per the alignment audit's cosmetic notes: drop the scope's horizontal inset
(PAD_X 4→0) so its time axis fills the width exactly like the timeline
canvas — pixel-for-pixel cross-panel x. And make per-column peak sub-sampling
adaptive (cover the env samples a column spans, capped) so peak HEIGHT isn't
under-shown when zoomed out. No time-axis change. tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0