Skip to content

feat(gui): visualizer behind the player bar - #879

Merged
LargeModGames merged 1 commit into
mainfrom
feat/gui-playbar-visualizer
Oct 16, 2026
Merged

LargeModGames merged 1 commit into
mainfrom
feat/gui-playbar-visualizer

Conversation

@LargeModGames

@LargeModGames LargeModGames commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

The desktop app and the browser GUI now draw a visualizer behind the player bar while this computer plays:

  • Spectrum (the default): Winamp's classic 75 bands from 86 Hz to 22 kHz, on a fixed scale. A bar rises at once and falls at 3 heights per second. A peak cap hangs for 0.35 s and then drops with gravity. Each bar has a soft glow, and the bass pulses along the foot of the bar. The colours go from the accent (bass) to the accent turned 60° (treble), kept dark enough for the white text over them.
  • Waveform: a line in three glow layers, with a mirrored echo and a fill to the midline.
  • Off.

A click on empty space in the bar moves to the next mode. The setting is Player Bar Visualizer in the Interface section (behavior.player_bar_visualizer: spectrum, waveform or off).

How it works:

  • The system-audio capture that the terminal visualizer already uses (WASAPI loopback on Windows, the PipeWire sink monitor on Linux) now also keeps its newest 100 ms as a mono mix. TickEnv.viz is now an Option<VizNeed>: Bars for the terminal's cava bars, Samples for the GUI, which runs its own analysis in src/infra/audio/winamp.rs.
  • src/gui/visualizer.rs reads the capture on a 16 ms frame clock while a page shows the bar and this process plays. The capture opens only then, and it closes 10 s after the sound stops or the page hides the bar. A capture that brings no audio is closed and opened again after 3, 6, 12 and 24 s, then it rests until the next start. The GUI shows no status message for this.
  • The capture hears the sound after spotatui's own volume, so the frames take that volume back out, up to 40 dB. At 0% nothing shows.
  • Frames go as ServerMessage::Visualizer on their own latest-wins channel, and only to a socket that sent ClientMessage::Visualizer { on: true }. A slow page skips frames and never fills the push backlog. The page asks only while it is visible and the full-screen view does not cover the bar.
  • On the page, visualizerModel.ts holds the motion, the colours and the shapes as pure functions, and PlayerBarVisualizer.tsx paints them on a canvas.

Platforms: Windows and Linux. The desktop build, the gui CI leg and desktop.yml now have audio-viz,audio-viz-cpal, and the deb and rpm packages depend on the PipeWire library. macOS stays off at runtime, because the capture there opens the microphone. The terminal Settings show the row only on Linux and Windows, where the desktop app can use it.

Two capture fixes come with it:

  • PipeWireCapture never ended its main loop when it closed, so each close left a thread and a connected PipeWire stream behind. It now quits the loop.
  • A capture open that hangs or panics no longer starts a pile of new opens or blocks later ones.

Testing

On Windows 11, at this commit:

cargo fmt --all -- --check
fmt exit 0

cargo clippy <features> -- -D warnings
exit 0 for: telemetry,tui / telemetry / telemetry,streaming / default / telemetry,tui,mcp-server /
telemetry,tui,ai-dj / the new gui leg list / telemetry,gui,streaming / the desktop feature list /
all-sources,gui,cover-art,mcp-server,ai-dj,audio-viz

cargo test --no-default-features --features telemetry,tui
test result: ok. 1665 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.59s

cargo test
test result: ok. 2163 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. 2106 passed; 1 failed; 30 ignored; 0 measured; 0 filtered out; finished in 5.11s

cargo clippy --manifest-path desktop/Cargo.toml -- -D warnings
exit 0
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

gui/: npm run lint, npm run format:check, npm run typecheck: exit 0
npm test
      Tests  477 passed (477)
npm run shots
  1 failed
  143 passed (22.1s)
  • uri_round_trip parses a Unix path, so it fails only on Windows. My change does not touch src/infra/local.
  • The failed shot is focus.shot.ts "a sidebar click keeps focus ..." in WebKit. It fails the same way on a clean main on Windows.
  • I ran the desktop app (debug build) on Windows with a Qobuz track and a Spotify track: the spectrum draws behind the bar.
  • The PipeWire code compiles only on Linux, so the CI legs are its first build.

