* fix(core): dedupe the wet/dry mix math between delayFeedback and chorusLfo Both effect builders set wet.gain to the mix and dry.gain to its complement in identical two-line blocks; fallow kept re-flagging it as a 10-line clone on every unrelated change. Extracted setWetDryMix. * fix(core): remove the build-audio-fx-runtime.ts stray resurrected by a main merge An earlier merge with main brought this deleted file back (git's merge/delete handling on an unchanged-on-one-side file); package.json already points at build-inline-artifact.ts, so it sat unreachable and duplicating that file's config, both of which fallow flagged. * fix(studio): pull TimelineLanes under the 600-line cap TimelineLanes.tsx hit 620 lines. Extracted the three per-clip pointer gestures (resize-start, pointer-down move-arm, click/razor-split) into createClipGestureHandlers — one factory call per rendered clip instead of ~120 lines of inline handler bodies in the render loop. 529 lines now. * fix(studio): split the extracted pointerdown handler under the CRAP threshold Moving the ~120-line gesture logic into timelineClipGestureHandlers.ts concentrated it into two functions fallow flagged (onPointerDown at CRAP 63.6, onResizeStart at 31.6). Split the decision logic (which gesture a pointerdown implies) into a pure resolvePointerDownAction, then split its own intent-blocking check into isIntentBlocked. onResizeStart's guard moved into canStartResize. Every function now scores under 30. * fix(studio): drop the unused DomEditSelection import in PropertyPanelFlat CI caught it on PR #3026 (wa-12-panel-params); a later refactor in the stack removed the last use of the type here without removing the import. * fix(studio): close the typecheck and fallow gaps wa-18b-reschedule opened useAutomationLanes.ts's write() assumed gesture-scoped coalescing and a preview-only commit that useDomEditAttributeCommits.ts never grew — backported that option support from its own later commit so the two sides of the API agree. The paste path and its tests were missing the box selection's v0/v1 bounds a sibling commit added to AutomationSelection. The FX panel's carve controls still edited the six mechanism numbers (maxCutDb, bands, intelligibilityBias) after carveProfile() collapsed authoring to one Strength knob, so those fields no longer existed on HfCarveSettings; UI now edits strength, and analyseCarveBands is called with carveProfile(strength). Also closes fallow's complexity, dead-code and duplication findings on this PR's diff: extracted automationLaneDragMath.ts (pure group/point-move math) and useAutomationRangeDrag.ts (the marquee-select gesture) out of useAutomationLaneGestures.ts, pulled a couple of render-loop ternaries and a resolver into named functions, dropped an export nothing outside its file used, and shared a step-simplifier between audioCarve's two envelope builders. The edge-stretch vs. box-select priority test in TimelineAutomationLane.test was still pinning the pre-box-select rule (edge wins over a point sitting on it) that a sibling commit deliberately reversed — a point inside the box is now selected content, so grabbing it drags the group instead. Updated the test to the shipped rule instead of the old one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(core): cap the via conic's weight so an edge-clamped via point can't NaN A via point pulled out past the segment (viaX: 5, viaY: -3) clamps to (0.999, 0.001) — exactly on the steady region's edge, where edge - viaX is 0. viaConic divided by that zero to get an infinite weight, and shapeVia turned Infinity into NaN a few steps later (Infinity - Infinity in the quadratic coefficient). NaN reaching setValueCurveAtTime silences the automated parameter for the rest of the render. Capped the weight at 1e6 instead of leaving it unbounded — past that point the arc already reads as touching the via point, so nothing visible is lost. Also hardened shapeVia's existing denominator guard (`<= 0`) to `!(> 0)`, since NaN fails the original comparison and fell through it. Review by Miga (PR #3208). * fix(studio-server): fingerprint the proactive waveform cache key too The route already keys the waveform cache on the asset's size and mtime as well as its path, so a rebuilt-in-place file gets fresh peaks instead of stale ones. generateWaveformCache — the proactive path that runs on upload — still called buildWaveformCacheKey with the path alone, so it wrote to a different key than the route reads from (making the pre-generated cache never found) and kept the exact collision bug this fingerprint exists to fix on its own path. Review by Miga (PR #3211). * style(docs): run oxfmt on the /hyperframes-audio skill docs Table column widths had drifted out of alignment with oxfmt's own rules, failing format:check and blocking the Preflight gate every downstream branch inherits. Whitespace only, no content change. * fix(core): stop \b from missing underscore-separated names, guard clipsOverlap's negative duration \b treats `_` as a word character, so \bbed\b never matched bed_01, music_bed_loop, or theme_song, and \bvo\b/\bvox\b/\btts\b had the same gap — an underscore-separated bed classified as "unknown" and could end up offered as its own carve source. Replaced the short hints with a boundary that actually excludes letters and digits on both sides. clipsOverlap computed end = start + duration without guarding sign, so a negative duration put end before start — an interval that does not describe anything, and one specific case showed it silently dropping a real overlap (a shorter, earlier broken end rejected a clip that genuinely contained the point). Duration clamps to zero instead: a clip cannot un-play time, and a zero-length clip at its start is the sane reading of "duration nobody wrote down as positive." Review by Miga (PR #3212). * fix(studio): widen PropertyPanel's resetModules render timeout again The 20s margin (already once widened for the same reason) is timing out in CI's full-monorepo Test run — the resetModules()+fresh-import render this test needs is uncached and competes with every other package's test suite for the same worker pool, and the same test passes in well under 2s standalone. Went to 45s rather than re-tuning to whatever number happens to clear the current CI load, since that number moves every time CI gains a package. * fix(studio): stop the single-candidate auto-apply carve firing twice Two auto-apply effects both fire when sourceOptions.length === 1: the multi-candidate effect only guards length === 0, so a single candidate passes it too, and the single-candidate effect passes its own guard right after — both compute the same sources list and both call setCarve, so the common case (one narrator, one bed) triggered two decodes, two FFT runs, and two concurrent attribute writes for one decision. The multi-candidate effect now defers to its sibling for exactly one candidate, which already has its own detailed handling for that case. Review by Miga (PR #3213). * feat(core): carve against every voice over a bed, always (#3212) * feat(core): carve against every voice over a bed, always dynamically A bed usually runs under a whole sequence — a narrator, an interview answer, a second presenter — and carving against one of them left the others fighting it. `source` becomes `sources`, and `mixCarveSources` sums every voice onto the BED's clock before anything is measured. That is what keeps one analysis sufficient: the chain is fixed, so there is no per-voice filter to switch between, and bands drawn from all the speech there is with envelopes that rise wherever any of it happens answer the actual question — where and when is speech masking this bed. Summed rather than averaged: two people talking at once mask more than either alone. Audio before the bed starts is dropped rather than folded in at zero, since it plays over nothing and shifting it would put a cut where there is no voice. `dynamic` is gone. A fixed depth thins the bed through every pause, and once both have been heard there is no reason to want it, so every carve follows the speech. Two helpers the panel and the headless script now share instead of each carrying a copy — two definitions of "what does this name suggest" drift, and then the two disagree about which track is the voice: - `classifyAudioName` reads a track's kind from its id and filename together. `unknown` is deliberately common: treating an unrecognised name as "not a voice" would hide the one track somebody needs to pick. - `clipsOverlap` keeps out a voice that never plays while the bed does. An unwritten duration counts as unbounded, not zero — refusing a clip whose length the composition leaves to the media would drop the commonest case there is. Files written before this still load: a single `source` reads as a one-voice list, a stored `dynamic` is ignored, and an absent attribute means the defaults whole. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(core): stop \b from missing underscore-separated names, guard clipsOverlap's negative duration \b treats `_` as a word character, so \bbed\b never matched bed_01, music_bed_loop, or theme_song, and \bvo\b/\bvox\b/\btts\b had the same gap — an underscore-separated bed classified as "unknown" and could end up offered as its own carve source. Replaced the short hints with a boundary that actually excludes letters and digits on both sides. clipsOverlap computed end = start + duration without guarding sign, so a negative duration put end before start — an interval that does not describe anything, and one specific case showed it silently dropping a real overlap (a shorter, earlier broken end rejected a clip that genuinely contained the point). Duration clamps to zero instead: a clip cannot un-play time, and a zero-length clip at its start is the sane reading of "duration nobody wrote down as positive." Review by Miga (PR #3212). --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(studio): port the carve UI off the removed source/dynamic fields #3212 (accidentally squash-merged into this branch instead of main) changed HfCarveSettings from a single `source` + `dynamic` toggle to a `sources` list with dynamic mode removed outright — the multi-voice UI consumer that goes with that shape lands in the very next PR, so this branch was left with a type that no longer matched its own code. Minimal port, not the multi-voice redesign that PR does properly: the "Listen to" picker and analyse() treat sources[0] as the one voice this UI still understands, and every dynamic-mode branch (the automated envelope lanes, the toggle, the checkbox) is gone along with the field — a carve is now always the static value the analysis computes, matching what the type change made permanent. Test suite trimmed the same way: the automation-lane and toggle tests covered behavior that no longer exists. * docs(plans): fix pre-existing oxfmt formatting drift Blocks the regression workflow's required preflight gate. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
8.4 KiB
Automation lane time selection — design
2026-08-05 · builds on stack #3027 (wa-1 … wa-14) · status: approved, awaiting implementation plan
Context
Audio automation lanes (breakpoint envelopes over data-automation) ship point-level
editing: add, drag, curve, snap, type a value, delete one point. Everything range-shaped —
"fade the music here", "duck this under the voiceover", "reuse that swell" — still means
placing points one at a time. Ableton's envelope editor solves this with a time selection;
this design ports the useful subset for video authors. Explicitly not a DAW: no musical
LFO features, no automation recording, no unlinked/looped envelopes.
Goals
- Select a time range on one lane by dragging its background.
- Delete the points in a range without disturbing the envelope outside it.
- Insert simple shapes (ramp up, ramp down, swell, dip) into a range in one action.
- Copy a range and paste it elsewhere — other time, other lane, other parameter.
- Retime a range by dragging its edges.
- Thin dense point runs (Simplify).
Non-goals
- Multi-lane or multi-clip selection. One selection, one lane.
- Vertical scaling and skew of a selection.
- Draw mode, automation recording, ADSR/waveform shapes (saw, square).
- Persisting the selection. It is view state, never serialized.
Model
New store slice automationSelectionSlice.ts (own file — playerStore.ts sits at the
600-line ceiling; keyframeSlice.ts is the precedent):
interface AutomationSelection {
elementKey: string; // which clip
target: string; // which lane ("volume" | "fx.<nodeId>.<param>")
t0: number; // clip-local seconds
t1: number; // > t0
}
// automationSelection: AutomationSelection | null
// setAutomationSelection(sel), clearAutomationSelection()
Why a slice and not lane-local state: Delete/Cmd+C/V handlers and the shape context menu
live outside the lane component and need to read the active selection —
useKeyframeKeyboard already solved this exact problem by going through the store.
Lifecycle: cleared on Escape, on a sub-threshold click in any lane, and automatically when
the element or target it names stops resolving (clip deleted, effect removed). The lane
receives it through bind() in useAutomationLanes like every other prop.
Gesture
A plain drag on the lane background range-selects. This surface is free: today a pointerdown that misses every point and has no Alt falls through and does nothing.
- Pointerdown (no point hit, no Alt): arm at
t, capture the pointer. - Move past ~3 px horizontally: live-update the selection (
t0/t1ordered, clamped to[0, duration]). Endpoints snap to the same beat-grid + neighbour-point targets a point drag uses; Alt bypasses, matching the point-drag convention. - Pointerup under the threshold: clear the selection (it was a click, not a drag).
Renders as a translucent accent rect behind the envelope path with faint vertical edges.
Existing gestures unchanged: point hits win over range-drag; Alt on the line still curves.
Implemented as a third gesture kind in useAutomationLaneGestures beside point-drag and
curve-drag.
Range ops
Pure module automationLaneSelection.ts (studio, not core — the render never needs any of
this; core keeps only the envelope model it already has):
pointsIn(lane, t0, t1): HfAutomationPoint[]
replaceRange(lane, range, t0, t1, inner: HfAutomationPoint[]): HfAutomationLane
replaceRange is the only mutator, and carries THE invariant: the envelope outside the
selection never moves. It samples the lane at t0 and t1 first (sampleAutomationLane,
log-aware) and pins anchor points at both edges, drops the old interior, inserts inner,
sorts, and runs the existing normalize path (dedupe, MAX_AUTOMATION_POINTS 512 cap).
Every feature below composes it, and every write flows through the lane's existing
commitPoints preview/persist split — undo, drafts, and the quiet-commit path are
inherited, not rebuilt.
Features
Delete range (wa-15)
replaceRange(..., []) on Delete/Backspace via a new useAutomationSelectionKeyboard
hook (sibling of useKeyframeKeyboard), inert while the value input or any text field has
focus. Escape clears the selection.
Shapes (wa-16)
Right-click the selection rect → context menu: Ramp up · Ramp down · Swell · Dip, plus
Simplify. Pure generators in automationShapes.ts, one shape scaled to the selection,
values computed in unit space so log knobs behave:
| Shape | Points | Semantics |
|---|---|---|
| Ramp up | 2 | range.min at t0 → envelope's own value at t1 (fade in) |
| Ramp down | 2 | envelope's own value at t0 → range.min at t1 (fade out) |
| Swell | 3 | edge values, peak at range.max at the midpoint, curve-smoothed |
| Dip | 3 | edge values, midpoint at 25 % of the edge value in unit space (duck), smoothed |
Point counts are tiny; the 512 cap is never approached.
Copy/paste (wa-17)
Module-level clipboard { sourceRange: AutomationRange, span: number, points }, times
rebased to t0. Not the OS clipboard — points aren't text, and useClipboard is already
the DOM-element channel.
- Cmd+C: copy
pointsInthe active selection. - Cmd+V: paste at the active selection's start when one exists, else at the playhead's
clip-local position, onto the selected clip's active lane. Inserted via
replaceRangeover the pasted span. - Cross-parameter values map through unit space:
toUnit(sourceRange, v)→fromUnit(targetRange, u)— a volume duck pasted onto a log-scaledwetlands sanely. - Registered in
useAppHotkeysand active only while an automation selection exists (copy) or clipboard content exists with an audio clip selected (paste), so clip-level copy/paste is never shadowed.
Stretch (wa-18)
8 px grab zones just inside the selection's left/right edges (points win hits over
handles). Dragging an edge retimes interior points proportionally:
t' = t0' + (t − t0) · span'/span, then replaceRange over the union of old and new
spans. One more gesture kind in the hook. Vertical scaling deliberately cut.
Simplify (wa-16, shares the menu)
Ramer–Douglas–Peucker in unit space over the selection, ε ≈ 2 % of lane height. Exists for carve output and dense hand edits.
Testing
replaceRange: assertsampleAutomationLaneoutside the range is identical before and after every op — the invariant, tested directly. Anchor pinning, cap, dedupe.- Generators: point counts, unit-space values on a log lane, edge continuity.
- RDP: dense sine in → few points out, max deviation < ε.
- Clipboard mapping: volume → wet round-trip on a log range.
- Gestures: existing harness (synthetic pointers, stubbed box, assert
onPreview/onCommitpayloads). New: drag selects; sub-threshold click clears; Escape clears; Delete empties the range and pins anchors; edge drag retimes; menu insert writes a swell. - Keyboard hook inert while a text input has focus.
- Nothing below the attribute changes → no engine/render tests.
PR breakdown
Stacked on wa-14 (stack #3027), each under the 1000-LOC convention:
| PR | Content | ~LOC |
|---|---|---|
| wa-15 | slice, drag gesture, rect render, replaceRange/pointsIn, Delete/Esc |
400 |
| wa-16 | shape generators, selection context menu (ramp/swell/dip), Simplify | 380 |
| wa-17 | clipboard, Cmd+C/V in useAppHotkeys, unit-space mapping |
300 |
| wa-18 | edge-handle stretch gesture | 250 |
wa-16/17/18 are independent once wa-15 lands. File-size note: useAutomationLaneGestures
grows in wa-15 and wa-18 (310 lines today — headroom exists); the menu is a new file.
Decisions log
- One cycle per shape, scaled to the selection (per-beat cycles rejected: not a music tool).
- Shape set is the utility four (ramp up/down, swell, dip); saw/square/ADSR rejected.
- Paste anchor: selection start when active, else playhead.
- Selection state in a store slice (approach A); component-local and DomEditContext rejected.
- Internal clipboard, not OS clipboard.
- All range math pure, in studio; core untouched.
- Vertical scale and skew cut from stretch.