Repository navigation
fix(editor): preview goes black after adding video/image to run 8000 ning editor - #2
Merged
Merged
Conversation
…ditor Two bugs combined to blank the live preview as soon as a user added a second clip via the "+ Media" flow. 1. updateClip rebuilt clips from ClipInit and dropped displayW/displayH. Editor.tsx fires updateClip on every existing cam during a job-update event, so adding a new clip wiped dims off ALL existing clips. resolveOutputDims then returned null and the descriptor went layer-less. 2. PreviewRuntime captured the cams URL map at construction time and never re-read the prop. A newly-added clip's URL never reached the pool, so its <video> couldn't mount and its bitmap couldn't load — cutting to it rendered nothing. Fix: preserve displayW/displayH in updateClip's merge, add setCams() to PreviewRuntime, and push cams-prop changes from Compositor on each render (with a ref to bridge the init() race). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
johannboehme
added a commit
that referenced
this pull request
May 3, 2026
Robust matching for noisy same-source recordings (clean direct take vs
mic-recording with room verb / codec artefacts). The previous pipeline
walked 1.1 s off the true offset on a 15-min beat-making session — even
though chroma had picked the right answer, multi-seed PHAT overrode it
because every seed produced uniformly mediocre PNR (~10) and a
marginally-stronger alternate won the tie. New pipeline drops the
error to ~5 ms (sub-perceptible) on the same case while staying
identical on clean tracks.
Stages, coarse → fine:
envelope (tier 0, NEW)
RMS-envelope cross-correlation at 10 Hz. Cheap, robust against
mic EQ / room verb / codec artefacts. Produces a coarse offset
that seeds the salient-anchor search corridor.
chroma + onset (tier 1, unchanged)
Existing pitch-class + spectral-flux fusion. Now works inside the
envelope-anchored search space.
PHAT refinement (tier 2, fixed)
Multi-seed alternate may now only override the chroma primary
when its PNR is ≥ 1.5× higher. The legitimate case this guards
(real-music bench house-loop: alt PNR ≈ 2e8 vs primary ≈ 50,
ratio 4 M:1) clears trivially. The failure mode it kills:
mic-noisy long-form material where every seed lands near PNR 10
and a 1.08× ratio walked the lag onto a self-similar bar shift.
salient-anchor consensus (tier 3, NEW — replaces uniform chunking)
Picks K spectrally-unique 8-s windows in the cleaner of the two
tracks (ref_is_cleaner via peak-to-RMS heuristic), runs sample-
level GCC-PHAT for each in a ±2 s corridor around the envelope
seed, bucket-votes the offsets. Salient anchors sit on events
that don't repeat elsewhere — by construction they can't fall on
a bar-shifted impostor. Falls back to uniform chunked when no
salient anchors are found.
drift correction (tier 4, unchanged)
DTW fallback (unchanged)
Kept for non-linear time-warping in long-tail setups (wireless
audio, asynchronous SRC, tape wow & flutter).
Per-stage progress:
WASM exposes syncAudioPcmWithProgress(ref, query, sr, callback).
Worker forwards each stage transition to the UI thread; jobs.ts
maps it onto the 40-55 % per-cam progress band so the bar moves
continuously through the ~5 s match instead of freezing at 40 %.
Existing syncAudioPcm() entrypoint preserved for backwards-compat.
Verification (16-min beat-making session, noisy mic vs clean master):
before: -3991 ms (1091 ms off truth)
fix #1: -2978 ms (78 ms off, PHAT margin alone)
fix #1+#2: -2947 ms (47 ms off, uniform consensus)
final: -2895 ms (4.4 ms off, salient anchors + envelope seed)
Pipeline runtime: 1.6 s native = ~590× realtime on 16 min.
All 40 unit tests pass; real-music bench identity / ±100ms /
±500ms / ±2000ms scenarios remain green on user-beatmaking
fixtures.
New supporting files:
src/envelope.rs — tier 0
src/salience.rs — novelty curve + anchor selection
src/consensus.rs — extended with salient_phat_consensus
examples/diagnose_match.rs — signal-level probe for sync failures
examples/time_pipeline.rs — bare timing harness
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateCliprebuilt clips fromClipInitand dropped thedisplayW/displayHreported by<video>metadata, so any job-update event blanked the bbox for every existing clip andresolveOutputDims()returnednull. Separately,PreviewRuntimecaptured the cams URL map at construction so a newly-added clip's URL never reached the pool / bitmap loader.updateClippreserves the dims in its merge,PreviewRuntimeexposes asetCams()setter, andCompositorpushes prop changes through (with acamsRefto bridge theinit()race).Test plan
updateClippreservingdisplayW/displayH(video + image), 2 forsetCamsplumbing video URLs and image bitmap fetches🤖 Generated with Claude Code