8000 Surface real upload + render progress with stage detail and ETA by johannboehme · Pull Request #1 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

Surface real upload + render progress with stage detail and ETA - #1

< 8000 span class="titleSuffix__ZhvAF5">
Merged
johannboehme merged 1 commit into
mainfrom
claude/elastic-darwin-4d3ca2
Apr 26, 2026
Merged

johannboehme merged 1 commit into
mainfrom
claude/elastic-darwin-4d3ca2

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Summary

  • Upload: real progress bar with bytes, throughput and ETA via XHR (replaces the silent "Uploading…" button).
  • Render: ffmpeg -progress pipe:1 parsing makes the bar move smoothly during multi-minute renders + emits ETA.
  • All stages: free-form progress_detail substep label is plumbed Job → SSE → UI ("Encoding output mp4", "Cross-correlating chroma features", …).
  • JobPage: shows substep detail, live elapsed, ETA when available.
  • History: inline mini progress bar + auto-refresh every 3 s for in-flight jobs.
  • New progress_detail / progress_eta_s columns; lightweight idempotent SQLite migration in init_db so existing prod DBs keep working.
  • Reusable <ProgressBar> + formatBytes / formatDuration helpers.

Test plan

  • pytest — 54 passed (was 49); +2 ffmpeg-progress, +3 detail/eta plumbing
  • cd frontend && npm test — 48 passed (was 38); +5 XHR/api, +3 Upload UI, +3 JobPage, +1 History
  • tsc --noEmit clean
  • Smoke-check after deploy: upload a file → progress bar moves; job page shows substage detail + ETA during render; history shows live %.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 472dd5a into main Apr 26, 2026
2 checks passed
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>
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