Skip to content

fix(audio): eleven small correctness fixes across engine, core and the panel - #3173

Merged
vanceingalls merged 456 commits into
mainfrom
wa-19a-audio-fixes
Aug 13, 2026
Merged

fix(audio): eleven small correctness fixes across engine, core and the panel#3173
vanceingalls merged 456 commits into
mainfrom
wa-19a-audio-fixes

Conversation

@vanceingalls

Copy link
Copy Markdown
Collaborator

First of four slices of the old #3156, cut to stay under 1000 lines.

Small, independent fixes with no audible change:

  • an empty audio track is handed back instead of failing the mix
  • the browser lease is taken inside the try that releases it
  • the phaser's trim lanes aim at the trims, not the pinned wet/dry pair — an envelope was modulating a constant while the trim it was meant to move stayed frozen
  • a node's id moves with its slot on an in-place chain update, so a lane cannot end up addressing its neighbour
  • the volume lane is sampled at clip-local time, the way the render does it
  • an FX parameter can be typed, and a bare blur no longer re-persists
  • a clip's FX graph is disposed when it ends, not only when the element goes
  • the rack locks while the carve measures

Each commit body carries its falsification note — the test was broken on purpose and confirmed to fail.

🤖 Generated with Claude Code

@miga-heygen miga-heygen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: fix(audio): eleven small correctness fixes — #3173

Verdict: LGTM

Eleven fixes, each independently falsified — the commit notes prove each test broke when the old behavior was restored. Highlights:

The signal routing fix is the biggest silent one. effectiveSignal now correctly propagates to downloadToTemp, the video extract, and the trim. The old code passed the caller's signal to all three, so internalController.abort() cancelled nothing — and the rmSync(workDir) on the next line ran while their ffmpeg children were still writing into it. This is a genuine race that could corrupt renders under cancellation.

Browser lease ordering — moving acquireBrowser inside the try that releases it is correct. A mkdtempSync failure between the old acquire and the try leaked a pooled browser, and a pool with no leases left hangs every subsequent render.

Phaser trim targets — asserting by VALUE rather than node identity is the right call. The trims are internal; the honest question is whether the param the lane drives is the one the knob sets. Clean.

FxParamRow typing fix — the typing state as TEXT (not number) is exactly right: a half-typed "-" or "" is a valid intermediate state, not a value to clamp. The edited ref preventing no-op commits is a nice touch — prevents a full source-patch/selection-resync/preview-reload/audio-restart cycle for a gesture that moved nothing.

Lint rule regex[^;)] instead of [^;] to stop the match from crossing ) into a later .to() call in a chained timeline. The false-negative direction (missing a case where a call result contains )) is the safe one for a rule that guesses.

No issues found.


Review by Miga

🤖 Generated with Claude Code

vanceingalls and others added 24 commits August 13, 2026 00:49
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 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>
#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.
# Conflicts:
#	packages/studio/src/components/editor/propertyPanelAudioFxGroup.test.tsx
#	packages/studio/src/components/editor/propertyPanelAudioFxGroup.tsx
#	packages/studio/src/components/editor/propertyPanelFxSection.tsx
# Conflicts:
#	packages/studio/src/components/editor/propertyPanelAudioFxGroup.test.tsx
#	packages/studio/src/components/editor/propertyPanelAudioFxGroup.tsx
#	packages/studio/src/components/editor/propertyPanelFxSection.tsx
#	skills-manifest.json
#	skills/hyperframes-audio/SKILL.md
#	skills/hyperframes-audio/references/attributes.md
#	skills/hyperframes-audio/scripts/carve.mjs
Base automatically changed from wa-18i-row-fixes to main August 13, 2026 10:16
@vanceingalls
vanceingalls merged commit 95751d6 into main Aug 13, 2026
57 of 58 checks passed
@vanceingalls
vanceingalls deleted the wa-19a-audio-fixes branch August 13, 2026 10:48
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.

2 participants