Skip to content

Add waveform zoom in/out support#97

Open
handcraftedbits wants to merge 5 commits into
ServeurpersoCom:masterfrom
handcraftedbits:master
Open

Add waveform zoom in/out support#97
handcraftedbits wants to merge 5 commits into
ServeurpersoCom:masterfrom
handcraftedbits:master

Conversation

@handcraftedbits

@handcraftedbits handcraftedbits commented Jul 16, 2026

Copy link
Copy Markdown

Being able to precisely select portions of the waveform is difficult when the song is of any decent length. This PR adds support for a "rubber band" zoom selection by holding shift, left-clicking, and dragging (two finger touch on mobile). The waveform viewport will be zoomed and the user has the ability to zoom back out to the last zoom level or all the way out.

During zoom selection:
snap1

After zoom selection:
snap2

When zoomed, a scrollbar appears under the waveform that allows zooming left and right via scroll wheel or left/right keys.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added waveform zoom controls (zoom in/out and reset) with clear enabled/disabled states.
    • Enabled rubber-band zoom selection with improved touch and keyboard support.
    • Added interactive panning of the waveform (mouse wheel, arrow keys, and a new scrollbar for click/drag navigation).
    • Improved waveform rendering to reflect the currently selected view range.

ServeurpersoCom and others added 4 commits July 15, 2026 20:41
Bump ggml: cuda gains bf16 bin_bcast, metal gains f16 and bf16 bin
and unary ops. The snake fusion chain (mul, sin, sqr, mul, add) now
runs at f32, f16 and bf16 storage on CPU, CUDA and Metal, with f32
compute everywhere.

This is backend plumbing only: each project still needs one commit
to switch its vocoder activation dtype and benefit from the halved
bandwidth.
im2col now reads f16 data on CPU, CUDA, Vulkan and Metal, closing
the last f32 lock on convolution inputs. Vocoder activation chains
can hold f16 storage from one mul_mat output to the next across
snake, im2col and col2im. Plumbing only: each project still needs
its vae dtype switch to benefit.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd0d7be0-bafb-4b14-80ab-4d4d2e5534e6

📥 Commits

Reviewing files that changed from the base of the PR and between 2d79c68 and 19fa25a.

📒 Files selected for processing (1)
  • tools/webui/src/components/Waveform.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/webui/src/components/Waveform.svelte

📝 Walkthrough

Walkthrough

Changes

The waveform now supports zoomed visible ranges, range selection, panning, and scrollbar navigation. SongCard maintains zoom history and exposes zoom-out and reset controls.

Waveform zoom

Layer / File(s) Summary
Visible waveform window
tools/webui/src/components/Waveform.svelte
Adds visible-range props, display peak preparation, range-aware rendering, and mapped overlays.
Zoom and pan interactions
tools/webui/src/components/Waveform.svelte
Adds touch, pointer, keyboard, wheel, and scrollbar interactions for selecting and navigating waveform ranges.
SongCard zoom controls
tools/webui/src/components/SongCard.svelte
Stores zoom history, wires Waveform range updates, and adds zoom-out/reset controls and styling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SongCard
  participant Waveform
  User->>Waveform: Select or pan waveform range
  Waveform->>SongCard: Report zoom selection
  SongCard->>Waveform: Update visible range
  Waveform->>Waveform: Recompute display peaks and redraw
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding waveform zoom support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/webui/src/components/Waveform.svelte`:
- Around line 151-159: Eliminate duplicate synchronous peak scans during
waveform panning by ensuring each bound-state update triggers only one
computePeaksRange() path; remove direct updateDisplayPeaks()/draw() calls from
the keyboard, wheel, scrollbar, and related handlers where the reactive effect
already performs them. Throttle the remaining rendering or reuse precomputed
level-of-detail peaks so rapid pointer movement does not rescan the visible
audio interval repeatedly.
- Around line 141-164: Update the Waveform keyboard and scrollbar interaction
around onKeyDown/onKeyUp so arrow navigation is handled only by a focusable
waveform or scrollbar, not by global mouseOver state. Make the scrollbar
keyboard-focusable with appropriate scrollbar semantics, move key handling to
the focused element, and enlarge its 5px interaction target while preserving
existing navigation behavior. Apply the same focus and interaction-target
changes to the related scrollbar handlers.
- Around line 102-139: Replace the separate onTouchStart/onTouchMove/onTouchEnd
touch handlers with a single pointer-event state machine for two-finger zoom,
ensuring the initial finger cannot trigger seeking or mutate rangeStart/rangeEnd
before zoom begins. Update the canvas listener setup to use pointer events
consistently, and make pointer cancellation abort and clear the in-progress
selection without invoking onZoomSelect.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b983bdbc-83d7-4977-a944-51ca943e18a9

📥 Commits

Reviewing files that changed from the base of the PR and between 2ee9cce and 2d79c68.

📒 Files selected for processing (2)
  • tools/webui/src/components/SongCard.svelte
  • tools/webui/src/components/Waveform.svelte

Comment thread tools/webui/src/components/Waveform.svelte Outdated
Comment thread tools/webui/src/components/Waveform.svelte
Comment thread tools/webui/src/components/Waveform.svelte Outdated
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