feat(web): per-phrase fact-sheet in the split pager (#75) - #95
Conversation
#75) Failing unit tests for a pure phrase fact-sheet: scientific note names, register low/high/span, notes-per-bar density, and a velocity-range + flat-dynamics summary — all computed from the split's `{p,s,d,v}` notes, so the web pager can show a phrase's musical fingerprint instead of a verse/chorus label. The module is a stub here; the green commit implements it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
`noteName` (scientific pitch), `phraseStats` (register low/high/span,
notes-per-bar density, velocity range + flat-dynamics flag), and
`formatStats` (compact one-liner). Pure functions over the split's
`{p,s,d,v}` notes — no DOM, no wasm. Also corrects a test expectation:
MIDI 57 is A3, not A4.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
Wires the phrasestats helper into renderPhrase: under the phrase info line the pager now shows the shown phrase's register (low–high + semitone span), notes-per-bar density, and velocity range + a flat-dynamics hint — an intrinsic, transferable fingerprint of the phrase rather than a song-form label. Static front-end only (app.js/index.html/style.css); the new line is tinted part-A blue and monospaced to read as a compact data strip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughA new DOM-free helper module ChangesPer-phrase stats panel
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Re-aims the open part of #75 away from song-form labels (verse/chorus) toward a transferable phrase fingerprint: the split pager now shows each phrase's intrinsic characteristics under the info line.
Why (design note)
Section labels are bound to the source song and lose meaning once a phrase enters the corpus — a "chorus" in one song and a "verse" in another can be musically identical. Intrinsic characteristics — register, density, dynamics — are what generation/similarity actually want, and they're computable from data the split already emits. (Discussed with the maintainer; this reframes #75's "structure tags" sub-ask rather than deriving verse/chorus.)
What
A compact per-phrase fact-sheet, e.g.:
(flat)hint (a hand for the existingflat_dynamicsquality flag)How
web/static/phrasestats.js—noteName/phraseStats/formatStats, computed from the split's{p,s,d,v}notes. No engine/wasm change: it reads JSON the split already produces (notes,bar_lo,bar_hi).renderPhrase()as a new#splitStatsline under the phrase info; tinted part-A blue, monospaced to read as a data strip.TDD
red (
1d9fca9) → green (1d97839) → glue (8d0fd3e). The helper is unit-tested; the single render line is DOM glue (exempt, ADR-0024).Verification
node --testfromweb/), incl. 7 new fornoteName/phraseStats/formatStatsnode --check web/static/app.jsclean🤖 Generated with Claude Code
https://claude.ai/code/session_01TTUbGjzD8ysnVnCJnZJE95
Generated by Claude Code
Summary by CodeRabbit
New Features
Tests