Skip to content

feat(gui): add a visualizer screen with the TUI styles - #965

Merged
LargeModGames merged 22 commits into
mainfrom
feat/gui-visualizer-screen
Nov 1, 2026
Merged

LargeModGames merged 22 commits into
mainfrom
feat/gui-visualizer-screen

Conversation

@LargeModGames

@LargeModGames LargeModGames commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

The GUI gets a Visualizer page with all nine TUI visualizer styles: Cava, Bar Graph, Head Unit, Analog VU, Winamp, Phosphor Scope, Outrun, Rack EQ and Cassette Deck. The player bar visualizer is unchanged.

  • Key 7 or the new top bar button opens the page. A dropdown, the Next style button or V (as in the TUI) picks the style. The choice stays in the page's local storage; the TUI's behavior.visualizer_style is not touched.
  • Each style is drawn on a canvas with the TUI's colours, text and motion (needle ballistics, peak holds, phosphor trails, the Outrun grid, the cassette reels, the Head Unit perspective and level meter).
  • Rust side: the page asks with ClientMessage::VisualizerScreen { bars } (null when it hides) and gets ServerMessage::VisualizerScreen frames with cava's mirrored stereo bands and the 50 ms wave, on a second watch channel in the bridge. The player bar's Feed serves both consumers with one capture lifecycle, so the linger, stall and retry rules are shared and the bar's own frames stay the same.
  • AudioAnalyzer::set_bars now rebuilds only the cava plan. The capture ring and its frame count survive a band-count change, so the bar no longer sees an empty ring when the screen resizes. SpectrumData carries that frame count.
  • VisualizerStyle gets a generated TS binding, and the page's style table is typed by it, so a style added in Rust fails the page's type check.
  • Like the player bar, the screen only shows sound while spotatui plays on this computer, and only where the build can capture (Windows loopback, Linux PipeWire). Elsewhere the page says that no audio capture is available.

Testing

$ cargo fmt --all -- --check
(no output: formatted)
$ cargo clippy --no-default-features --features telemetry,tui -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.48s
$ cargo clippy --no-default-features --features telemetry -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.37s
$ cargo clippy --no-default-features --features telemetry,streaming -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.56s
$ cargo clippy --no-default-features --features telemetry,gui,streaming,discord-rpc,self-update,scripting,mcp-server,mpris,local-files,subsonic,internet-radio,youtube,qobuz,audio-viz,audio-viz-cpal -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.42s
$ cargo clippy -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.63s
$ cargo test --no-default-features --features telemetry,tui
test result: ok. 1844 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.62s
$ cargo test
test result: ok. 2352 passed; 0 failed; 8 ignored; 0 measured; 0 filtered out; finished in 3.61s
$ cargo test --no-default-features --features telemetry,gui,streaming,discord-rpc,self-update,scripting,mcp-server,mpris,local-files,subsonic,internet-radio,youtube,qobuz,audio-viz,audio-viz-cpal
test infra::local::tests::uri_round_trip ... FAILED
test result: FAILED. 2236 passed; 1 failed; 30 ignored; 0 measured; 0 filtered out; finished in 5.14s
$ cargo clippy --manifest-path desktop/Cargo.toml -- -D warnings
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 11.37s
$ cargo test --manifest-path desktop/Cargo.toml
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

$ npm run lint
$ npm run format:check
All matched files use Prettier code style!
$ npm run typecheck
$ npm test
 Test Files  64 passed (64)
      Tests  574 passed (574)
$ npm run build
✓ built in 183ms
$ npx playwright test
  1) [webkit] › e2e\focus.shot.ts:70:1 › a sidebar click keeps focus on the control until the list lands, then hands the keyboard to it
  1 failed
  209 passed (48.6s)

I ran these on Windows. uri_round_trip uses a Unix path and fails on Windows on main too; the WebKit focus.shot.ts:70 test also fails on main. The new visualizer screen <Style> scenes and the V cycle scene pass in Chromium, Firefox and WebKit, and their PNGs are in the gui-shots artifact.

