Files
Vance IngallsandClaude Sonnet 5 7d0d74dcae feat(core): the audio FX preset catalogue, and applying one from the rack (#3177)
* 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 in audio-fx-ux README

Blocks the regression workflow's required preflight gate.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 06:33:35 -07:00
..

The casual author's view of the FX rack

The schematic direction won because it adds information — signal order, routing, what is driven versus set. But information a casual author cannot read is decoration, and the rack speaks entirely in Hz, dB and ratios. So the drawing stays and the language changes.

copy.mts is the design work: a plain-language layer over every effect in the registry. build-preview.mts renders the review page from it plus the real registry and preset catalogue, and fails if any effect, parameter or preset lacks copy — so the page cannot quietly omit something that ships.

bun plans/audio-fx-ux/build-preview.mts /tmp/rack-ux.html

The three rules

  1. Two faces. Every module opens plain: a name that says the outcome, one line about what it is for, and one control. The real parameters are one click away and never in the way. Nothing is hidden — it is ordered.
  2. One knob that matters. A compressor has seven controls and an author wants one. Multi-knob modules get a single derived control, exactly as carveProfile(strength) already turns one number into six.
  3. Name the outcome, not the mechanism. "Remove Rumble", not "High-pass". The DSP name stays in the corner of the module, so the vocabulary is taught rather than withheld — an author who learns "high-pass" here can carry it to any other tool.

The shared vocabulary

Frequencies mean nothing to somebody who has not been taught them. BANDS names the ranges in the words the same person would use unprompted — rumble, weight, mud, middle, presence, edge, air — and every filter shows where it acts on that one ruler. Naming them once makes the whole rack legible.

What laying it all out exposed

A preset can use the same module twice for different jobs. "Clean Voice" runs Shape One Range at node 02 (cutting mud at 250 Hz) and again at node 04 (adding clarity at 3 kHz). Read down the rack, an author sees the same words twice and cannot tell them apart.

So one plain name per effect is not enough: a preset's node needs its own role label — "Reduce Mud", "Add Clarity" — which means copy belongs on the preset node as well as on the effect. This is invisible in a catalogue of cards and obvious the moment every preset is drawn as the chain it actually builds.

Family lettering, carried over from the first round

The identity device from the first rack pass — different type per family — was lost when the direction moved to schematic, which lettered everything in the same condensed caps. It is back, inside the schematic skeleton rather than instead of it. You can tell what KIND of module you are looking at with the label out of focus, before the word registers.

Family Treatment Why
Filter condensed caps, wide tracking, light measuring instruments
Dynamics condensed caps, tight, heavy grips the signal
Nonlinear italic serif the only generative family — it should not look like the others
Time condensed caps, very wide, thin atmosphere, not control
Smart monospace, medium it measures; it reads as a readout

Two faces, as budgeted. The condensed sans carries four families apart by weight, case, tracking and size; the serif is spent on the single family that behaves differently from the rest.

Alongside it, a tint step per module inside its family — derived from position in the registry, so adding an effect never re-colours its siblings by hand. Two filters are visibly different modules without reading as two different families.

The Broadcast preset is the test case: seven nodes across three families in one rack, and each one is identifiable before it is read.

The collapsed state is a sentence

Collapsed is the most-seen state by a distance: a rack of six modules is six collapsed lines and nothing else. So SUMMARY writes each one as a phrase about what is happening to the sound — "Cutting everything below 80 Hz", "Evening out — moderate", "A medium room, lightly" — rather than the parameter that happens to be first. Numbers stay in, because they are what makes it checkable, but they arrive inside a sentence. An author should be able to read their own mix top to bottom.

Rendering all fifteen at their defaults immediately caught one: a freshly added Peaking EQ sits at 0 dB, and "Lifting 1 kHz by 0 dB" describes a non-event as though it were a setting — while being the FIRST thing an author reads after adding one. It now says "Sitting on 1 kHz, doing nothing yet".

Trap: do not use String.raw here

Bun escapes every non-ASCII character in a raw template literal into literal \uXXXX text, so em-dashes, curly quotes and any glyph in a CSS content property print as their escape sequence on the page. This cost three rounds of chasing what looked like three unrelated rendering bugs. The template is a plain literal; keep it that way, and use HTML entities for typographic characters.

The hole in the single-knob rule: picking the range

Shape One Range has three controls — where, how much, how wide — and the copy nominated how much as the one that matters. That is incoherent, and it took someone asking to see it: boosting an unspecified frequency means nothing. The range is the first decision, not the second.

Two ways out:

A — two controls. Keep the module generic and make where a word from the shared vocabulary rather than a frequency field. Honest, and the ruler does the teaching, but it is still two decisions and the first is jargon in a friendly coat.

B — the range IS the module. The add menu offers jobs — Reduce Mud, Add Clarity, Tame Harshness — each a peaking node with its frequency already chosen. Picking the module is picking the range, so one knob is honest rather than a simplification hiding the real choice.

B is the answer, and it is the same insight as the EQ: an author does not want a parametric equaliser, they want to fix a thing. It also dissolves the duplicate-name problem at the root rather than papering it with a role label — Clean Voice reads Remove Rumble · Reduce Mud · Even Out Loudness · Add Clarity · Peak Ceiling, and nothing repeats.

Option A is not wasted: its band picker is exactly the right control for moving the frequency under Details, for the author who wants to.

This changes the catalogue, not just the copy: the presets should reference named jobs, and EFFECT_COPY.peaking stops being one entry.

Proposed: a multi-band EQ ("Tone")

The clearest failure this exercise surfaced is a rack holding two Shape One Range modules doing different jobs. A multi-band EQ is the answer, and it is a better one than a role label because an author already understands it: bass, middle, treble is the most widely used audio control there is.

Its bands can be the shared vocabulary. Three bands are Bass / Middle / Treble; five open up to Bass / Warmth / Middle / Clarity / Air. So using the EQ teaches the words the rest of the rack relies on, instead of the vocabulary living only on a ruler somebody has to read.

Built like the carve, not like a new effect. Carve already owns several tagged nodes and presents as one module (fromCarve, filtered out of the hand-built list). An EQ does the same with fromEq: three bands are a low shelf, a peaking and a high shelf — all effects that already ship. Nothing new in the render, nothing new in the graph, and the nodes stay ordinary, so an author who opens the details finds exactly the filters they could have added by hand.

The registry's parameter model is flat key/value, so an eq effect type with N bands would need array-shaped params it does not support. The composite-module route avoids that entirely and is the pattern this codebase already proved.

Faders rather than sliders, because a row of vertical faders around a centre detent is what an equaliser looks like to everyone who has met one. Collapsed, it reads like every other module: "Bass +3, Middle 2, Treble +2", or "Flat" when nothing has been touched.

What still needs deciding

  • Does the plain name replace the DSP name or sit beside it? Replacing is friendlier but strands what the author learns.
  • Should the menus be organised by complaint ("my voice sounds boomy") rather than by effect family? The rack itself must stay in signal order, because order is audible — but the menus have no such constraint, and the preset section of the preview is written that way to show the difference.
  • How much should hover audition? Hearing a preset before committing is the single strongest affordance here. Cheap for static presets; a measuring script has to analyse first and cannot preview instantly.

Status

copy.mts is a proposal, not shipped code. When it lands it wants to be packages/core/src/audioFxCopy.ts beside the registry, with the completeness check as a test rather than a build step.

The PROFILES figures — what one knob derives at gentle/middle/strong — are proposed values, not measured ones. They want the same before/after listen the clip-before-duck fix got.