Additional notes

  • Two new e2e scenes, visualizer spectrum and visualizer waveform, are in the gui-shots artifact. The settings scene now shows the new row.
  • gui/src/bindings is regenerated: VisualizerFrame is new, and ClientMessage, ServerMessage, GuiStrings, SettingsStrings and strings.json changed.
  • desktop/Cargo.lock gains the capture crates (pipewire, realfft and their dependencies). No version of an existing crate moved.

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

Summary by CodeRabbit

  • New Features
    • Added a player-bar visualizer for the desktop app and browser GUI, with Spectrum and Waveform modes alongside Off.
    • Choose a mode in behavior settings, or click empty space in the player bar to cycle through modes.
    • The visualizer uses the accent color and is available on Windows and Linux. Linux packages now include the required PipeWire library.

The desktop app and the browser GUI draw a spectrum or a waveform behind
the player bar while this computer plays, from the system-audio capture
(WASAPI loopback on Windows, PipeWire on Linux). A click on empty bar space
or the Player Bar Visualizer setting changes the mode.

The PipeWire capture now ends its main loop when it closes.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ca3dc041-648a-47f4-bdac-a56f58dfa68b
📥 Commits

Reviewing files that changed from the base of the PR and between 864f049 and 0fe3922.

⛔ Files ignored due to path filters: 7
  • desktop/Cargo.lock is excluded by !**/*.lock, !desktop/Cargo.lock
  • 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/ServerMessage.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/SettingsStrings.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/VisualizerFrame.ts is excluded by !gui/src/bindings/**
  • gui/src/bindings/strings.json is excluded by !gui/src/bindings/**
📒 Files selected for processing: 40
  • .github/workflows/ci.yml
  • .github/workflows/desktop.yml
  • AGENTS.md
  • CHANGELOG.md
  • desktop/Cargo.toml
  • desktop/tauri.conf.json
  • gui/e2e/bridge.ts
  • gui/e2e/fixtures.ts
  • gui/e2e/scenes.shot.ts
  • gui/src/App.tsx
  • gui/src/Chrome.css
  • gui/src/PlayerBar.tsx
  • gui/src/PlayerBarVisualizer.tsx
  • gui/src/Shell.tsx
  • gui/src/bars.test.tsx
  • gui/src/connection.test.ts
  • gui/src/connection.ts
  • gui/src/visualizerModel.test.ts
  • gui/src/visualizerModel.ts
  • src/core/app/settings_apply.rs
  • src/core/app/settings_schema.rs
  • src/core/driver/mod.rs
  • src/core/driver/viz_capture.rs
  • src/core/i18n/gui.rs
  • src/core/i18n/gui/en.rs
  • src/core/i18n/settings.rs
  • src/core/i18n/settings/en.rs
  • src/core/user_config.rs
  • src/gui/bridge.rs
  • src/gui/mod.rs
  • src/gui/protocol.rs
  • src/gui/visualizer.rs
  • src/infra/audio/analyzer.rs
  • src/infra/audio/capture.rs
  • src/infra/audio/mod.rs
  • src/infra/audio/pipewire_capture.rs
  • src/infra/audio/player.rs
  • src/infra/audio/winamp.rs
  • src/runtime/gui.rs
  • src/tui/runner.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

Adds a configurable player-bar visualizer with Spectrum, Waveform, and Off modes. The change adds platform-specific audio capture, server-to-GUI frame streaming, canvas rendering, settings persistence, and Linux package dependencies.

Changes: Player-bar visualizer

Layer / File(s) Summary
Settings, protocol, and platform wiring
src/core/user_config.rs, src/core/app/settings_*, src/core/i18n/*, src/gui/protocol.rs, .github/workflows/*, desktop/Cargo.toml, desktop/tauri.conf.json, AGENTS.md, CHANGELOG.md
Adds the behavior.player_bar_visualizer setting with Off, Spectrum, and Waveform options. Adds platform-specific settings rows and protocol messages. Enables visualization features in CI and desktop builds, adds PipeWire package dependencies, and documents the feature.
Audio capture and signal processing
src/core/driver/*, src/infra/audio/*, src/tui/runner.rs
Adds sample-only capture requests and access to recent audio samples. Adds 75-band spectrum and waveform processing, capture lifecycle handling, and shared volume gain mapping.
Server-side frame production and delivery
src/gui/visualizer.rs, src/runtime/gui.rs, src/gui/bridge.rs, src/gui/mod.rs
Adds visualizer capture and frame-stream rules. The GUI runtime publishes frames, and sockets deliver them while visualizer watching is enabled.
GUI interaction, rendering, and validation
gui/src/connection.ts, gui/src/App.tsx, gui/src/Shell.tsx, gui/src/PlayerBar.tsx, gui/src/PlayerBarVisualizer.tsx, gui/src/visualizerModel.ts, gui/src/Chrome.css, gui/src/*test*, gui/e2e/*
Connects frame subscriptions to the player bar. Adds click-to-cycle interaction, spectrum and waveform canvas drawing, rendering model tests, and screenshot tests.

Priority: ➖ Normal

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PlayerBar
  participant Connection
  participant Socket as GUI socket
  participant Publisher
  participant Runtime as runtime/gui
  participant Feed
  participant Driver
  PlayerBar->>Connection: subscribe with watchVisualizer
  Connection->>Socket: send Visualizer on
  Socket->>Publisher: register watcher
  Runtime->>Feed: wants_capture(now)
  Runtime->>Driver: tick(TickEnv viz Samples)
  Runtime->>Feed: frame(&Driver, now)
  Feed->>Driver: recent_audio()
  Feed-->>Runtime: visualizer ServerMessage
  Runtime->>Publisher: frame(message)
  Publisher-->>Socket: latest frame update
  Socket-->>Connection: send visualizer frame
  Connection-->>PlayerBar: deliver frame to listener
Loading
Merge Risk: ⚪ Minimal · up to 0fe39

No identified issue remains that should block merging after normal checks.

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 permitted conventional-commit prefix and scope, remains concise, and accurately describes the player-bar visualizer change.
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

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

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

@LargeModGames
LargeModGames merged commit 217b2e8 into main Oct 16, 2026
36 checks passed
@LargeModGames
LargeModGames deleted the feat/gui-playbar-visualizer branch October 16, 2026 17:47
LargeModGames pushed a commit that referenced this pull request Oct 17, 2026
# Summary

The second Chinese translation PR after #877 (refs #726): the Behavior
settings and the controls every settings tab shares, in Simplified
Chinese (`zh-Hans`) and Traditional Chinese with Taiwan wording
(`zh-Hant`).

- `src/core/i18n/settings/zh_hans.rs` and `zh_hant.rs`: setting names
and descriptions for the Behavior tab, the controls every tab shares
(tab names, on/off, the editing and navigation hints) and the option
labels, including the new Player Bar Visualizer row from #879.
- Only the labels change. What gets saved to `config.yml` (option tokens
such as `release_date:desc`, key names) stays the same in every
language.
- `docs/configuration.md` names the Chinese labels of `auto`.
- `gui/src/bindings/strings.json` is regenerated, which is most of the
diff.

English is unchanged, and anything not translated yet still falls back
to English. Keybinding and theme settings come in the next PR.

# Testing

macOS (aarch64), on top of `00753912`:

- `cargo fmt --all --check` and `cargo clippy --locked -- -D warnings`:
clean.
- `cargo test --locked`: 2196 passed, 8 ignored. The gui-feature run
leaves no bindings diff.

# Additional notes

A native-speaker review of the wording is welcome; any fix is a one-line
change in the table.


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

## Summary by CodeRabbit

* **New Features**
* Added Simplified and Traditional Chinese translations throughout the
settings interface, including labels, descriptions, options, prompts,
and validation messages.
* The language-picker documentation now shows the localized “Auto
(system)” label in Chinese. The saved configuration value remains
`auto`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: 2570165831 <[email protected]>
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