Repository navigation
Closed
Labels
featureWork bigger than a fix: designed with Don, built in stages (harnest R11)Work bigger than a fix: designed with Don, built in stages (harnest R11)owner:testerTester's turn to actTester's turn to actstageA child issue: one stage of a featureA child issue: one stage of a featurestatus:verifiedTester confirmed the fix via a real MCP callTester confirmed the fix via a real MCP call
Description
Stage A of #600, from plan v2, section Stages → A — analyze_beats (with Design → Surfaces → New task analyze_beats). The plan comment is authoritative; this restates it.
Filed by the feature lead, claude-opus-5-5 via anthropic.
Builds
- Onset envelope, autocorrelation tempo and DP beat tracking in
dw/dsp.py, numpy/scipy only, no librosa (Q1, decided). - RMS-peak fallback when the onset envelope is too flat to track.
- Anchor calibration: two or more anchors warp detected beats piecewise-linearly through them; one anchor plus
tempo_bpmbuilds an even grid. - The
analyze_beatstask in a newdw/tasks/beats.py(dw/tasks/task.pyis near its line cap), registered withreturns="json"and noassessmentflag; domain rows. - Arguments:
audio,sample_rate?,tempo_bpm?,anchors?(list of{beat_index, seconds}or ofseconds),min_bpm,max_bpm. - Returns
{bpm, beats:[s], downbeat_phase?, method: "onset"|"rms_peaks"|"grid", calibration: {offset_s, drift, anchors_used}, warnings}.
Owes
- Tests: synthetic click tracks at 90 and 128 BPM (beats within ±20 ms); a swung track; silence; a fallback case; anchors (one anchor + BPM gives an exact grid; two anchors remove a known drift);
test_task_discovery. - Docs: a TASKS.md section; one line in the
minimax-music3skill.
Deploy path
Server deploy (engine code: restart dw.serve so the worker picks it up).
Passes when
Its own repro works:
list_tasksshowsanalyze_beats;- on a Music 3 output in a one-step workflow it returns
bpmand an ascendingbeatslist spanning the song,method: "onset"; - silence returns an empty or
rms_peaksresult with a warning, never a crash; - one anchor plus
tempo_bpmreturns an exact even grid from the anchor (method: "grid"); - two anchors move the nearest beats onto them;
min_bpm >= max_bpm, or an anchor past the song's end, is refused byvalidate_workflow(or at run start where the static pass can't see it);
and every pending: #<this issue> case the tester writes passes.
Metadata
Metadata
Assignees
Labels
featureWork bigger than a fix: designed with Don, built in stages (harnest R11)Work bigger than a fix: designed with Don, built in stages (harnest R11)owner:testerTester's turn to actTester's turn to actstageA child issue: one stage of a featureA child issue: one stage of a featurestatus:verifiedTester confirmed the fix via a real MCP callTester confirmed the fix via a real MCP call
Activity
dkackman commentedon Oct 6, 2026
Progress (claude-opus-5-5 via anthropic): branch
feat/600-a-analyze-beatspushed with the engine side -dw/dsp.pybeat functions,dw/tasks/beats.py(analyze_beats, registered via a newdw/tasks/registry.py), domains and static checks indw/task_domains.py. Remaining: unit tests, TASKS.md / skill / ARCHITECTURE docs, merge, deploy, hand-off.feat(tasks): #625 - analyze_beats tests, TASKS.md section, Music 3 sk…
Merge branch 'feat/600-a-analyze-beats' into develop (#625)
dkackman commentedon Oct 6, 2026
Stage A built (claude-opus-5-5 via anthropic).
Shipped:
develop@ 3c97709 (merge offeat/600-a-analyze-beats). Deploy:[deploy 02:06:02] deployed develop @ 3c977092, healthy, mcp=true.Plan items covered
dw/dsp.py(numpy/scipy only, no librosa):onset_envelope(spectral flux, 10 ms hop),estimate_tempo(autocorrelation under a log-normal prior;tempo_bpmnarrows the prior when not laying a grid),track_beats(Ellis DP, head and tail beats trimmed),rms_peaks(fallback),downbeat_phase,warp_times.analyze_beatsin newdw/tasks/beats.py, registeredreturns="json"with noassessmentflag. Arguments:audio, sample_rate?, tempo_bpm?, anchors?, min_bpm=60, max_bpm=200.{bpm, beats, downbeat_phase, method: onset|rms_peaks|grid, calibration: {offset_s, drift, anchors_used}, warnings}. Each warning also goes throughemit_warning.tempo_bpmlays an exact grid with no detection.sample_rate,tempo_bpm,min_bpmandmax_bpmmust be positive.validate_workflowrefuses:min_bpm >= max_bpm;beat_index.beat_indexpast the number of detected beats;beats: [],bpm: null,method: "rms_peaks"and a warning. A track with no clear onsets returnsrms_peaksand a warning.tests/test_analyze_beats.pyandtests/test_task_discovery.py..wavrun, and the registered handler.docs/TASKS.mdsection, one line in theminimax-music3skill, and thedocs/ARCHITECTURE.mdrows.Deviations from the plan
register_commandand the registry tables moved to a newdw/tasks/registry.py.dw/tasks/task.pyre-exports them, so imports are unchanged. Reason:task.pywas over the 1100-line ceiling, sobeats.pyregisters its own handler.task.pyis now 1031 lines.duration_seconds, so you can check that the beats span the song.{beat_index, seconds}anchors name the beat explicitly.downbeat_phaseisnullforgridandrms_peaks.No existing MCP shape changed.
dkackman commentedon Oct 6, 2026
Architecture review queued by the loop driver: this hand-off changed
dw/ordw_mcp/ondevelop(85471b4fa2..3c97709249: dw/dsp.py dw/task_domains.py dw/tasks/beats.py dw/tasks/registry.py dw/tasks/task.py). The reviewer checks it againstdocs/ARCHITECTURE.mdbefore the tester verifies.dkackman commentedon Oct 6, 2026
Architecture review: pass (claude-opus-5-5 via anthropic).
Read
85471b4f..3c977092underdw/(the two #625 commits:dw/dsp.py,dw/task_domains.py,dw/tasks/beats.py,dw/tasks/registry.py,dw/tasks/task.py) againstdocs/ARCHITECTURE.mdand stage C item 3.analyze_beatsdecodes throughaudio_utils.waveform_and_rate, coerces throughcoerce_number, and checks domains throughtask_domains.check_arguments. Its cross-argument rules live intask_domains.beats_problems, which the static pass and the run both call. The measurement is indw/dsp.py, which still imports nothing fromdw(Signal processing row). Warnings go out throughevents.emit_warning. The only checks the run makes itself are the ones that need the decoded song: an anchor past the end, abeat_indexpast the detected beats, and a grid that starts before 0 s.pyproject.toml(Q1 decided against it). The pieces scipy already provides come from scipy:signal.stft,correlate,find_peaksandargrelmax. The autocorrelation tempo prior and the Ellis DP aren't provided by any declared dependency.dw/tasks/registry.pyand namesbeats.pyas a self-registering task module. The Task argument domains row namesbeats_problemsandbeats_errors. The beat functions fall under the existing Signal processing row (dw/dsp.py), which needs no change.beats.py,registry.pyanddsp.py. NoCLAUDE.mdchanged.Not a finding, just for the record: the downmix pattern now in
dsp.mono_float64predates this change indw/tasks/loop_bed.py:430, and that line could call the new helper at the next consolidation.Not checked here because it's the hook's and CI's job: this change adds two modules (
beats.pyandregistry.py), anddocs/stabilization/baseline.json(modules: 175) wasn't touched in this range.36 remaining items
Merge branch 'fix/625-beats-gate' into develop (#625)
dkackman commentedon Oct 6, 2026
Reopened: bounce-2's fix (
cb04ee98) regressed a real song. Refixed. Shipped:cbf614a6, merged todevelopase8beed84. Deploy:[deploy 05:55:51] deployed develop @ e8beed84(healthy after 5s, mcp=true).Lead: claude-fable-5-1 via anthropic, at Don's request after he asked how to judge
cb04ee98.What was wrong
cb04ee98(detrend the tempo envelope, keep tracked beats only when periodicity >= 0.3 or salience >= 3) was written against C-F208 arm 2 as it then stood, and the triage after it found that case was a real pulse. Nobody had checked the commit on real songs. I ran the parent (1c5f3d04) andb96fe24con 8 Music 3 songs from Don's workspaces and 7 controls:noise-bed.wav(the rewritten arm 2) isrms_peakson both builds. The commit was never needed for the corrected case.acorn-wars/assets/score.mp3, caption: 88 BPM half-time orchestral build) lost its beats: parentonset100 BPM / 125 beats / interval CV 2.4%;b96fe24crms_peaks. Its strongest period is 50 BPM (detrended autocorrelation 0.65); its in-range octaves at 100 and 200 sit level with the song's other repeats (0.18 vs 0.23), the detrended search picked the 200 BPM range edge, and the gate threw the beats away.onset->rms_peaks: the detrend doing its job.The fix
estimate_tempoalways holds the range's best against the pulse found over 30-300 BPM and takes the pulse's octave when it is the more periodic. The fallback already did this, but only once the range's best fell under 0.2; acorn-wars's sat at 0.23.rms_peaks. A tracked pulse that is faint keeps its beats and warns ("the pulse is faint (periodicity …) - … pass anchors or tempo_bpm if they are off"). A wrong grid can be checked against the song; a missing one cannot. The detrend stays.Tests:
tests/test_analyze_beats.pygainsTestRange::test_a_weak_tempo_in_the_range_yields_to_a_strong_pulse_outside_it(a 50 BPM click track with a soft 190 BPM train at periodicity ~0.22: the old code returned 95.2, the pulse's double period; now 100) andTestFaintPulse(method staysonset, one warning naminganchors). 68 pass in the file; the suite is 8650 passed, 1 failed -tests/test_api_contract.py::test_the_committed_document_is_current, which fails identically on pristinea3522de0, so it is develop's, not this change's (the OpenAPI document is stale around therealized/notefields; whoever owns #626'splan_cutsAPI additions should runscripts/dump_openapi.py+npm run gen:api). Docs:TASKS.mdanalyze_beatsparagraph.Verified on lem @
e8beed84(CPU, outputs deleted)asset:score.mp3:onset, 100.0 BPM, 125 beats, no warnings (job7fe1b7faf5a2).asset:shedding-skin-quartet/take1-raw.mp3:onset, 69.77 BPM, 190 beats, no warnings (jobe74eb094706f).b96fe24cexcept acorn-wars, which matches the parent.For the tester
Re-run C-F205 to C-F211 as written. C-F208 arms 1-3 hold on this tree (arm 2
rms_peaks+ "no reliable beat", arm 3onsetat 80). Nothing inplan_cuts(#626) reads the beats result'smethodor warnings, onlybeatsandduration_seconds, so B is unaffected.For Don (not blocking this)
cb04ee98before it merged; worth a follow-up issue.dw-agentcheckout's uncommitted edits onfeat/600-A-analyze-beats-quiet-average(the thing blocking #600 stage B: plan_cuts task (line/stanza/beat segmentation) + music-video-cuts template #626's hand-off) are a third attempt at the old C-F208: an average-level gate at -45 dBFS. The case it targeted was wrong and the gate would silence quiet real songs. My recommendation isgit checkout -- .there; nothing in them is in this fix.dkackman commentedon Oct 6, 2026
Correction to the note above: the stale OpenAPI document was from #647's
get_job_workflownotefield (1760a48b), not #626. Regenerated in2e8fced0on develop under the pinned fastapi/pydantic;test_api_contract.pyis 72 passed, so the suite is clean again for the tester.dkackman commentedon Oct 6, 2026
Verified by tester (claude-opus-5-5 via anthropic) against lem on develop @ 95fc37f. C-F205 to C-F211 were re-run as written. All pass.
list_taskslistsanalyze_beats, and it is not inassessment.get_taskshows audio, sample_rate, tempo_bpm, anchors (seconds or{beat_index, seconds}), min_bpm 60 and max_bpm 200.get_guide("tasks", section="analyze_beats")names bpm, beats, downbeat_phase (null when none stands out), method onset/rms_peaks/grid, calibration{offset_s, drift, anchors_used}and warnings.dw:minimax-music3skill (Run and judge, step 5) points atanalyze_beats, and attempo_bpmplus one anchor for a grid.onset, no warnings.onset, no warnings.onset, 85.71 BPM, beats 0.19 to 29.77, no warnings.rms_peaks, "the track is silent" warning.rms_peaks, 157.89, "no reliable beat was found" warning.onset, 80.0 BPM, beats at a 0.75 s step, no warnings.anchors [1.25]):grid, 120, beats 0.25, 0.75, 1.25 … 29.75.{beat_index 0, seconds 1.25}):grid, beats 1.25 … 29.75.{beat_index 4, seconds 3.0}): 0.5, 1.125, 1.75, 2.375, 3.0 ….onset, beats 0.1, 0.6 … 19.6, with 2.1 and 15.1 landing on the anchors.validate_workflowrefuses min_bpm 120 against max_bpm 120, and 150 against 90, atsteps[0].task.arguments.min_bpm.anchors [29.9];Every job's output was deleted with
delete_output. Thepending: #625markers were already dropped in harnest commit c93b812, so no suite edit was needed.feat(tasks): dkackman#625 - analyze_beats: onset/DP beat tracking, RM…
feat(beats): dkackman#625 - a noise bed is not a pulse: detrend the t…
fix(beats): dkackman#625 - a faint pulse is kept and warned about; th…