Add visualizer@v1 with beats, peaks, pitch, and frequency#259
Draft
maximmaxim345 wants to merge 15 commits into
Draft
Add visualizer@v1 with beats, peaks, pitch, and frequency#259maximmaxim345 wants to merge 15 commits into
visualizer@v1 with beats, peaks, pitch, and frequency#259maximmaxim345 wants to merge 15 commits into
Conversation
Negotiates the visualizer@v1 role (downbeat-aware msg 17 frames). BeatTiming flows through BeatHandler, BeatState, and the render_beat_strip pipeline; downbeats render as a filled square while regular beats stay as filled circles. Downbeat wins when both land on the same cell. Schedule appends are deduplicated by timestamp so repeated batches don't paint the same beat twice on the timeline.
The dominant-frequency and pitch arrows shared one cursor row; give each its own line (f_peak above pitch) with the footer below. Each row is gated on the visualizer type the server negotiated in stream/start, so a row is only reserved when its data can actually arrive.
Fold the timeline strips and tonal cursor rows into one keep-priority row budget (peaks, beats, f_peak, pitch, footer). Each strip needs its type in the server-negotiated set, so a strip is hidden when the server won't send it instead of reserving an always-empty row.
Show the pitch arrow and label whenever a confident readout arrives, even if the server didn't list "pitch" in the stream/start types. f_peak and the timeline strips stay type-gated.
Keep the pitch cursor row when "pitch" is negotiated so the arrow appearing and vanishing no longer shifts the spectrum and f_peak rows. Show the arrow whenever a pitch readout exists, regardless of confidence.
Review findings on the visualizer feature: - Reset and detach the peak handler on disconnect and shutdown, and clear the peak strip, matching the beat handler. A reconnect no longer fires a stale asyncio timer or stale peaks against the new stream. - Gate BeatState.is_active on the decaying pulse instead of "a beat ever landed", so the high-rate visualizer refresh idles when paused or silent. - Drop the last-seen loudness/pitch/f_peak on stream/clear and stream/end so a stale readout from one stream can't ride into the next. - Remove the now-unused pitch_confidence plumbing left after the confidence gate was dropped.
The beat strip used to be the only carrier of the "now" cursor, so a stream with peaks but no beats had no time reference. Draw the center playhead on the peak strip too, colored to match the beat strip's.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades the TUI visualizer from the old
_draft_r1draft to the newervisualizer@v1role, rendering everything the server streams time-aligned to the playhead: a beats strip with estimated BPM and downbeats, a peaks strip of energy onsets, and pitch and dominant-frequency (f_peak) cursors over the spectrum.Only data that is sent by the server is displayed. For example, Music Assistant 2.9 does not support pitch.
Shouldn't be merged until Music Assistant 2.9
Still marked as draft since this requires the server to support
visualizer@v1(Sendspin/spec#86). The current stable version of Music Assistant (2.8) only supportsvisualizer@_draft_r1. Once 2.9 releases we can merge this.Try it
Press
vin the TUI to toggle the visualizer.