Skip to content

Show a sound's matched moment on the Sound picker's waveform - #32

Merged
davior merged 1 commit into
mainfrom
claude/sweet-newton-gqcfag
Oct 29, 2026
Merged

davior merged 1 commit into
mainfrom
claude/sweet-newton-gqcfag

Conversation

@davior

@davior davior commented Oct 29, 2026

Copy link
Copy Markdown
Owner

What

A follow-up to #31. In the Sound picker, when a hit has a moment, the waveform preview now marks it.

Which hits have a moment:

  • the spoken line a search matched (start_time/end_time, sized by the existing momentTrim);
  • otherwise a GAM clip's own in_point/out_point, which line up with the waveform because a clip plays its parent's file.

What changes for such a hit:

  • Everything outside the moment is dimmed, and the moment itself is tinted.
  • The player opens at the moment's start.
  • The readout says which stretch it is: 2:00 long · matched at 0:11–0:18, or … · clip of 0:10–0:25.

This is display only: "Use this track" still uses the whole file.

How

  • WaveformPlayer takes an optional moment.
    • The shading sits at z-10 over wavesurfer's own layers, which stack at z-index 2 and 5. This is the same fix GAM's clip window needed.
    • The tint behind the bars is there because, in dark mode, dimmed gray bars and plain ones looked almost the same.
  • The seek happens on loadedmetadata, because a seek made before the browser knows the duration is silently ignored.
  • The picker keys the player on the moment, so two hits on one file each reopen at their own moment, as the video preview already does with trim.

Testing

  • npm test: 204 passed. The new tests cover:
    • the shade widths and the opening seek;
    • no shading without a moment;
    • the picker showing a matched line, a GAM clip's window, and nothing for a name-only hit.
  • lint, Prettier and build are clean.
  • Driven in Chromium against GAM on :8001 and GVC on :8002/:5175. Picking "Clip of varied (0:10–0:25)":
    • the shading covers 0–25% and 62.5–100% of the waveform;
    • the player opens at 10 s;
    • the readout says 0:15 long · clip of 0:10–0:25;
    • it is legible in light and dark.

Generated by Claude Code

When a search hit matched a spoken line, or the hit is a GAM clip, the
picker's waveform now dims everything outside that stretch, tints the
stretch itself, and opens the player at its start. The readout line says
which stretch it is ("matched at 0:11–0:18", or "clip of 0:10–0:25" for a
clip). This is display only: a track is still used whole.

The seek waits for loadedmetadata, because a seek before the browser
knows the duration is silently ignored. The player is keyed on the
moment, so two hits on one file each reopen at their own moment, as the
video preview already does. The tint is needed in dark mode, where dimmed
gray bars and plain ones look almost the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD3VLg4aqTvHVuRLA53
@davior
davior marked this pull request as ready for review October 29, 2026 02:14
@davior
davior merged commit 52dfa64 into main Oct 29, 2026
3 checks passed
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