Skip to content

feat(chords): stem-aware chord + segment-key path (accuracy PR-B4) - #207

Merged
slittycode merged 1 commit into
mainfrom
claude/asa-integration-producer-bp82ws
Jul 12, 2026
Merged

feat(chords): stem-aware chord + segment-key path (accuracy PR-B4)#207
slittycode merged 1 commit into
mainfrom
claude/asa-integration-producer-bp82ws

Conversation

@slittycode

Copy link
Copy Markdown
Owner

The highest-leverage chord-accuracy lever from the baseline audit: run chord and per-segment-key chroma on a bass-removed stem mix instead of the full mix. The bassline is the single biggest polluter of full-mix chroma (measured chord accuracy drops from ~0.65 clean to ~0.5 under a dense mix), and Demucs stems are already on disk under --separate — so this is an input-array swap, not a re-separation.

What

  • mix_stems_mono(stems, ('other','vocals')) (analyze_audio_io.py) sums the harmonic stems to mono; None when none load.
  • analyze_chords / analyze_segment_key gain a harmonic_mono kwarg; when present, chroma runs on it. Additive chordDetail.chordSource + segmentKey[].source ("full_mix" | "harmonic_stems") record which path ran.
  • Stems absent → full-mix path, bit-identical to before: the golden diff adds only the two source keys (chord values unchanged), and the chords-only corpus clips hold at ~0.99.

Validation honesty (please note)

Demucs model weights are network-blocked in this sandbox (proxy 403 — the same restriction that blocks the datasets). So separation returns None here, and the synthetic multi-layer clips exercise the full-mix fallback, not the harmonic path. I'm therefore not claiming any measured accuracy gain from this environment. What is proven:

  • Fallback safety: golden bit-identical, chords-only clips unchanged, no-regression by construction.
  • Harmonic wiring: unit-tested (mix_stems_mono summing + skip-missing; chordSource/segmentKey.source tagging when harmonic_mono is passed).

The end-to-end gain must be measured where Demucs weights are reachable (operator machine / networked CI) on real dense mixes — the synthetic bass is a clean low sine that barely pollutes chroma, so it wouldn't be a fair test even if separation ran. This mirrors how the whole accuracy program handles the sandbox's network limits.

Contract mirrors (tripwire #4)

JSON_SCHEMA.md rows · types/measurement.ts (ChordDetail.chordSource, SegmentKeyEntry.source) · backendPhase1Client chord reconstructor forwards chordSource (segmentKey passes through) · phase1FullPayload fixture (+ parity gate) · golden re-baselined (structural).

Tests

test_stem_aware_chords (helper + source tagging). Backend 1306 OK, default fundamentals gate green, frontend verify green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T4wfz87k6kzJqkKLKZE7YL


Generated by Claude Code

Runs chord/key chroma on a bass-removed stem mix (other+vocals) instead
of the full mix when Demucs stems are available. The bassline is the
single biggest polluter of full-mix chroma, so harmonic-source isolation
is the highest-leverage chord-accuracy lever in the baseline audit.

- mix_stems_mono(stems, ('other','vocals')) in analyze_audio_io.py sums
  the harmonic stems to mono; None when no stem loads.
- analyze_chords / analyze_segment_key gain a harmonic_mono kwarg; when
  present the chroma runs on it. Additive chordDetail.chordSource +
  segmentKey[].source ('full_mix' | 'harmonic_stems') record which ran.
- Stems absent -> full-mix path, BIT-IDENTICAL to before (golden diff adds
  only the two source keys; chord values unchanged; chords-only corpus
  clips hold at ~0.99).

Validation honesty: Demucs model weights are network-blocked in this
sandbox (proxy 403, same restriction as the datasets), so separation
returns None here and the synthetic multi-layer clips exercise the
full-mix fallback, not the harmonic path. The harmonic wiring is proven
by unit tests (mix_stems_mono summing/skip-missing; chordSource +
segmentKey source tagging); the end-to-end accuracy GAIN must be measured
where Demucs weights are reachable (operator machine / CI with network) on
real dense mixes — the synthetic bass is a clean low sine that barely
pollutes chroma anyway. No accuracy improvement is claimed from this
sandbox.

Contract mirrors (tripwire #4): JSON_SCHEMA rows; types/measurement.ts
ChordDetail.chordSource + SegmentKeyEntry.source; backendPhase1Client
chord reconstructor forwards chordSource (segmentKey passes through);
phase1FullPayload fixture; golden re-baselined (structural). Tests:
test_stem_aware_chords. Backend 1306 OK, fundamentals gate green,
frontend verify green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T4wfz87k6kzJqkKLKZE7YL
@slittycode
slittycode merged commit a8edefd into main Jul 12, 2026
5 checks passed
@slittycode
slittycode deleted the claude/asa-integration-producer-bp82ws branch July 12, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants