Repository navigation
feat(tui): bring back the pitch visualizer - #759
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The pitch view retains its position when playback is paused. No confirmed issue remains that should block merging after normal checks. Pre-merge checks |
|
06a2de6 to
19da7a9
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
While a Spotify track plays, the analysis screen opens on a Spotify Pitch view: the twelve pitch classes of the segment playing now, scaled by its loudness envelope and drawn with the cava renderer and cava-like rise and gravity, plus the tempo, key and time signature of the current section. A local clock blends the native 1 s position updates. V cycles Cava, Bar Graph and Spotify Pitch; the pitch view is never saved, and capture is closed while it shows.
# Summary First half of bringing back the spotify-tui visualizer that read Spotify's audio analysis. Since #752 we have a Spotify session, and spclient `/audio-attributes/v1/audio-analysis/{base62}` returns the same JSON the Web API used to. This PR adds the data path only; #759 draws it. Nothing asks for an analysis in this PR, so users see no change. - `infra/spotify`: a router route `GET audio-analysis/{id}` answered from spclient on the app side with `request_as_json`, like the playlist reads, so no fork release is needed. - `infra/network/mapping.rs`: `track_analysis` maps the JSON into a slim `TrackAnalysis` (sections with tempo, key, mode and time signature; segments with their 12 pitches and loudness envelope). No rspotify type: its `AudioAnalysis` needs the fingerprint strings and rejects key `-1`. - `core/app/audio_analysis.rs`: `AnalysisState` with a stale-reply guard and one fetch per track. A 404 or an unreadable body is "no analysis"; any other failure (a 429, a timeout) is tried again after 10 s. - `IoEvent::GetAudioAnalysis` passes the auth gate on the pump and runs the fetch as a detached task through `spotify_api_request_json_for`, so a DJ library crawl cannot hold it up. It never opens the error screen. - `want_audio_analysis` and the `audio_analysis()` getter carry `#[cfg_attr(not(test), allow(dead_code))]` until #759 uses them. # Testing - `cargo fmt --all -- --check`: ok - `cargo clippy -- -D warnings`, and the same with `--no-default-features --features telemetry,tui`, `telemetry`, and `telemetry,gui,streaming,discord-rpc,self-update,scripting,mcp-server,mpris`: all `Finished` - `cargo test --no-default-features --features telemetry,tui`: `test result: ok. 1480 passed; 0 failed; 0 ignored` - `cargo test`: `test result: ok. 1928 passed; 0 failed; 6 ignored` - Live, `cargo test --lib infra::spotify::live_tests::audio_analysis -- --ignored --test-threads=1 --nocapture`: `sections: 14, segments: 1512, peak loudness -60.0 to -1.1 dB` for "One More Time" # Additional notes Stacked under #759. Merge both with `gh stack merge`. --- <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 --> ## Summary by CodeRabbit * **New Features** * Added Spotify audio-analysis data fetching for tracks, including musical sections, tempo, key, time signature, loudness, and pitch information. * Analysis results are reused while available, and failed requests can be retried after a short delay. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
19da7a9 to
0ae9d3d
Compare
# Summary Version bump and changelog for v0.45.0, the first release with the desktop app. No application code changes. - `Cargo.toml`, `Cargo.lock`, `desktop/Cargo.toml` and `desktop/Cargo.lock` go to 0.45.0. The desktop version must match the root package, a desktop test pins that. - `CHANGELOG.md`: `## [Unreleased]` is now `## [v0.45.0] 2026-10-12`. I checked every PR merged since v0.44.0 against it: #757, #758 (in the pitch visualizer entry), #759, #734, #751 and #763 have entries; #622, #755 and #762 are docs only. The four desktop entries got the empty line between them that the other entries have. - `SECURITY.md` names 0.45 as the supported version. # Testing ``` cargo metadata --locked --format-version 1 > /dev/null root metadata --locked: ok cargo metadata --locked --manifest-path desktop/Cargo.toml --format-version 1 > /dev/null desktop metadata --locked: ok cargo check --locked Finished `dev` profile [unoptimized + debuginfo] target(s) in 31.36s cargo package --list --allow-dirty 394 files; none under desktop/ or gui/ ``` # Additional notes This tag is the first run of the `desktop` and `desktop-manifest` release jobs. The updater signing secrets are set and the public key is in `desktop/tauri.conf.json`, so the release attaches signed installers and `latest.json`, and installed desktop apps update themselves from then on. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub>
Summary
Second half: the Spotify Pitch view on the analysis screen, drawn from the audio analysis that #758 fetches.
vopens Spotify Pitch: the 12 pitch classes (C to B) of the segment playing now, with a row of note names, and the tempo, key and time signature of the current section with their confidence. Every other source opens on the saved capture style, as before. "Spotify track" means what plays now, so it also works when Spotify plays on another Connect device.render_cavarenderer through a small meter that rises in about 30 ms and falls with gravity. My first versions drew the raw data and looked jumpy; this is the version I tested and kept.PositionChangedupdates, and blends a correction under 1 s in over 400 ms, so the bars do not jump each second. A seek still applies at once.Vcycles Cava, Bar Graph and Spotify Pitch while a Spotify track plays. Pitch is never written toconfig.yml, so the config stays readable by older releases, and leaving Pitch withVholds until the screen is opened again. Audio capture is closed while Pitch shows.Testing
cargo fmt --all -- --check: okcargo clippy -- -D warnings, and the same with--no-default-features --features telemetry,tui,telemetry, andtelemetry,gui,streaming,discord-rpc,self-update,scripting,mcp-server,mpris: allFinishedcargo test --no-default-features --features telemetry,tui:test result: ok. 1502 passed; 0 failed; 0 ignoredcargo test:test result: ok. 1950 passed; 0 failed; 6 ignoredVcycles through the three styles, a Qobuz track opens on Cava. A temporary log probe (not committed) confirmed that the clock moves 16 ms per frame between position updates.Additional notes
Stacked on #758. Not covered: the GUI frontend has no analysis screen, so it never asks for an analysis. The view needs no audio capture, so it also works in builds without
audio-viz.💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit
vduring Spotify playback to open Spotify Pitch. PressVto cycle among Cava, Bar Graph, and Spotify Pitch; other audio sources continue to use the saved visualizer style.