feat(editor): bootstrap tempo from click stems and filename BPM - #311
Conversation
|
Warning Review limit reached
Next review available in: 18 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe PR adds click-stem tempo bootstrapping for suggest-fit, validates asynchronous analysis requests, and derives BPM hints from audio filenames for tempo dialogs and starter grids. It also adds documentation and automated tests covering routing, parsing, fallback behavior, and timing. ChangesTempo assistance
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant _editorTempoSuggestFit
participant _tempoAnalysisRoutePure
participant ensureGuideOnsetsShifted
participant _tempoAnalysisRequestStillCurrentPure
User->>_editorTempoSuggestFit: Press G to suggest tempo fit
_editorTempoSuggestFit->>_tempoAnalysisRoutePure: Resolve locked guide or click bootstrap
_tempoAnalysisRoutePure-->>_editorTempoSuggestFit: Return routed source
_editorTempoSuggestFit->>ensureGuideOnsetsShifted: Decode and analyze routed audio
ensureGuideOnsetsShifted-->>_editorTempoSuggestFit: Return onsets
_editorTempoSuggestFit->>_tempoAnalysisRequestStillCurrentPure: Validate route, URL, and offset
_tempoAnalysisRequestStillCurrentPure-->>_editorTempoSuggestFit: Accept or discard analysis
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/input.js`:
- Around line 1096-1105: The bootstrap fallback in the onsets handling block
must analyze the master mix explicitly rather than the currently active source.
Replace the `_ensureOnsetsShifted()` fallback with
`ensureGuideOnsetsShifted(...)` using the master source, then revalidate the
relevant state after the await before continuing or returning. Add a regression
test covering a non-master active source and an undecodable click fallback.
- Around line 1061-1063: Refresh the route after the asynchronous validation
step in the surrounding analysis flow, before the logic at lines 1082–1092
selects the success label or failure policy. Recompute it using the current
track-session and source state so bootstrap-to-locked-guide transitions are
honored when validation changes the route, while preserving the existing
metronome handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 12afdfae-46f0-4570-b0be-6c755355beda
📒 Files selected for processing (8)
CHANGELOG.mddocs/USER-GUIDE.mdroutes.pysrc/input.jssrc/song-fit.jssrc/track-session.jstests/tempo_bootstrap_seed.test.mjstests/test_filename_bpm.py
f77d3f4 to
9a35e85
Compare
…seeding
TEMPO-ASSIST charrette, the opportunistic slice (A's name-based easy win + B):
- With no tempo guide locked, Suggest (G) auto-detects a stem NAMED like a
click track ("Click"/"Metronome", word-bounded, never the master) and
analyzes it with the metronome engine instead of the mix, announcing the
choice in the status bar. A LOCKED guide stays supreme (locking the master
as plain audio is the opt-out); nothing persists — the bootstrap is an
analysis default, not a session edit. An undecodable click falls back to
ordinary mix analysis. Post-await revalidation covers the bootstrap route
(lock arriving elsewhere / stem gone / url or offset changed all discard).
- Filename BPM priors: "Song-147bpm.mp3"-style names parse as a soft hint
(standalone 2-3 digit values by "bpm" in either order, 40-300 window).
The create flow's starter grid is spaced at that BPM instead of the 120
literal (uploaded file first, then the create modal's rows, then the
audio_url basename), and Song Fit's Set-constant-tempo dialog pre-fills
it — scanning source name, id, then the URL basename, because a live
create/import session's upload-cache path keeps the original file name
after display names collapse. No hint anywhere → no behavior change.
Verified end-to-end on the testbed: a pack created from "Test Song-147bpm.wav"
+ "Metronome.wav" seeds song_timeline.json at 147 (0.408163s spacing) through
both the API and the Create New modal; G on the loaded pack reports
"Analyzing the click stem "metronome" (auto-detected)" and proposes from the
click; Set constant tempo pre-fills 147 after Replace Audio.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01929LgKdJMyPGLf8N1WpEVW
9a35e85 to
0fe848f
Compare
The next TEMPO-ASSIST charrette slice (design A's name-based easy win + design B), after the map-health worklist (#310).
G bootstraps off a shipped metronome stem
With no tempo guide locked, Suggest (
G) detects a stem named like a click track ("Click", "Metronome" — word-bounded, so "Clickbait" and the master never match) and analyzes it with the existing metronome engine instead of the mix, announcing the choice in the status bar with a hint that ♩ pins or changes it.Filename BPM seeding (opportunistic, never required)
Song-147bpm.mp3-style names parse as a soft tempo prior (standalone 2–3 digit values next to "bpm" in either order, 40–300 sanity window; longer digit runs are treated as hashes/ids and rejected):Verified end-to-end (testbed, isolated preview on :8002)
Test Song-147bpm.wav+Metronome.wav— via the API and via the Create New Arrangement modal — lands withsong_timeline.jsonseeded at 147 (0.408163s beat spacing, tempos[{time: 0, bpm: 147}]).147with the pre-filled label after Replace Audio with the bpm-named file; the no-hint session correctly shows the plain label and empty field.Suites: 210/210 JS, 338 passed pytest, lint clean. New coverage:
tests/tempo_bootstrap_seed.test.mjs(detector table, route supremacy/bootstrap/null, no-persistence, revalidation, BPM parse table, hint order/URL fallback),tests/test_filename_bpm.py(parse table, seed-grid equivalence + spacing + 6-decimal precision).USER-GUIDE §6 updated (auto-detection + prefill notes); CHANGELOG entries added.
🤖 Generated with Claude Code
https://claude.ai/code/session_01929LgKdJMyPGLf8N1WpEVW
Summary by CodeRabbit
New Features
Documentation