Additional notes

  • I did not build the Linux PipeWire path or the macOS job locally; CI covers both.
  • The three new GUI strings are English only. The Chinese tables fall back to English through ..EN; the Next style tooltip reuses the already translated visualizer_style_hint.
  • The Spotify pitch view (the TUI's tenth view) is not on the screen.

💬 Questions or want to chat with other contributors? Join the spotatui Discord.

Summary by CodeRabbit

  • New Features
    • Added a dedicated visualizer screen with nine selectable styles, including retro-inspired displays and spectrum visualizations.
    • Switch styles with the V key or the on-screen control; open the screen using the 7 key or page navigation.
    • View live audio visualizations alongside current track information. When audio capture is unavailable, the screen displays a status message.

A new cava plan reset the ring and the frame count that the GUI player
bar reads, so the bar blinked when another reader changed the count.
A page that shows the screen asks for frames at its band count. The
player bar's feed shares its capture, linger and stall rules with the
screen, and the bar's own frames do not change.
Band counts, channel and level helpers, peaks, and the physics of each
style, ported from the TUI.
Cava, Bar Graph, Head Unit, Analog VU, Winamp, Phosphor Scope, Outrun,
Rack EQ and Cassette Deck on a canvas, with the TUI's colours and text.
Key 7 and a top-bar button open it. The style choice stays in the page;
V cycles it as in the TUI.
The capture ring is not part of the plan, so set_bars no longer takes it
out and puts it back. A spectrum frame now carries the capture's frame
count.
The screen reads its frame and the audio count under one lock, both
feeds use one clock and one silence rule, and the analyzer alone clamps
the band count.
clock, mix, rgba, shownAt and Frame replace their copies; duplicate and
test-only code goes. Frames decode once, and the painters measure text
and stroke paths less often.
The screen asks with an optional band count, null when it hides, and
VisualizerStyle gets a generated binding. The e2e stub narrows the ask
instead of casting it.
…step

Both frame paths mark new audio through one helper, and the docs name
the screen next to the bar.
LED, strip and meter colours are built once, long paths glow with a
double stroke instead of shadowBlur, and polyline builds no point
tuples. The page reuses pageStorage, LONGEST_STEP and the list-sort
controls, and its style list follows the generated binding.
The page watches once and sends a new band count on its own, so a resize
or a style switch no longer drops the watch. One table names the styles
in cycle order, LED and segment colours come from one helper, and the
scanlines, needle shadow and rack labels cost less per frame.
fitBands returns zeros for an empty frame, so the painters read the
bands directly and Scene.bars goes. The Next style tooltip reuses the
translated hint, and a few constants and lookups move out of the loops.
The watched flag and the band count travel as one Option, and the two
bridge visualizer tests share their socket setup and frame collection.
sceneAudio sizes the bands and flattens a silent wave once, so the
painters read scene.audio directly. Settled silence reuses one cached
zero array instead of allocating each frame.
Settled silence keeps its own array again, so fitBands needs no module
state. scopeReadout and a screen test lose checks that can no longer
fail.
barCount asks cava for twice each painter's band count, so the painters
read the fitted bands without a second resample, and fitBands lets
resample handle an empty frame.
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 7b534e7 and 8242d8f.

Files ignored due to path filters: 6
  • gui/src/bindings/ClientMessage.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/GuiStrings.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/ScreenFrame.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/ServerMessage.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/VisualizerStyle.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/strings.json is excluded by !gui/src/bindings/**
Files selected for processing: 32
  • gui/e2e/bridge.ts
  • gui/e2e/fixtures.ts
  • gui/e2e/scenes.shot.ts
  • gui/src/App.tsx
  • gui/src/Icon.tsx
  • gui/src/Shell.tsx
  • gui/src/TopBar.tsx
  • gui/src/VisualizerScreen.css
  • gui/src/VisualizerScreen.tsx
  • gui/src/areas.test.ts
  • gui/src/areas.ts
  • gui/src/connection.ts
  • gui/src/i18n.ts
  • gui/src/nav.test.ts
  • gui/src/nav.ts
  • gui/src/screenDraw.ts
  • gui/src/screenModel.test.ts
  • gui/src/screenModel.ts
  • gui/src/screenPaint.test.ts
  • gui/src/screenPaint.ts
  • gui/src/screenRetro.ts
  • gui/src/visualizerModel.ts
  • gui/src/visualizerScreen.test.tsx
  • src/core/driver/mod.rs
  • src/core/i18n/gui.rs
  • src/core/i18n/gui/en.rs
  • src/core/user_config.rs
  • src/gui/bridge.rs
  • src/gui/protocol.rs
  • src/gui/visualizer.rs
  • src/infra/audio/analyzer.rs
  • src/runtime/gui.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

The pull request adds a GUI visualizer page with selectable styles, a screen-specific audio-frame protocol and capture stream, and canvas renderers. It also adds navigation, localization strings, and tests for the screen, frame handling, and visualizer styles.

Changes: GUI Visualizer

Layer / File(s) Summary
Screen-frame contract and spectrum access
src/gui/protocol.rs, src/core/driver/mod.rs, src/core/user_config.rs, src/infra/audio/analyzer.rs
The protocol adds screen-frame messages with band and waveform data. The driver exposes spectrum data at a requested band count. The analyzer tracks written frames and preserves recent audio when the bar count changes.
Screen capture and frame transport
src/gui/bridge.rs, src/gui/visualizer.rs, src/runtime/gui.rs
The bridge tracks screen watchers and requested bar counts. The visualizer feed manages screen capture and frame generation, including silence and capture-retention behavior. The runtime publishes screen frames when requested.
Visualizer data model and drawing helpers
gui/src/screenModel.ts, gui/src/screenDraw.ts, gui/src/visualizerModel.ts, gui/src/screenModel.test.ts
The screen model adds style selection, audio processing, and animation calculations. Shared canvas helpers and tests support those calculations. Visualizer model utilities are exported for reuse.
Visualizer style painters
gui/src/screenPaint.ts, gui/src/screenRetro.ts, gui/src/screenPaint.test.ts
The painter registry covers the visualizer styles. The painters draw spectrum bars, a VFD display, and six retro-style visualizations. Tests exercise the painters with sound and silence at multiple canvas sizes.
GUI page, stream subscription, and integration tests
gui/src/VisualizerScreen.tsx, gui/src/VisualizerScreen.css, gui/src/App.tsx, gui/src/Shell.tsx, gui/src/connection.ts, gui/src/TopBar.tsx, gui/src/Icon.tsx, gui/src/areas.ts, gui/src/nav.ts, gui/src/i18n.ts, gui/e2e/*, gui/src/visualizerScreen.test.tsx, gui/src/areas.test.ts, gui/src/nav.test.ts, src/core/i18n/gui.rs, src/core/i18n/gui/en.rs
The GUI adds the visualizer page, screen-feed subscription, style controls, and navigation. Tests cover page behavior, keyboard style cycling, and screenshots for each style.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant VisualizerScreen
  participant Connection
  participant GUIBridge
  participant VisualizerFeed
  participant Driver
  VisualizerScreen->>Connection: Subscribe and request bars
  Connection->>GUIBridge: Send screen-frame request
  GUIBridge->>VisualizerFeed: Track screen watcher and requested bars
  VisualizerFeed->>Driver: Read spectrum at requested bars
  VisualizerFeed-->>GUIBridge: Provide screen frame
  GUIBridge-->>Connection: Send visualizer_screen message
  Connection-->>VisualizerScreen: Deliver timestamped frame
Loading

Possibly related PRs

  • LargeModGames/spotatui#963: Adds a detachable TUI visualizer pane and style persistence, which shares visualizer styles and bar-sizing behavior with this GUI screen.
  • LargeModGames/spotatui#959: Changes Linux audio capture availability, which affects whether the screen can receive audio.
  • LargeModGames/spotatui#939: Adds GUI navigation and visualizer translations related to the new visualizer page and its labels.
Merge Risk: Minimal · up to 8242d

The reviewed visualizer paths have no established merge-blocking issue. The page can fit shared frames, and zero-length tracks use the intended fallback.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the valid conventional-commit prefix "feat(gui):", clearly describes the visualizer screen change, and uses a concise imperative subject.
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 docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.21053% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/driver/mod.rs 0.0% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit 2bae686 into main Nov 1, 2026
39 checks passed
@LargeModGames
LargeModGames deleted the feat/gui-visualizer-screen branch November 1, 2026 15:45
LargeModGames added a commit that referenced this pull request Nov 7, 2026
# Summary

Version bump and changelog for v0.48.0. No application code changes.

- `Cargo.toml`, `Cargo.lock`, `desktop/Cargo.toml` and
`desktop/Cargo.lock` go to 0.48.0. The librespot fork stays at `=0.8.7`.
- `CHANGELOG.md`: `## [Unreleased]` is now `## [v0.48.0] 2026-11-07`. I
checked every PR merged since v0.47.0 against it and added entries for
the GUI visualizer page (#965), the lyric seek in the terminal (#970),
the completed Chinese translation (#939, #953, #956, #962), the Recently
Played stubs (#982), cover art in iTerm2 (#979), the librespot 0.8.7
bump for #676 (#955) and the ten bug fixes in #954.

# Testing

- cargo test --no-default-features --features telemetry,tui: 1912 passed
- cargo metadata on both manifests refreshed the two lock files.

# Additional notes

The desktop shell test `version_matches_root` runs in the desktop
workflow, not locally.

---
<sub>💬 Questions or want to chat with other contributors? Join the
[spotatui Discord](https://spotatui.com/discord).</sub>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* This release includes new features across the terminal, desktop app,
and command-line interface.
* **Localization**
  * Chinese translations are complete.
* **Bug Fixes**
* Fixed issues affecting listening history, iTerm2 cover art, native
queue playback, and other reported areas.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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