desktop: persisted waveform-peaks cache + async load path - #34
Merged
Conversation
Track loads no longer freeze the UI: decode, peaks, and pre-analysis all run on a background worker, with results installed through a channel polled each frame under the existing analysis-generation guard. - New .tspeaks binary sidecar persists the base pyramid level (u8-quantized, versioned header, keyed by the same mono-signal FNV hash as the .tsanalysis.json sidecar, so renames and retags keep the cache). Corrupt or mismatched files silently recompute and rewrite; writes are temp+rename atomic. - Upper pyramid levels rebuild from the cached base via the existing halving loop (BandPeaks::from_base_level). - The UI beat grid now derives from the pre-analysis artifact (grid_from_artifact), eliminating the duplicate synchronous detect_beat_grid_buffer pass; BPM lands instantly on a sidecar hit. - File panel shows a spinner while decoding / awaiting analysis. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Stage 12's fuzz/no-panic scope only listed the artifact JSON loader; the new binary peaks-cache reader is the same class of untrusted-input parser and belongs on the list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Track loads no longer freeze the UI, and analyzed tracks load near-instantly on relaunch.
.tspeaksbinary sidecar persists the 3-band peaks pyramid's base level (u8-quantized, versioned 60-byte header). Keyed by the same mono-signal FNV hash as the.tsanalysis.jsonsidecar, so renamed and retagged files keep their cache. Corrupt/truncated/mismatched files silently recompute and rewrite; writes are temp+rename atomic. Upper pyramid levels rebuild from the cached base via the existing halving loop.analysis_generationcounter (rapid successive loads discard stale results). The file panel shows a spinner while decoding.grid_from_artifact), deleting the duplicate synchronousdetect_beat_grid_bufferpass — beat detection runs once per load, and BPM appears instantly on a sidecar hit.Zero new dependencies; no library changes.
Testing
cargo test --all-targets(68 passed),cargo clippy --all-targets -- -D warnings,cargo fmt --check— all clean indesktop/.Peaks: using cached sidecar; playback runs with zero underruns; a truncated sidecar triggers silent recompute and rewrite.🤖 Generated with Claude Code