114 Commits

Author SHA1 Message Date
vadimwit 072920ff0e docs+config: never-delete policy — CLAUDE.md hard rule + .claude/settings.json deny list
Claude must never execute destructive/irreversible commands (rm, git branch
-d/-D, git push --delete, reset --hard, force-push, DROP, etc.) — it proposes
them for the user to run. Enforced behaviorally in CLAUDE.md (authoritative)
and as permissions.deny rules in .claude/settings.json (defense-in-depth).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 21:36:02 +01:00
vadimwit 8ebdc73958 ledger: L-77 done (9415daf) — hybrid loop+history voicings rail, pushed both remotes
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 19:01:54 +01:00
vadimwit 9415daf4a0 feat(rail): hybrid voicings rail — highlight the loop + other recent chords underneath (task L-77)
The suggested-voicings rail no longer restricts to loop chords or collapses
to a single heard-live chord. It now shows TWO groups: the LOOP group (the
canonical GlanceRail, byte-unchanged — KB order, moving "now" playhead,
voice-leading chips) under a "the loop" caption, and an "also played" group
of the other recently-played DISTINCT chords (most-recent-first, each
expanded to its full voicing gallery, no chips / no playhead). With no loop
the "also played" group IS the rail, replacing the old single-chord
fallback. At least 4 chords show as soon as history exists (RAIL_TOTAL_CAP
top-up; only chords actually played, never fabricated).

GlanceRail gains an optional showTransitions prop (default true = the loop
caller is byte-unchanged); the history group passes false, which suppresses
the voice-leading chips + "next" tag AND switches the section framing off
the loop/playhead language, and renders non-focusable static row headers
(no inert focus button / misleading tooltip on history rows). App.jsx
untouched — chordHistory already flowed in. Verified build + validate-KB +
smoke 903/903 green.

User directive 2026-07-13: "highlight the loop chords when it finds a loop
but also add the other chords underneath ... at least 4 or more."

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 19:01:00 +01:00
vadimwit 7561566ceb ledger: L-78 done (d543b98, direct push); L-77 re-scoped to hybrid loop+history rail (>=4)
L-78 pushed on user request ("push everything now") — build+validate+smoke
903/903, full Critic gate waived. L-77 re-scoped same day: highlight loop
chords + list other recent chords underneath, >=4 total once history exists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 18:47:37 +01:00
vadimwit d543b986dc feat(trythis): 3x3 ways-to-play — up to 3 guitar grips / 1 piano per suggestion (task L-78)
Try-this now fills its space: each of up to 3 substitutions renders as a
row with a left identity block (chord chip -> modal, category tag, why)
and a right "ways to play it" block that follows the global instrument —
guitar shows up to 3 genuinely different grips (getGuitarVoicings), piano
one MiniPiano, bass a root caption. A FIXED 3-slot frame reserves height
for all three rows (present -> SubRow, absent -> dashed EmptySlot) so
suggestions #1/#2 never shift when a chord yields 2 vs 3 subs (the
anti-jump ask). Honest: add9's 2-shape roots show 2 grips, not padded
fakes. Pure parseChordName/subsForChord/pickSubject preserved (per-chord
reactivity intact). Design tokens only. Verified: build + validate-KB +
smoke 903/903 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 18:46:10 +01:00
vadimwit ede3f2e372 docs(design): related-area v2 (task D-76) — multi-chord rail + try-this 3x3; returned once (add9 shape count), fixed 2026-07-13 16:57:30 +01:00
vadimwit dc503807ef ledger: D-76/L-77/L-78 — related-area v2 (rail always-multi-chord most-recent-first; try-this 3-cap stable 3x3 guitar) 2026-07-13 16:42:19 +01:00
vadimwit 8c018d697d ledger: L-75/L-76 done (side-by-side try-this + 2x2 related, combined-gate PASS) 2026-07-13 16:32:35 +01:00
vadimwit e6957160f6 feat(related): 2x2 grid for suggested progressions (task L-76)
The suggested-progressions panel lays its entries out as a 2x2 grid
(grid-cols-1 sm:grid-cols-2) instead of a vertical list, using the
left-column width and halving the block height. Layout-only: a grid
class + a render-time slice(0,4); the ranker, scoring, cap
(RELATED_MAX_ENTRIES=5), and every entry's chips/labels are untouched,
so the C-50 ranking pins stay green. Idle/empty states stay
single-column. Critic PASS (combined gate).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 16:31:54 +01:00
vadimwit 957ce88fd6 feat(trythis): side-by-side suggestions with per-chord instrument diagrams (task L-75)
Try this now shows all of the current chord's valid substitutions at
once (no more rotation), each as a card with the chord name, a mini
diagram of how to play it in the selected instrument (guitar
ChordDiagram 4-across, piano MiniPiano keyboards in a 2x2, bass a root
caption), and the plain why. Still follows the live playhead so the
set refreshes per chord as the progression evolves; honest-empty
without a key/loop; the rolled-jam visibility fallback preserved.
App.jsx change is the single instrument prop, contract-clean. Critic
PASS (combined gate: diagrams resolve, root badge correct, reactivity
verified).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 16:31:54 +01:00
vadimwit 51c2be90cc docs(design): related-area layout — side-by-side try-this with per-sub diagrams, 2x2 suggested progressions (task D-75) 2026-07-13 16:15:38 +01:00
vadimwit 2905a4b979 ledger(backlog): Try-this vs Suggested-progressions should be two distinct features (user direction, revise later) 2026-07-13 16:11:06 +01:00
vadimwit c62cd60595 ledger: D-75/L-75/L-76 — related-area space layout (side-by-side try-this + diagrams, 2x2 related) 2026-07-13 15:55:28 +01:00
vadimwit 89b3e323ea ledger: L-70/L-71/L-74b done (combined-gate PASS) — rail/licks polish live 2026-07-13 12:59:39 +01:00
vadimwit 6885fc3ce1 fix(dashboard): Try-this card visible for any detected/rolled loop, not only live input (task L-74b)
The rotating Try-this card was gated on a live-detected currentChord,
so a rolled Jam Roulette (which locks a key + loop but leaves the
history empty until you play) showed nothing. TryThis now falls back
to the first loop chord that yields a substitution, so the card is
visible whenever a loop is on screen in a locked key; the live-playing
path is unchanged and honest-empty (no key / no loop) is preserved.
Critic PASS (combined gate: renders for the rolled-jam case, no
infinite render).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:58:40 +01:00
vadimwit 19b1a4ff91 feat(licks): dashboard licks strip — uniform compact cards following the instrument (task L-71)
The dashboard licks strip now follows the global GUITAR/PIANO/BASS
selector: guitar shows LickCard tabs, piano shows the PianoLickCard
piano-roll (jazz/blues/gospel/rnb), bass shows an honest empty line.
Every strip card is a uniform compact 220x150 box (tab/roll normalized
to a 104px-tall panel) so the licks stop hogging space. Play buttons
removed from the strip. Knowledge Center LicksSection + LickCard left
byte-identical. .dark-scroll applied to the rail/strip scrollers.
Critic PASS (combined gate).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:58:40 +01:00
vadimwit aae69e8a7b feat(rail): voicings rail polish — 4 guitar shapes, 2x2 mini piano, no play buttons, dark scrollbars (task L-70)
Dashboard voicings rail: guitar galleries capped to 4 shapes
(recommended-first, then open, then movable by base fret; prop-gated so
the Knowledge Center and chord modal keep all shapes); piano voicings
render as a 2x2 grid of size="mini" (scale 0.60) keyboards under the
rail's dense path only. Play buttons removed globally from
VoicingBrowser per the user ("leave them off, better not") — the
Knowledge Center + modal render byte-identical minus the buttons.
A scoped .dark-scroll utility (thin, #2a2a2a on transparent) dresses
the dashboard scrollers. Critic PASS (combined gate: byte-identity
proven, zero play buttons everywhere, contract intact).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:58:39 +01:00
vadimwit c16e9f1827 ledger: L-74b done (TryThis loop-fallback visibility); batch-gate plan for rail/licks 2026-07-13 12:40:48 +01:00
vadimwit 9e21df127c ledger: D-70 accepted; L-70/L-71 claimed (rail/licks build); play buttons global per user 2026-07-13 12:34:15 +01:00
vadimwit 3fdc72ebd4 docs(design): dashboard-polish concept (task D-70) — rail/licks optimizations, accepted to unblock the build 2026-07-13 12:33:37 +01:00
vadimwit 245d9f6fb2 ledger: L-74 done (rotating Try-this card); duplicate-name-loop rotation caveat backlogged 2026-07-13 12:23:42 +01:00
vadimwit 038fdfafc8 feat(dashboard): rotating Try-this card — one fresh substitution per loop pass (task L-74)
A compact TryThis card follows the playhead chord and shows ONE
suggestion at a time, cycling to the next valid substitution each time
the loop completes a pass (playhead wraps to a lower station). Over
Am-C-F the F cycles Dm -> Fm -> Fmaj7 -> E7 across passes, so the app
keeps offering a new idea and eventually teaches every honest move,
never a wrong one. Chip taps into ChordDetailModal; 0 subs -> no card,
1 sub -> static. Mounted App.jsx-only above RelatedProgressions in the
related slot; audio contract grep-clean; rotation logic exported pure
and StrictMode-safe. Critic PASS (2-pass rotation trace verified).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:23:18 +01:00
vadimwit 3469bafa0d feat(theory): suggestSubstitutions engine for the Try-this feature (task L-73)
Additive suggestSubstitutions({rootPc,quality}, keyInfo, opts) returns
up to 4 honest, correctly-spelled chord alternatives in the detected
key: relative/diatonic-third, borrowed-minor iv (flat-spelled b6),
diatonic extension colour, and the secondary dominant of the next
chord — each with a plain teaching why. A sabotage-proven smoke
truth-table pins the tables (Am-C-F both readings, the Rule-D blues
moves). Critic returned once (Rule C self-suggested the sounding chord
on 7th inputs: Dm7->Dm7, plus a latent add9-on-minor mis-spelling),
fixed (skip self-quality extension; omit category C when nothing new
to add), PASS on scoped re-gate. Smoke 903/903; theory.js purely
additive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 12:04:34 +01:00
vadimwit 0b75ebdce1 ledger: L-73 returned (Rule C self-suggestion); L-74 = vary/rotate display (user decision) 2026-07-13 11:58:37 +01:00
vadimwit a311895d50 feat(related): same-style-first variations when a style is active (task L-72)
When the loop matches a KB style (rolled or live-detected),
RelatedProgressions leads with that style's other progressions under a
"Try these in {style}" header, labelled by data-derived character
(minor version / shorter form / extended form / reharmonized) computed
from mode/bars/qualities — no cross-style jumping. The role phrase is
suppressed unless the sibling is genuinely related (same changes or a
shared transition), so no false "variation" claim. When no style is
locked, today's cross-style list is preserved byte-for-byte. Smoke
893/893: §8 re-pinned (scores stable 92/156, labels moved) plus two
gate-added durable assertions (finding-B suppression + no-match
fallback). Critic PASS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 11:37:37 +01:00
vadimwit a95ad147f7 ledger: D-73 done (try-this design PASS after 3 copy fixes) 2026-07-13 11:31:37 +01:00
vadimwit c2207ef7b6 docs(design): Try this chord-substitution feature — 4 curated moves with plain why-copy (task D-73)
For a loop chord in the detected key, suggest up to 4 alternatives:
relative/diatonic-third sub, borrowed-minor iv colour, extension
colour, and the secondary dominant of the next chord — each with a
one-line teaching why, ranked softest to boldest. Worked through the
Am-C-F case under both the A-minor and C-major readings; circle-of-
fifths tie-in kept honest (relative + secondary-dominant are circle
moves, borrowed + extension are not). Mounts as a compact TryThis card
above RelatedProgressions in App's relatedSlot (file-disjoint). Critic
returned once (chordRootPC circular-import trap, sharp-spelled b6, one
wrong mediant claim — all copy/plumbing, rules verified correct),
fixed, re-gate waived (gate-prescribed fixes verified directly).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 11:31:18 +01:00
vadimwit a13c8fecc0 ledger: no song forms; L-72 unblocked (findings A/B resolved); new Try-this substitution feature (D-73/L-73/L-74) 2026-07-13 11:15:54 +01:00
vadimwit bb802db2b6 ledger: D-72 done (design PASS); L-72 held pending user song-forms decision + finding-A/B
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 11:08:11 +01:00
vadimwit 952d8076df docs(design): same-style related-progressions — variations by structural difference (task D-72)
When a style is active (rolled or detected), RelatedProgressions leads
with same-style siblings reframed by data-derived character (minor
version / shorter form / extended form / reharmonized), computed from
mode/bars/qualities — no new KB content, no matcher change. Cross-style
same-changes entries demoted to a secondary section. Critic PASS (role
labels recomputed honest for blues + jazz; smoke-pin shift is
label-only). Deliberately avoids verse/chorus/bridge labels the KB has
no data for.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 11:07:32 +01:00
vadimwit c6c6427f50 ledger: user answer folded — related-progressions = reuse existing KB same-style siblings; D-72 unblocked, runs parallel
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 10:52:15 +01:00
vadimwit 4d562d758e ledger: seed sprint-dashboard-polish (M-08) — 4-guitar cap, 2x2 piano, no play buttons, dark scrollbars, licks follow instrument, same-style related
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 10:48:16 +01:00
vadimwit 2072f3674e ledger: BOTH SPRINTS COMPLETE — one-screen + roulette-kb; L-60/C-61 done; combined PR summary
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 19:57:11 +01:00
vadimwit 1df6fe8e9e feat(app): Jam Roulette — one-click genre + key + progression to jam over (task L-60, 2/2)
The 🎲 button opens a genre popover (Surprise me + the 10 KB styles);
rollJam seeds a random key + an interesting round-trip-safe
progression as a committed loop, so the whole dashboard fills exactly
as if detection found it — banner chips, voicing rail, licks, related
progressions. Three commit-layer guards keep the seed alive until the
band takes over: the null-clear skips seeded loops (a seed would
otherwise die one commit before the earliest possible confirmation),
the agreement branch confirms it, replacement swaps once real playing
is consistent, New Song clears it. An amber "rolled · style · name ·
bars — play it!" provenance chip flips to the normal loop marker on
first agreeing detection. Audio contract grep: zero hits. Critic PASS
(seed timeline hand-traced; §3.5 invariant verified at every write).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 19:48:14 +01:00
vadimwit 8d74e54f5a fix(match): index collapsed loop forms — real 12-bar blues now matches its KB entry (task L-60, 1/2)
buildLoopIndex additionally indexes each progression's collapsed form
(adjacent (degree,suffix) dedup + wrap), appended after raw entries so
every prior matcher winner is preserved except the enumerated
country-145 self-attribution. Repairs a pre-existing LIVE-detection
bug: a real 12-bar or 8-bar blues stream collapses to fewer names than
the raw KB degrees, so it matched NOTHING and the Jam Guide sat empty.
JamGuide reads authored plays through the collapsed station's
sourceIndex (all four guitar/piano/bass paths). Adds seedableLoop +
the round-trip roulette pool (smoke sweep: 4 failures / pool 52).
theory.js canonicalize exported. Critic PASS (fix-(a) additivity
proven registry-wide; pool reproduced from the spec; bass sourceIndex
station 5 -> raw 10 hand-checked).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 19:48:14 +01:00
vadimwit 4b64c41417 ledger: one-screen COMPLETE (L-50/D-51/L-51/C-50); L-60 re-dispatched on Opus after Fable spend-limit
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 19:11:42 +01:00
vadimwit 4deba7e443 test(sweep): one-screen sprint-end sweep — ranking pins + registry id uniqueness (task C-50)
Smoke 886/886: RelatedProgressions ranking pinned (blues-12bar 152,
jazz-251-minor 156, no-collapse counterfactual 39 — replica grounded
against the live component; the 12-bar pin deliberately goes red when
D-62's collapsed indexing lands, message says re-pin). Validator:
registry-level progression-id uniqueness (the file walk missed
registry wiring dups — sabotage-proven with exactly one named error).
Whole-sprint App.jsx audio contract: zero hits since the seed.
Full-App SSR 60/60 across instrument x {normal, jam view}.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 18:27:20 +01:00
vadimwit 6e8d8f40fc feat(related): RelatedProgressions — loop-relative suggestions replace the generic table (task L-51)
KB-sourced ranking per the one-screen spec: same canonical degree
shape +100 (with the mandatory collapse of consecutive equal
degree/quality pairs — a real detector-produced 12-bar fires its blues
relatives despite the raw-index matcher bug), same style +40, shared
transitions +12 capped 36, degree-set Jaccard, length penalty; floor
24, max 5, never padded; entries render name/style/level/annotation +
the chord chain realized in the live key as real buttons ->
ChordDetailModal. match.js: additive exports only. Ride-along: dead
currentChord prop dropped from the banner mount. Critic PASS (both
hand-verified scores recomputed independently; full entry lists
byte-matched on three scenarios; collapse counterfactual = 39).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:52:52 +01:00
vadimwit d5a45f433a feat(rail): 500px-column adaptation — margin-hardened cells, wrap-safe basis (task D-51)
Chrome shave (rail p-2, rows p-1.5, dense cells p-1.5) so the
284+160 piano pair fits with real margin even under a classic Windows
scrollbar (was a genuine break: 452 > 439 at old paddings); gallery
basis 300->320 so a piano recommended cell can never share line one
(prominence for free) while guitar keeps 4 cells per line;
recommended-cell border strengthened to full accent. Playhead
highlight-only contract proven intact; non-dense mounts byte-identical
(28/28 at the gate). Critic PASS (arithmetic recomputed from source
AND the built CSS; flex-basis override confirmed in dist).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:51:09 +01:00
vadimwit e58a7a624c feat(app): one-screen jam dashboard + jam view (task L-50, commit 2/2)
Two-column grid: LEFT compact instrument view (natural-scale caps
674/562/674, non-compact renders byte-identical) + licks strip +
related-progressions slot (L-51 fills); RIGHT the 500px suggested-
voicings rail, height-bounded with internal scroll (not sticky).
ProgressionSuggestions unmounted (file kept). Jam view: one button,
two layers — CSS h-screen lock with everything below the grid
unmounted, plus best-effort Promise-caught requestFullscreen; Escape
and fullscreenchange stay in sync. Audio contract grep: zero hits.
Critic PASS (SSR 73/73; gate applied a one-class legend restoration
for non-compact byte-identity, re-verified green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:28:25 +01:00
vadimwit 800fd43778 feat(banner): slim loop strip — big Now Playing chord removed (task L-50, commit 1/2)
Key chip + last-5 history + loop chips on one wrapping row; the
playhead loop chip and the enlarged current history chip are the
"now"; p-2 chrome trim. The text-6xl Now Playing column, its divider,
and the dead currentRN computation are gone — the loop shows once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:28:25 +01:00
vadimwit 8e7a648660 ledger: roulette-kb 8/10 done, one-screen D-50 done + L-50 building; iteration log updated
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:02:44 +01:00
vadimwit 2c18c71598 feat(kb): piano licks pack #2 — gospel + rnb (task P-61)
8 licks (39 total): the gospel-scale run with the b3->3 crush, shout
run-up, harmonized sixths walk (the m6 falling exactly where the major
scale demands), diminished roll over the passing #iv dim7; the nine
sigh, quartal slip (grace-brushed fourths, all Dorian), the Dilla
lazy chromatic drop (derived approaches), pentatonic turn onto the 9.
Critic returned once (one interval claim said "each move a step" —
actually skip-then-step), fixed with the gate's own prescribed
wording, verified against its computed -3/-2 motion. 42/43 first-pass
checks; quality-context honesty verified against the styles' real
progressions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:02:15 +01:00
vadimwit e87b2bbdcc docs(design): jam roulette spec — seed mechanism, matcher collapse fix, empirical roll pool (task D-62)
Two-click flow (button -> style -> instant seed) writing lockedKey +
detectedProgression + a seeded committed-vote so the whole dashboard
fills as if detected and live playing continues from it; three
commit-layer guards specced (every unguarded seed dies exactly one
commit before earliest confirmation); fix (a): match.js additionally
indexes collapsed forms — repairing the pre-existing live bug where
10 progressions (incl. blues-12bar) never match detection, plus
country-145 misattribution; roll pool = steady-state all-offsets
round-trip passers (52/56); sourceIndex remap covers guitar, piano
AND bass play lookups. Returned twice, PASS on round-3 re-gate (a
literal implementation of the sweep protocol reproduced the pinned
numbers with zero interpretation gaps).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:54:43 +01:00
vadimwit a7dbd6a8b1 feat(licks): PianoLickCard — piano-roll lick renderer with playback (task D-60)
Pitch-timeline thumb (beat-proportional columns, note-name pills,
contour line, dashed root gutter, amber approaches, technique glyphs);
size=full adds an order-badged keyboard view + chordContext/tips;
exported pure realizePianoLick (deg via the shared resolveDegree,
approaches derived from the next deg, null on malformed); playback
mirrors BassPatternCard (sequential playVoicing, one sequence,
unmount silence). Activates the dormant C-60 vocab guard (smoke
880/880). Component only — LicksStrip wiring deferred behind the
one-screen restructure. Critic PASS (41/41 realization audit at
hand-derived expectations, 87/87 SSR, no third resolveDegree copy).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:48:31 +01:00
vadimwit d24bf352e1 docs(design): one-screen jam dashboard concept + jam view (task D-50)
Slim loop strip (76px trimmed banner, big Now Playing chord removed),
two-column grid: compact instrument view (natural-scale cap 674/562px)
+ licks + related-progressions LEFT, height-bounded voicings rail
RIGHT (500px, internal scroll — honestly NOT sticky: zero travel in
the flex row); jam view = CSS h-screen lock + best-effort
requestFullscreen (Promise-caught), hiding everything below;
related-progressions ranking spec'd with the collapse rule
coordinated with D-62's matcher fix. Critic returned once (strip
height, inert sticky, double-counted padding, raw-vs-collapsed
ranking), fixed, PASS on scoped re-gate (all budgets recomputed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:48:31 +01:00
vadimwit 70263e221e feat(kb): piano licks pack #1 — jazz + blues, the KB's first piano licks (task P-60)
8 licks (31 total): bebop enclosure into the b3, Baker's 3-5-b7-b9
dim-flip over the V7, Powell ascent to the 9th, Garland-lane dominant
thirds fall; the b3->3 crush, pentatonic turnaround fall (verified
survives over a minor blues), Spann hammer dyads, the cry-and-melt
7#9 fill. All realized before prose was written. Critic PASS (35/35
prose claims recomputed in two keys; idioms verified to match their
names, not just cite them; dom7-heavy blues coverage accepted as
musically right).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:42:23 +01:00
vadimwit c999c958cb feat(explore): circle of fifths — live key wedge, safe-neighbour tiers, modal parent-major hub (task D-61)
SVG circle in the Knowledge Center Explore section: 12 majors outer
ring with key-signature glyphs, relative minors inner, live/locked key
solid accent with subdominant/dominant/relative soft-tiered; diatonic
chord chips inline (tap -> ChordDetailModal); wedge tap = local
preview only, app key state never touched; modal keys light the
correct ring and the hub teaches the parent-major relationship
("1# - G major's notes" for A dorian; 72/72 mode x root uniqueness
proven). Critic returned once (hub showed the wedge signature, not
the mode's), fixed, PASS on scoped re-gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:42:22 +01:00
vadimwit ffc1bb1d18 feat(kb): pop piano cell + 8 guitar shapes for thin qualities (task P-62)
Pop piano: 5 progressions x 2 plays (182 total) — triads/inversions
only, one sourced add9 shimmer; ballad rolls vs voice-led pillars,
doo-wop triplets vs one-finger walks, Pachelbel inversion stair,
tonic-drone pads, octave drive. Shapes: dim7/half_dim/aug/maj6/min6
each reach >=3 placeable grips, add9 gains a movable A-shape; dim
honestly left at 2. Audit also surfaced two WRONG pre-existing shapes
(half_dim E-Barre spells {0,3,6,7}; "Open Dadd9" is Dsus2) -> backlog.
Critic PASS (~110 independent checks; all additions pc-spelled in two
keys; strictly additive diff).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:34:29 +01:00
vadimwit 5f4e2b715d feat(kb): piano lick schema — degree-based melodic lines with derived approaches (task C-60)
Piano licks live in <style>/piano.js licks arrays: required quality
(machine truth), deg XOR approach targeting the NEXT deg note
(enclosures fall out as idiom; same-type consecutive approaches
rejected), octave 0-2 with a 25-semitone cap proven one-semitone tight
against MiniPiano's 37-key window, 4-word piano technique vocab
(grace-note added; bend/vibrato impossible on keys), plus a dormant
smoke guard that activates when PianoLickCard.jsx exists. Smoke
879/879. Critic PASS (18 fresh sabotage cases, enclosure arithmetic
hand-verified, dormant guard proven to fire).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:24:19 +01:00
vadimwit b753b58f70 ledger: seed sprint-roulette-kb (M-07) — piano licks, voicings, circle of fifths, jam roulette; hourly x12 loop
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 15:05:26 +01:00
vadimwit 272f88a7b4 ledger: seed sprint-one-screen (M-06) — dashboard redesign, kill big chord, voicings right, loop-relative suggestions
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 14:38:02 +01:00
vadimwit acb178e8d8 ledger: iteration 4 — SPRINT sprint-integrated-glance COMPLETE (all 11 tasks green)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:20:03 +01:00
vadimwit 218c0ba4ca test(smoke): drift guard now sweeps BOTH resolveDegree copies (task C-42)
JamGuide resolveDegree imported directly (exported by the L-40
ride-along) via a .jsx resolve-retry hook; 17 new checks (export pin +
16 per-degree JamGuide sweeps) -> smoke 866/866. Sabotage-proven: a
perturbed JamGuide cell turns smoke red naming the exact drift.
Authored by the C-42 sweep agent pre-termination; verified and
sabotage-tested by Maestro (spend-limit fallback).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:18:59 +01:00
vadimwit af7c3cc0a7 feat(bass): BassPatternCard — authored basslines render as 4-string tab in the band (task L-42)
Realizes SCHEMA bass patterns per station (root at lowest playable
position, degs via the shared resolveDegree, typed approaches derived
from the next station with the open-E octave-displacement rule), lays
them out as compact E-A-D-G tab cards (lick-tab visual idiom), all
plays side by side, each with sequential playback through chordAudio
(negative notes documented-legal; one sequence at a time). Computed
root-fifth-approach line remains the fallback for pack-less styles.
BASS is now real end-to-end. Critic PASS (independent re-realization
of all 912 placements exact; untouched instrument paths byte-identical;
import cycle proven safe in both load orders).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 19:31:21 +01:00
vadimwit 4650494f0d ledger: integrated-glance iteration 3 — D-41 done (gate notes logged); L-42 in flight
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 19:17:15 +01:00
vadimwit 677d7b99d1 feat(rail): all stations expanded, playhead highlights only (task D-41)
Every loop chord is a permanently expanded vertical row: education
header (solo-scale label, guide-tone aim dots with honest 5th
fallback, voice-leading chip incl. the wrap-around loop rail) + the
full voicing gallery for the global instrument; galleries flex-wrap,
zero row-level horizontal scroll; playhead adds highlight classes only
(rows proven byte-equal modulo highlight artifacts); pin simplified to
a focus toggle (onFocusChord contract byte-compatible with L-40).
VoicingBrowser: show='bass' now renders an honest one-liner instead of
falling through to both galleries; dense drops section chrome
(non-dense proven byte-identical across 336 SSR combos). Critic PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 19:03:48 +01:00
vadimwit 7d6fe8ad50 ledger: integrated-glance iteration 2 — P-41/L-40 done (gate notes logged); D-41 in flight
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:47:14 +01:00
vadimwit c899132b94 feat(app): Jam Guide band promoted below the main module — one loop display, one instrument selector (task L-40)
The always-open zero-chrome band (GlanceRail + licks strip +
heard-live fallback) replaces CurrentJamPanel right below the
instrument view; the four-section dock becomes KnowledgeDock at the
bottom; RoadmapTrack unmounted (banner is the single loop display);
JamGuide's internal instrument/style tabs die — App's global
GUITAR/PIANO/BASS selector drives everything incl. the dock's
VoicingsSection; honest bass state (computed root-fifth-approach rows
+ notice, no galleries/licks); GlanceRail's scrollIntoView effect
deleted same-commit (would yank the document in page flow).
Ride-along: JamGuide resolveDegree exported (logic byte-identical) for
the C-40 drift guard. Critic PASS (SSR 22/22, audio-contract grep
zero hits, deletion sweep clean).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:38:30 +01:00
vadimwit 01a7c32f55 feat(kb): blues bass cell — the KB first bass pack, 8 plays over 5 progressions (task P-41)
Boogie walkups, 8th-note ramble, Jimmy Reed R-5-6-5 shuffle, 12/8
root-fifth-octave slow burn, minor box riff (quality-resolved 3rd
self-majorizes on bVI7/V7), walking turnaround + two-beat kicks. The
maj-7 climb authored as a typed chrom-below approach (pitch derived,
offset 11 never written). KB now 172 plays. Critic PASS first try
(all 76 patterns machine-realized in C AND A; 12 prose identities
recomputed, all hold key-agnostically).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:32:41 +01:00
vadimwit 2450318d42 ledger: integrated-glance iteration 1 — M-05/P-40/C-40/D-40/C-41 done; L-40/P-41 in flight
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:17:18 +01:00
vadimwit 996218f39c feat(kb): bass play schema — degree-based patterns with typed approach notes (task C-41)
Key-agnostic bass plays (piano-recipe language): deg XOR typed
approach (chrom-below/above, fifth-of-next — pitch derived from the
next station, never authored), octave 0-1 with a 19-semitone cap
(exactly fret 15 on E-A-D-G), root rule, terminal approaches,
non-decreasing beats, MIN_PLAYS_BASS=1. Legacy BASS_TOKENS stub
replaced (zero references). Smoke 849/849 with 13 new checks;
sabotage-proven twice (author + gate, different malformations).
Ride-along: SCHEMA documents the resolveDegree 7-on-6-chords quirk.
Critic PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:11:02 +01:00
vadimwit 7d1f64c718 docs(design): integrated-glance concept — band below the module, one loop display, one selector (task D-40)
Zero-chrome always-open band replaces CurrentJamPanel below the
instrument row; ProgressionBanner survives as the single loop display
(RoadmapTrack retires, education folds into rail row headers); App
instrument state threads everywhere (JamGuide internal tabs die);
vertical rows, all stations expanded, playhead highlights; honest
wrap-based math (worst piano gallery 1,178px). Critic returned once
(Dm7-specific worst case + 3 factual fixes incl. the interim
page-yank), fixed, PASS on scoped re-gate (pixel-exact recompute).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:08:26 +01:00
vadimwit 090d3a9cbf test(smoke): drift guards for resolveDegree + technique vocab (task C-40)
Smoke 836/836: a literal 16x14 degree truth table (all 224 cells
independently recomputed at the gate) pins the validator resolveDegree
behaviourally via span-probe recipes; technique vocab set-equality
between validate-kb LICK_TECHNIQUES and LickCard TECHNIQUE_VOCAB via a
scoped .jsx esbuild load hook. Both guards sabotage-proven twice
(author + gate, different perturbations). Ride-along: loop-fixtures
header line-ref fixed to App.jsx:363-365. Critic PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 17:53:41 +01:00
vadimwit 6f59add11b docs(kb): backlog refreshed to reality — 14 cells done, licks tracked, bass column activated (task P-40)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 17:47:02 +01:00
vadimwit facf6c8cc3 ledger: seed sprint-integrated-glance (M-05) — promote guide up top, single loop display, one instrument selector, all-expanded voicings
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 17:37:51 +01:00
vadimwit 9772e951b7 ledger: iteration 4 — SPRINT sprint-glance-and-loop COMPLETE (P-31/C-31 done; all 11 tasks green)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 10:10:20 +01:00
vadimwit 81cd230a4c feat(kb): blues piano cell — 5 progressions x 2 authored plays (task P-31)
Guide-tone/tritone dyad system with the parallel half- and whole-step
laws, 7#9 as the codified blue note, the bVI7->V7 five-voice plane,
VI7b9 turnaround hinge, RH sixths; solo two-fisted vs rootless-band
contrasts per play. KB now 164 plays. Critic returned once (turnaround
jump-kicks bars 3-4 dyad orientations flipped + 2 prose rewordings),
fixed, PASS on scoped re-gate (stepwise lap chain recomputed from
scratch; "only leap" now provably unavoidable, not just chosen).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:58:41 +01:00
vadimwit 0b982f9514 ledger: iteration 3 reconciled — L-33/L-31 done (gate notes logged); P-31 gating; C-31 ready
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:47:20 +01:00
vadimwit ce24d5490f fix(app): progression commit-layer tuning — survive fills, replace on evidence (task L-31)
COMMIT_VOTES=2 (unchanged, ~one bar), REPLACE_VOTES=3 (a transient or
flapping detection can never displace a committed loop; section change
replaces one commit later), NULL_CLEAR=6 (post-L-30, nulls only start
~28 commits after the loop last played — traced exactly). Vote ref now
{committedKey, candidateKey, candidateCount}; agreement resets rivals.
Diff = one hunk in the progression useEffect; audio-contract grep
clean. Ride-along: theory.js docstring overclaim softened (L-30 gate
finding b), comment-only. Critic PASS (independent re-trace of all
five scenarios + 3 hostile traces; REPLACE_VOTES=3 proven load-bearing).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:28:52 +01:00
vadimwit c78baf4943 feat(jamguide): glance mode — the playhead accordion (task L-33)
The station under the playhead auto-expands to the full voicing
gallery (VoicingBrowser dense) and advances with the music; other
stations keep their recommended thumb; level-filtered licks strip
below with token-boundary context sort and strip-owned "fits — now"
chrome; pin replaces tap-to-enlarge with identical onFocusChord
semantics; auto-follow never emits focus or audio; heard-live fallback
shows the live chord gallery. App.jsx and all renderers untouched.
Critic PASS (SSR 37/37, matcher proven on hostile cases, dense-less
render byte-identical to 0945a08).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:28:51 +01:00
vadimwit 5e9b4c5925 ledger: iteration 2 reconciled — P-30/L-30 done (gate notes logged); L-31/L-33 in flight; P-31 claimed
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:17:30 +01:00
vadimwit 4cc0009983 feat(theory): noise-tolerant loop detection rewrite (task L-30)
detectRepeatingProgression redesigned: consecutive-dup collapse,
weak-period candidate rejection (kills self-overlap ghosts
structurally), lengths 2-8, <=1 substitution/insertion per cycle with
a >=2-exact-occurrences evidence gate, recency-weighted linear
coverage scoring. All 17 C-30 fixtures pass plain (smoke 817/817,
expectedFail markers removed). Critic PASS: 15 novel generalization
probes correct or data-faithful, 0.2-0.7 ms/call, diff confined to the
repeating-progression section, fixture contract untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:10:28 +01:00
vadimwit b51daa1339 feat(kb): neo-soul/rnb piano cell — 7 progressions x 2 authored plays (task P-30)
Signature comp voicings over the computed fallback: m9 spreads, So What
quartal planing, Stevie 9sus cadence, m6/9 borrowed iv, 13sus, one 7#9
per loop; 3 comping cells + 5 improv rows. KB now 154 plays. Critic
PASS first try (independent arithmetic on 11 prose claims, spans <=11,
all 12 keys render in the 36-key window).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 09:06:53 +01:00
vadimwit 7926783778 ledger: iteration 1 reconciled — D-30/C-30/D-31 done; L-30/P-30 resumed; L-33 claimed
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 08:57:07 +01:00
vadimwit 6c7a1a7828 docs(design): glance-mode concept — the playhead accordion (task D-31)
Knowledge Center behaviour while a jam plays, zero clicks: the station
under the playhead auto-expands to the full D-30 voicing gallery and
advances with the music; level-filtered licks strip below with
context-first sort; pin gesture inherits onFocusChord semantics;
auto-follow never emits focus or auto-plays audio. Honest space math
(piano rail scrolls as normal state), 5-commit migration order for
L-33, four rejected alternatives. Critic returned once (piano gallery
width understated ~45%), fixed, PASS on scoped re-gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 01:00:16 +01:00
vadimwit fdd93c7158 test(loop): truth fixtures for detectRepeatingProgression + smoke wiring (task C-30)
17 fixtures (9 regression guards, 8 annotated expectedFail) pinning the
current detector failure map: len^2 self-overlap artifact on 2-chord
vamps, ghost 4-patterns under substituted/inserted misdetections,
duplicate-commit safety, 7/8-loop length cap, stale-section recency.
Stale expectedFail markers turn smoke red, forcing L-30 to flip them.
Critic PASS (arithmetic recomputed, sabotage x3 proven to bite).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 00:55:27 +01:00
vadimwit 0945a08497 feat(voicings): VoicingBrowser gallery — every shape and piano style side by side, no chips (task D-30)
All placeable guitar shapes and all four pianoVoicing styles render
simultaneously, each cell with its own play button; one-at-a-time
playback and the show prop semantics preserved. Critic PASS (SSR-verified
cell counts, zero aria-pressed, rootPc badge guard intact).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 00:50:33 +01:00
vadimwit 401d9d1f17 ledger: seed sprint-glance-and-loop (M-04) — gallery voicings, loop-detection redesign, glance mode
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 00:38:49 +01:00
vadimwit 3077ae2ac0 fix(dev): allow 127.0.0.1 HMR websocket in the CSP
Follow-up to the 127.0.0.1 bind: connect-src only whitelisted the
localhost variants, silently blocking Vite's HMR socket on the new
origin.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 23:41:56 +01:00
vadimwit fab385a612 fix(dev): pin dev server, wait-on gate, and Electron loadURL to 127.0.0.1
With plain localhost, node >=17 can bind the Vite dev server to ::1
only; on this machine IPv4/IPv6 loopback mismatch made the browser,
wait-on, and the Electron window all see connection-refused while Vite
reported ready. Explicit 127.0.0.1 on all three ends fixes dev startup
(user-verified: electron:dev window now opens).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 23:40:44 +01:00
vadimwit b5073353ef ledger: sprint-knowledge-center COMPLETE — PR #3 opened; loop closed
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 01:45:20 +01:00
vadimwit 0f24c757a1 ledger: C-21 done (sprint sweep PASS); prune shipped backlog entries
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 01:39:43 +01:00
vadimwit 72c6d457b0 ledger: iterations 6-7/24 — L-24/L-25/C-22/P-23 done; C-21 claimed; log
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 01:28:54 +01:00
vadimwit 2165bb571c feat(jamguide): stations render authored piano packs when a style has one (task L-24)
Piano branch prefers kb[style].instruments.piano.plays[prog][0],
resolving recipe degrees via a validator-mirrored resolveDegree +
strict-ascending stacking into MiniPiano's [0,36] space; per-station
fallback to computed pianoVoicingChain (reachable: 4 wide gospel
stations in key B); pack-less styles byte-identical to the computed
path. Critic PASS (0 drift cells vs the validator's resolveDegree;
390-cell sweep; key-B fallback confirmed rendering, not dead).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 01:28:22 +01:00
vadimwit 564a9e0a3a feat(kb): gospel piano cell — 14 plays across all 7 progressions (task P-23)
Church pillars vs rootless, hymn 12/8 vs octave-6/9, passing-dim walks
vs praise clusters, worship pads vs anticipated stabs; gospel comping
cells distinct from jazz's. KB: 140 plays. Critic returned once (one
improv-row scale claim false for vi7/iii7 — split into arithmetic-exact
rows), PASS on re-gate; 39/40 first-pass claims held.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 00:55:45 +01:00
vadimwit b4e8f12539 feat(kb): validator enforces the piano hand-span rule (task C-22)
checkPianoRecipe stacks each hand low-to-high (nearest strictly above,
repeated pc -> octave up) and fails any hand spanning > 15 semitones
(minor 10th, SCHEMA rule 3); errors name style/prog/play/chord/hand/
span; refactored to a pure exported checker surfacing all errors per
recipe. Smoke +6 checks -> 799. Independent gate PASS (injection
surfaces 10 named errors exit 1; weakened gate caught behaviorally).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 00:27:25 +01:00
vadimwit e24aa4b6ed feat(jamguide): chord modal tabs show only their instrument's voicings (task L-25)
GuitarTab/PianoTab pass show=guitar/show=piano to VoicingBrowser
(D-23 prop); Knowledge Center + station-enlarge keep both rows by
design. Critic PASS (SSR: each tab renders only its row, legacy
content intact below).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 00:25:13 +01:00
vadimwit ee009a708d ledger: iteration 5/24 — D-23/D-24/P-24 done (Critic PASS x3); log
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 00:00:42 +01:00
vadimwit 0f9c87c1e8 feat(kb): licks pack #2 — 11 licks for rock, country, reggae guitar (task P-24)
Berry double-stops, unison bend, Mixolydian rail, pentatonic cascade;
Flatt G-run, chicken-pickin' 3rds, pedal-steel bend, forward roll
(first techniques:[] lick); skank-answer dyads, bass-doubling riddim,
chromatic walk into the one drop. KB: 23 licks across 6 styles.
Critic PASS (every note independently pitch-verified; conventions
script-checked; empty-techniques branch verified in the validator).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 00:00:42 +01:00
vadimwit e2110ae21f feat(design): MiniPiano voicing thumbs crop to the voicing's octave span (task D-24)
Thumb window = whole octaves from the octave-C at-or-below the lowest
note (+ closing high C): shell thumbs 266px -> 142px, level with guitar
diagram thumbs. size=full and the legacy lh/rh path byte-identical.
Critic PASS (SVG geometry decoded back to absolute notes incl. the
octave-2 offset case; 793/793 smoke).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:58:23 +01:00
vadimwit db397f6ceb feat(design): VoicingBrowser show prop + LickCard stack-guard hardening (task D-23)
show='guitar'|'piano'|'both' (default both — 50/50 SSR renders
byte-identical for existing mounts); LickCard double-stop collision
guard now checks all same-column notes. Critic PASS (subsumption
proven; 13/13 lick layouts unchanged; adversarial overlap dead).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:56:22 +01:00
vadimwit ee81326db0 ledger: iteration 4/24 — P-21/P-22/L-22 done; promote L-24/C-22/P-23; log
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:53:35 +01:00
vadimwit 9e2567cf20 feat(kb): jazz piano cell — the KB's first authored piano pack (task P-22)
14 plays (7 progressions x 2): Bud Powell shells, rootless Type A/B,
guide-tone comps; comping rhythms; piano-angled improv. Hand spans
<= a 10th throughout. Critic returned once (6 prose voice-leading
overclaims on fifths-apart dominant alternation), fixed, PASS on
re-gate (all 6 corrected sentences arithmetic-verified both
directions); ride-along one-word polish per gate suggestion.
Rendering the authored pack in the Jam Guide is task L-24.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:52:23 +01:00
vadimwit 78706ce5ba feat(jamguide): Knowledge Center shell — four-section dock with level filter (task L-22)
Jam Guide (live, verbatim Roadmap move) / Explore (KB browser + famous
progressions, filter-exempt) / Voicings (picker follows live chord ->
VoicingBrowser) / Licks & Techniques (LickCard grids + one legend,
honest empty states). Shared foundation/intermediate filter chips;
ExplorePanel refactored to named exports (was orphaned, now imported).
App.jsx: exactly one additive prop (onChordClick). Critic PASS (48/48
SSR checks; audio contract grep clean; Roadmap hunks byte-identical).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:38:28 +01:00
vadimwit 6ea1089295 feat(kb): licks pack #1 — 12 licks for blues, jazz, funk guitar (task P-21)
4 per style using the C-20 lick schema: B.B. box, turnaround, slow-blues
curl, IV9 tritone slide; The Lick, ii-V-I enclosure, bebop dominant
descent, guide-tone rails; 9th riff, chromatic snapback, Dorian stabs
and 6-line. Every note hand-verified against its chordContext; sources
hedged. Critic PASS (independent pitch computation of all 12; validator
12 licks green; double-stop/slide glyph ordering render-checked).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 23:32:18 +01:00
vadimwit 432a238c15 ledger: iterations 2-3/24 — D-21/D-22/P-20/L-21/L-23 done; narrow P-21 lock; log
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 22:57:36 +01:00
vadimwit c08b334bad feat(kb): intermediate progressions + level tags for jazz, gospel, rnb (task P-20)
6 new level:'intermediate' progressions (tritone sub, rhythm-changes
bridge, gospel passing-dim walk-up, tonicized amen w/ borrowed iv,
Just-the-Two-of-Us loop, Sir Duke chromatic vi) x 2 guitar plays each;
all progressions in the three styles now carry explicit level. KB:
56 progressions / 112 plays. Critic returned once (3 caption theory
misstatements), fixed, PASS on re-gate (voice-leading arithmetic
hand-verified from shape constants).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 22:56:58 +01:00
vadimwit 951d5440e1 feat(jamguide): playable VoicingBrowser in chord modal + enlarged stations (task L-21)
ChordDetailModal Guitar/Piano tabs mount VoicingBrowser on top with
legacy grips/technique reference preserved below; Jam Guide enlarged
station view gains the browser on both instrument tabs; parse-null
never mounts a wrong-chord fallback. App.jsx untouched. Critic PASS
(SSR-verified both entry points; onFocusChord effects byte-untouched).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 22:55:42 +01:00
vadimwit f4e0ac67e0 fix(voicings): correct movable-shape base-fret indexing in getGuitarVoicings (task L-23)
strIdx = rootStr-1 read OPEN [s6..s1] backwards: every rootStr-5 shape
sat 2 frets low, every rootStr-4 shape 5 frets low (A-shape C major
labeled fret 1 instead of 3) in ChordDetailModal/ExplorePanel/
CurrentJamPanel; rootStr-6 was accidentally correct (same pc both ends).
Now uses the shared 6-rootStr convention. Also: playChord docstring
octave example corrected. Critic PASS (6 independent fret checks +
252-entry pre/post sweep, structure unchanged).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 22:54:18 +01:00
vadimwit 3c903ad1d9 feat(design): VoicingBrowser — switchable, playable voicings per chord (task D-21)
Guitar row (placeable GUITAR_SHAPES via ChordDiagram) + piano row (4
pianoVoicing styles via MiniPiano), chips + explicit play button per
voicing through chordAudio; single shared stop handle; graceful
guitar-empty cell (only add9@E across 168 quality x root cells).
voicings.js gains an export-only GUITAR_SHAPES line. Critic returned
once (rootless voicings badged lowest voice as root — rootPc now passed
through), PASS on scoped re-gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 22:43:21 +01:00
vadimwit 44d9c4f0e8 feat(design): LickCard — tab-style SVG lick renderer with technique glyphs (task D-22)
String 1 (high e) on top per tab convention; h/p slurs, slide, bend,
vibrato, ghost, double-stop column stacking; TechniqueLegend named
export (once per grid); layoutTab pure + testable; DEMO_LICK fixture
until P-21 lands. Critic PASS (47/47 harness checks, schema-exact).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 17:29:17 +01:00
vadimwit 0eeb308aa8 ledger: iteration 1/24 — L-11/L-20/D-20/C-20 done (Critic PASS x4); file L-23; log
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 17:08:06 +01:00
vadimwit 793e60ab05 feat(kb): schema + validator + smoke for progression levels and licks (task C-20)
Optional additive shapes: progression level (foundation|intermediate)
and per-pack licks (8-word technique vocab, tab notes string 1-6 /
fret 0-15, ids global with progressions). Validator exports checkLick
as a lib for smoke (KB_VALIDATE_AS_LIB guard); smoke 776 -> 787.
Critic PASS (independent sabotage re-proof: injected bad lick exit 1
with named errors; weakened vocab fails smoke 2/787).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 17:07:10 +01:00
vadimwit 96dda6a3ef docs(design): Knowledge Center concept — unified four-section dock (task D-20)
Jam Guide (live) / Explore / Voicings / Licks & Techniques grown from
the JamGuide dock; level filter as toggle chips; 5-commit migration
order for L-22. Audit finding: ExplorePanel + EducationPanel are
orphaned (never mounted) — migration risk far lower than assumed.
Critic PASS (orphan claim, App.jsx one-prop claim, contrast ratios all
independently verified).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 17:04:16 +01:00
vadimwit 7b669f8c11 feat(jamguide): piano tab live — per-station voice-led MiniPiano voicings (task L-11)
Piano is computed (pianoVoicingChain over canonical stations), no
authored KB needed; guitar path value-identical; tap-station guide-tone
contract intact; App.jsx untouched. Critic PASS (303/303 empirical
station checks across 3 progressions x 3 keys; voice-leading threads).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 17:01:55 +01:00
vadimwit 4b0f0c84a7 feat(audio): Web Audio voicing playback engine src/lib/chordAudio.js (task L-20)
playVoicing (piano.js absolute-note space, strummed, soft envelope),
guitarShapeToNotes (tab lists / open frets / movable rootStr+offsets via
the ChordDiagram convention), playChord pc fallback, stopAll. Dedicated
lazy AudioContext; zero coupling to the detection pipeline; mic-feedback
caveat documented. Critic PASS (19/19 independent pitch-math checks).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 17:01:40 +01:00
vadimwit 396c6ba562 ledger: seed sprint-knowledge-center (M-03) — user directive 2026-07-08
Playable voicings per chord, lick/technique cards, intermediate
progressions with level tags, Knowledge Center IA revamp; L-11 hold
lifted and carried forward; /jam-loop 30m x 24 iterations scheduled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 16:49:07 +01:00
vadimwit 4424e8d72c ledger: D-10/C-10/L-13 done (Critic PASS); L-11 held for user review; log iteration
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 11:00:44 +01:00
vadimwit 4727645bb9 fix(piano): dedupe duplicate absolute notes in pianoVoicing (task L-13)
A forced rootless sus2 collided the suspended-2nd and synthesized 9th onto one key
(notes [26,26,31]). Dedupe at the single funnel point ([...new Set(placed)]); pcs/bass
derived from the deduped array. No-op on default/chain path (L-11 render unaffected).
Critic: Set merges only identical absolute integers (same key) so no needed note is lost.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 11:00:43 +01:00
vadimwit f98528733d test(piano): smoke coverage for the piano voicing resolver (task C-10)
+705 checks (776 total): per quality x root x style, asserts pcs subset of voicingToneSet,
real 3rd present, true-7th when hasTrueSeventh, notes in [0,36], bass==min, no duplicate
absolute note, determinism, chain pcs-preservation. Surfaced the sus2 dup-note wart (fixed
by L-13). Critic adversarially confirmed the checks bite. Derived expectations, no hardcoding.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 11:00:41 +01:00
vadimwit fe49af36ac feat(piano): MiniPiano gains additive voicing prop for the Jam Guide (task D-10)
MiniPiano now dispatches: with a voicing={pianoVoicing(...)} prop it renders the
{notes,pcs,bass,style,label} on a 2-3 octave keyboard (root accent, bass amber-ringed,
thumb/full); without it, the legacy {rootPc,lh,rh} path is byte-unchanged so
ChordDetailModal + ExplorePanel render identically. Critic PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-16 11:00:40 +01:00
vadimwit 096e431157 ledger: seed sprint-jamguide-piano; L-10 done (Critic PASS); promote D-10/C-10; log iteration
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 19:05:45 +01:00
vadimwit e2a1552843 feat(piano): pure piano voicing resolver src/lib/piano.js (task L-10)
pianoVoicing({rootPc,quality},opts?) -> {notes,pcs,bass,style,label}: shells (1-3-7),
rootless A/B (3-5-7-9 / 7-9-3-5), root-position; opts.prev / pianoVoicingChain thread a
loop with octave voice-leading optimization. Helpers: hasTrueSeventh, voicingToneSet.
Pure, imports only theory.js. Critic PASS: 56 voicings (14 qualities x 4 styles), 0 wrong
notes, deterministic. New unimported module (no frontend impact yet) — D-10 renders it,
L-11 wires the piano tab.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-15 19:05:44 +01:00
63 changed files with 15482 additions and 636 deletions
+35
View File
@@ -0,0 +1,35 @@
{
"$comment": "Team-shared restricted options. Destructive/irreversible commands are DENIED so Claude proposes them for the user to run instead of executing them. Authoritative policy: see the 'Destructive operations — NEVER delete' section of CLAUDE.md.",
"permissions": {
"deny": [
"Bash(rm:*)",
"Bash(rmdir:*)",
"Bash(git branch -d:*)",
"Bash(git branch -D:*)",
"Bash(git branch --delete:*)",
"Bash(git push --delete:*)",
"Bash(git push -d:*)",
"Bash(git push origin --delete:*)",
"Bash(git push github --delete:*)",
"Bash(git push origin -d:*)",
"Bash(git push github -d:*)",
"Bash(git tag -d:*)",
"Bash(git tag --delete:*)",
"Bash(git remote remove:*)",
"Bash(git remote rm:*)",
"Bash(git reset --hard:*)",
"Bash(git clean -f:*)",
"Bash(git clean -d:*)",
"Bash(git clean -x:*)",
"Bash(git push --force:*)",
"Bash(git push -f:*)",
"Bash(git push --force-with-lease:*)",
"Bash(git checkout --:*)",
"PowerShell(Remove-Item:*)",
"PowerShell(rm:*)",
"PowerShell(del:*)",
"PowerShell(rmdir:*)",
"PowerShell(Clear-Content:*)"
]
}
}
+18
View File
@@ -2,6 +2,24 @@
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Destructive operations — NEVER delete (hard rule)
**Claude must never EXECUTE a destructive or irreversible command. Always ask, and hand the user the exact command(s) to run themselves.**
This covers (non-exhaustively):
- Deleting files/directories: `rm`, `rm -rf`, `rmdir`, `del`, `Remove-Item`.
- Deleting branches: `git branch -d` / `-D`, `git push --delete`, `git push <remote> :branch`.
- Deleting tags/remotes: `git tag -d`, `git remote remove` / `rm`.
- Discarding work: `git reset --hard`, `git checkout -- <path>`, `git clean -f`.
- Force-pushing: `git push -f` / `--force` / `--force-with-lease`.
- Dropping data: `DROP`, `TRUNCATE`, destructive migrations.
Instead: print the command(s) in a fenced block with a one-line note on what each does and what it affects, and let the **user run them**. Never run them yourself, even when the desired outcome is clear — `rm` and `-d` are **prompted, never executed**.
Leave regular branches alone (`main`, the active sprint branch) unless the user explicitly names them. Before calling any branch "stale", prove containment (`git branch --merged`, 0 unique commits) and report that evidence — do not act on it.
These are also enforced as `permissions.deny` rules in `.claude/settings.json` (defense-in-depth), but this behavioral rule is authoritative and covers cases the patterns can't.
## Commands
```bash
+267 -2
View File
@@ -7,7 +7,222 @@ The shared queue all agents read and write. Lifecycle and rules: [`PROTOCOL.md`]
---
## Active sprint: `sprint-jam-guide` (branch: `sprint-jam-guide`)
## Active sprint: `sprint-roulette-kb` (branch: `sprint-jamguide-piano` — runs CONCURRENTLY with sprint-one-screen below; hourly cron, file-locks keep them disjoint)
**Goal (user directive 2026-07-11):** "a 12h loop with one iteration per hour for adding more piano licks and knowledge base voicings, potentially including some sort of circle of fifths etc in the knowledge center. on top of that … one button that would be a random chord progression selection. a button up top 'jam roulette' and then select a genre (like we have jazz, blues rock etc) and then have a random key chosen and an interesting progression show up as a loop in the screen. it would fill in the loop section and a 4 bar progression or something so that everyone can see the key and the chords to be played with different voicing so they can start playing… then musicians can start playing and it continues from it."
**Loop:** `/jam-loop` hourly × 12 (12 h), started 2026-07-11. Engineering tasks that need one-screen's files are dep-blocked on C-50 — content tasks fill the early iterations. Weights: Professor 3, Muse 2, Luthier 2, Critic gate.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-07 | Seed `sprint-roulette-kb`; schedule hourly cron | maestro | done | — | `docs/agents/LEDGER.md` | seeded, cron created |
| C-60 | **Piano lick schema** (additive): licks today are guitar-tab-only — design the piano-lick shape reusing the bass-pattern language (per-note `deg` XOR typed `approach`, `beat`, `octave`, technique from a PIANO-appropriate vocab subset — decide which of the 8 words apply to keys and whether grace-note/roll style additions are needed; keep it validateable like C-41 did) in SCHEMA.md + validate-kb.mjs + smoke bite-test | quality | done | — | `src/data/kb/SCHEMA.md`, `scripts/validate-kb.mjs`, `scripts/smoke.mjs` | schema documented; validator enforces; existing KB green; smoke proves it bites |
| D-60 | **PianoLickCard** renderer — visual rhyme with LickCard's tab idiom but for keys (timeline + MiniPiano-style pitches or a degree ladder — pick per readability at strip size); playback via chordAudio like BassPatternCard. Must export `PIANO_TECHNIQUE_VOCAB` set-equal to the validator's (the dormant C-60 smoke guard activates on this file's existence). **Component only — LicksStrip wiring deferred (JamGuide.jsx reserved for one-screen L-50); wiring folded into C-61-era integration. Wiring DoD must include (D-60 gate): a shared sequencer-stop so BassPatternCard/PianoLickCard previews can't layer (each holds a private currentSeq today — impossible to trigger until both mount together)** | design | done | C-60 | `src/components/PianoLickCard.jsx` (new) ONLY — done `a7dbd6a` | renders every P-60 lick; playable; graceful empty/malformed |
| P-60 | Piano licks pack #1: 3-4 each for **jazz + blues** piano (C-60 schema; arithmetic-verified prose, the P-41 bar). **PASS first try** (`70263e2` — gate realized all 8 in two keys, 35/35 prose claims; dom7-heavy blues coverage accepted as musically right) | content | done | C-60 | `src/data/kb/jazz/piano.js`, `src/data/kb/blues/piano.js` | validator green; every lick playable as written |
| P-61 | Piano licks pack #2: 3-4 each for **gospel + rnb** piano. **Returned once (2026-07-11):** one false interval claim in rnb-quartal-slip tips ("each move a step" — actually skip-then-step); 42/43 checks passed. Fixed with the gate's own prescribed wording; Maestro verified the line against the gate's computed 3/2 motion (scoped re-gate waived — the fix IS the gate's pre-approved example) | content | done | P-60 | `src/data/kb/gospel/piano.js`, `src/data/kb/rnb/piano.js` | validator green |
| P-62 | KB voicings expansion: **pop piano cell** (next per kb-backlog) + audit `GUITAR_SHAPES` for qualities with <3 placeable shapes and author additions where idiomatic | content | done | — | `src/data/kb/pop/piano.js`, `src/data/kb/index.js`, `src/lib/voicings.js` (additive shapes only) | validator green; every new shape hand-verified (L-23 lesson: base-fret convention) |
| D-61 | **Circle of fifths** in the Knowledge Center: interactive SVG (12 keys around the circle, live/locked key highlighted, relative minor ring, diatonic chords on tap-free hover/inline, key-signature glyphs), mounted inside ExploreSection; educational copy in the app's voice. **Returned once (2026-07-11):** modal hub key signature wrong (A dorian showed ♮ while its chips show F♯ — all 4 dropdown modal modes affected; fix = derive the parent-major signature, teaching "A dorian = G major's notes") + preview flat/sharp spelling split; geometry/rings/tiers/a11y all passed 60/60. Fixed + re-gate PASS (`c999c95` — hub computed from SCALES set-equality, 72/72 uniqueness, one spelling authority) | design | done | — | `src/components/CircleOfFifths.jsx` (new), `src/components/ExplorePanel.jsx` (ExploreSection integration only) | renders any key incl. none-detected; follows effectiveKey live; tokens + AA; zero clicks for the core view |
| D-62 | **Jam Roulette UX spec** (doc): button up top ("Jam roulette", controls bar per one-screen's layout), genre picker (the 10 KB styles), randomization rules (random key; "interesting" progression selection — weight intermediate level + variety, avoid repeats within a session), how the seed fills the screen (seeds the committed loop + locked key so the banner/strip, voicing rail, licks, related progressions all populate exactly as if detected — reuse, don't duplicate), and the **detection handoff**: musicians start playing and live detection continues from the seed (spec the interplay with the L-31 commit layer: the seed behaves like a committed loop — replacement needs the same consistent evidence; New Song clears it) **Returned once (2026-07-11):** "matched by construction" false for 10/56 progressions — buildLoopIndex indexes RAW degrees while collapse changes name-sequence length (incl. blues-12bar: LIVE detection of a real 12-bar gets an empty JamGuide — pre-existing bug surfaced!); detector len-cap 8 makes collapsed 9-10 unconfirmable; round-trip empirical not constructional (blues-8bar loses to its own [V7,I7] alternation); funk-one-chord collapses to 2 names not 1; flag-1 timeline off by one (EVERY seed dies unguarded — guard even more necessary). Maestro direction: fix (a) — additively index collapsed forms in match.js (fixes live detection too); pool = empirical round-trip passers ∩ collapsed len 2-8. **Returned twice (2026-07-11):** round 2 verified fix-(a) construction/timeline/proofs sound but found the sweep protocol as written evicts all 8 two-name vamps (needs steady-state + all-offsets), behaviour-additive false in exactly one case (country-145 now self-attributes — an improvement, enumerate it), census 11 not 10, and the BASS plays path (BassGuideRows :530/:533) missed by the remap. Round-3 PASS (`see commit` — literal protocol implementation reproduced 4/56 failures + 52/56 pool + 11-census exactly; sourceIndex mechanism verified at current line numbers) | design | done | — | `docs/design/jam-roulette.md` | mechanism spec'd against the real App state (lockedKey, detectedProgression, progressionVoteRef); no state duplication; L-60 scope bounded |
| L-60 | Implement Jam Roulette per D-62 (App.jsx UI-state + seeding fn; the roulette button + genre menu; 🚨 audio contract grep-gated — seeding touches display state and the progression refs ONLY, never callbacks). Ride-alongs: pass `dense` to the heard-live VoicingBrowser in the rail (D-51 gate flag — same fragile pair fit in the fallback path); one-screen.md §7 "two-octave cells alone" sentence is stale by a few px (D-51 gate nit) | engineering | done | D-62, C-50 | `src/App.jsx` (+ per D-62 — re-lock at promotion) | one click → genre → key+progression fills the jam dashboard; detection continues from it; New Song clears; build + smoke green; contract grep clean |
| C-61 | Sprint-end sweep + PR #3 update (COMBINED — covers BOTH sprint-one-screen and sprint-roulette-kb in one comment) | quality | done | L-60, D-60, P-61, P-62, D-61 | (none — verification) | all green; PR updated — **BOTH SPRINTS COMPLETE** |
> Sequencing: C-60 ‖ P-62 ‖ D-61 ‖ D-62 are file-disjoint and ready now (none touch one-screen's locks). Then C-60 → {D-60, P-60 → P-61}, and D-62 + C-50(one-screen) → L-60. C-61 closes. Critic gates every task.
---
## Active sprint: `sprint-one-screen` (branch: `sprint-jamguide-piano` — continued; commits extend PR #3)
**Goal (user directive 2026-07-11, after testing integrated-glance — "i like it a lot, so i would like to make some alterations"):**
1. **The top block is too big** — "the chord view and the chord loop incl the instrument below is too big, it takes up too much space… this main view doesnt really add value." Compress the detection area and the instrument view.
2. **Kill the big now-playing chord** — "seeing the big chord 'now playing' in big is also unnecessary as you already see that one in the chords (loop) part." The loop chips already carry it (playhead chip).
3. **Rethink ProgressionSuggestions** — "the suggested progressions on the right are also almost useless… we need to rethink them in the form of SUGGESTED VOICINGS and the progressions we add relating to the loop." Replace the generic genre table with (a) the suggested-voicings rail and (b) KB-sourced progressions RELATED to the detected loop.
4. **Voicings on the right** — "i'd like to have the suggested voicings on the right side of the screen (the jam guide)." The Jam Guide rail becomes a right column. (Overrides D-40's rejected side-by-side alternative — user directive wins.)
5. **One screen** — "i wanna see the chords, the loop, the voicings, the progressions, the licks all on one screen, everything you need to follow the jam correctly."
6. **Jam mode / fullscreen (refinement 2026-07-11):** "it can still have a scroll down, but the main concept needs to be in one screen: potentially we add a fullscreen button so we can just show that when we are playing a jam… everything that is learning and behind the scenes etc you can keep below/scrollable but we need one main view for live jams where we see everything at once." The dashboard fits 100vh as a hard constraint; a fullscreen/jam-mode button shows only it; KnowledgeDock/Debug/Tuner (LoopStation per Muse's call) live below in normal mode.
Standing principles (memory): scroll > click; nothing duplicated; one global instrument selector; playhead highlights, never hides. Weights: Muse 3, Luthier 3, Critic gate. No cron this sprint — Maestro drives on notifications. ⚠️ Spend-limit risk: the account limit was hit 2026-07-10; first dispatch is the probe.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-06 | Seed `sprint-one-screen` | maestro | done | — | `docs/agents/LEDGER.md` | seeded |
| D-50 | One-screen dashboard concept doc: full-viewport grid at 1280×900 — LEFT: slim loop strip (banner without the big now-playing chord; playhead chip is the "now"), compact instrument view (decide the mechanism: height cap / reduced fret range / scale — honest about legibility), licks strip, related-progressions card; RIGHT column: the suggested-voicings rail (GlanceRail adapted to ~420-520px — decide cell strategy: recommended voicing prominent + gallery wrapped, sizes recomputed honestly per the D-40 corrected math); where LoopStation/collapsibles/KnowledgeDock land; what "related progressions" means computationally (KB-sourced: same style + level + degree-shape overlap with the loop — spec the ranking); narrow-viewport plan (columns stack); migration order with bounded L-50/D-51/L-51 scopes; ≥2 rejected alternatives. No user gate: pick strongest, record rationale. **Returned once (2026-07-11):** strip really ~92-96px (fix: spec p-4→p-2 trim); `sticky` rail geometrically inert in the flex row (zero travel — flick claims deleted, rationale re-grounded); §4 double-counted cell padding (piano pair actually fits TODAY by ~4px; D-51 premise → margin-hardening); +100 ranking term inherits the raw-vs-collapsed mismatch (collapse pairs before canonicalDegrees/T(p), coordinate with D-62 fix (a)). Layout/jam-view/scopes all held. Fixed + re-gate PASS (`d24bf35` — all budgets recomputed clean) | design | done | — | `docs/design/one-screen.md` | every component named incl. what's removed (big chord display, ProgressionSuggestions); honest space math (everything visible at 1280×900 with at most the licks/progressions row below a fold-flick); bounded scopes |
| L-50 | App restructure per D-50: grid columns, banner slimmed (big now-playing chord removed — ProgressionBanner edit), JamGuide rail moves to the right column, ProgressionSuggestions unmounted (file kept), instrument view compacted per doc, licks strip placed per doc. 🚨 App.jsx = layout/mounts/UI-state only, audio contract grep-gated. **PASS** (`800fd43`+`e58a7a6` — SSR 73/73; gate applied a sanctioned one-class legend restoration for non-compact byte-identity). Nits filed: dead currentChord prop on the banner mount (ride-along for L-51); strip chips are div-onClick (pre-existing a11y debt → backlog) | engineering | done | D-50 | `src/App.jsx`, `src/components/ProgressionBanner.jsx`, `src/components/JamGuide.jsx` (+ per doc — re-lock at promotion) | one-screen layout live; no duplicated info; jam view works both layers; build + smoke green; contract grep clean |
| D-51 | Rail right-column adaptation per D-50: GlanceRail/VoicingBrowser sizing for the narrow column (recommended-first cell strategy per doc), playhead highlight preserved, wrap never horizontal-scroll | design | done | D-50, L-50 | `src/components/GlanceRail.jsx`, `src/components/VoicingBrowser.jsx` (+ per doc) | rail readable at column width for guitar/piano/bass; zero clicks; build + smoke green — **PASS** (`see commit` — arithmetic verified to the built CSS; heard-live dense-pass flag folded into L-60's ride-alongs) |
| L-51 | RelatedProgressions component per D-50: KB-sourced, loop-relative (style + level + degree-shape overlap ranking per the doc's spec), replaces the old generic suggestions; mounts in the D-50 slot. **PASS** (`see commit` — scores recomputed independently, collapse counterfactual proven). Taste flag for the user: "same changes" links quality-mismatched same-root-motion relatives (ii-V-I ≡ I-IV-V) — spec-conformant; a "same motion" wording tweak is a one-word option | engineering | done | D-50, L-50 | `src/components/RelatedProgressions.jsx` (new) + mount slot per doc | shows genuinely related KB progressions for a live loop; honest empty state; build + smoke green |
| C-50 | Sprint-end sweep (PR comment consolidated into C-61's combined summary — Maestro call). Folded (L-51 gate): pin the two verified ranking scores + the no-collapse counterfactual as smoke checks; add a global-id-uniqueness assertion to validate-kb.mjs | quality | done | L-50, D-51, L-51 | `scripts/smoke.mjs`, `scripts/validate-kb.mjs` (additions only) | all green; ranking pinned; ids asserted unique — **PASS** (`see commit` — smoke 886, SSR 60/60, whole-sprint contract clean). **SPRINT sprint-one-screen COMPLETE** |
> Sequencing: D-50 first (everything hangs off it) → L-50 → D-51 ‖ L-51 (re-lock at promotion to enforce disjointness) → C-50. Critic gates every task.
---
## Active sprint: `sprint-dashboard-polish` (branch: `sprint-jamguide-piano` — continued; commits extend PR #3)
**Goal (user directive 2026-07-13, after running the one-screen build):** "this looks amazing" + six refinements to the live dashboard:
1. **Guitar: 4 options max** — "only have 4 guitar options visible so it would fit the screen without scrolling." Cap each chord's guitar gallery to ≤4 shapes (a musically-sensible top-4 selection rule; fewer is fine).
2. **Hidden-but-scrollable dark scrollbars** — "the scroll bars are not visible but it can scroll if we need to (make them black or something)." Thin/dark styled scrollbars, overlay feel; content still scrolls.
3. **Piano: 2×2 smaller keyboards** — "smaller keyboards so there would be 2×2 for each chord." The 4 pianoVoicing styles in a 2-col × 2-row grid of compact MiniPianos per chord.
4. **Remove play buttons** — "leave off the PLAY buttons, they take up a lot of space for no reason, no need to hear it." Drop every ▶ from the voicings rail (and the licks strip — Maestro extension, matching the stated glance-over-audio preference; also removes the shared-sequencer blocker so piano licks can wire in cleanly).
5. **Licks: uniform size + follow the instrument** — "the licks section should all have the same size and transform into piano when selected." Uniform card size; the strip follows the global GUITAR/PIANO/BASS selector — wiring the deferred PianoLickCard into the strip (bass → no licks / honest note).
6. **Related progressions: same-style bridge/chorus/modifications** — "i would also want bridge/chorus/modifications in the same style… say i select jam roulette with blues, then i want for that progression other options and not necessarily go into other styles." Same-style variations for the active/rolled loop. **User decided 2026-07-13: reuse existing KB same-style progressions (lightest option) — NO computed modifications, NO new authored sections, NO song forms (verse/chorus/bridge — KB has no section data and most progressions are complete forms; Maestro + user agreed not to fake it).** So L-72 ships the honest same-style variations. **NEW feature added same day** (user: "imagine we play Am C F, i'd like an alternative to that F… an option that says 'try this'… i want musicians to learn how they can make the jam more interesting"): a **per-chord "Try this" chord-substitution** surface — for a loop chord in the detected key/style, suggest a small curated set of alternative chords (relative sub, borrowed-minor colour, extension colour, a circle-of-fifths / secondary-dominant move) each with a plain-language WHY. Circle-of-fifths-informed where it applies (honest that not all subs are circle-adjacent). Keep it simple/learnable, not a reharm engine. → tasks D-73/L-73/L-74 below.
Standing principles (memory): scroll > click; nothing duplicated; one global instrument selector; playhead highlights; glance over audio. User is PRESENT — notification-driven, no cron. Weights: Muse 3, Luthier 3, Critic gate.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-08 | Seed `sprint-dashboard-polish` | maestro | done | — | `docs/agents/LEDGER.md` | seeded |
| D-70 | Rail + licks layout concept doc: (a) guitar ≤4 shapes with the selection rule (open + common movable, lowest-position-first — name it); (b) piano 4 voicings as a 2×2 grid of compact MiniPianos — pick the MiniPiano thumb scale that fits two side-by-side in the ~456px column interior and two rows within a sane row height, honest math; (c) all ▶ removed from the rail's guitar+piano cells AND the licks strip (name every removal site); (d) hidden-but-scrollable scrollbars — the mechanism (webkit ::-webkit-scrollbar thin + dark thumb, and Firefox scrollbar-width/color; overlay where supported) and WHERE it applies (the rail's overflow-y column, any inner scrollers); (e) licks: uniform card footprint (thumb size parity between LickCard and PianoLickCard) + the strip follows the global instrument (guitar→piano licks on PIANO; bass honest empty); (f) recompute the row heights + the 500px column budget with the new smaller cells; migration order with bounded L-70/L-71 scopes (keep them file-disjoint or serialize on JamGuide.jsx). No user gate: pick strongest, record rationale + ≥2 rejected alternatives | design | done (`3fdc72e`; final scope: play buttons OFF EVERYWHERE per user; guitar-4/2x2-piano/uniform-licks dashboard-scoped) | — | `docs/design/dashboard-polish.md` | every change specced with honest numbers; the 2×2 piano scale chosen + proven to fit; bounded impl scopes |
| L-70 | Implement the voicings rail per D-70: guitar ≤4, 2×2 smaller piano, ▶ removed, dark hidden scrollbars | engineering | done `aae69e8` (combined-gate PASS) | D-70 | `src/components/GlanceRail.jsx`, `src/components/VoicingBrowser.jsx`, `src/index.css` (scrollbar CSS) (+ per doc — re-lock at promotion) | rail matches the spec; no ▶; guitar ≤4; piano 2×2; scrollbars hidden+dark+functional; build + smoke green |
| L-71 | Implement the licks strip per D-70: uniform card size, follow the global instrument (wire PianoLickCard), ▶ removed | engineering | done `19b1a4f` (combined-gate PASS; L-74b `6885fc3` visibility fix too) | D-70 | `src/components/JamGuide.jsx` (LicksStrip), `src/components/LickCard.jsx`, `src/components/PianoLickCard.jsx` (+ per doc — re-lock at promotion) | licks uniform; piano licks show under PIANO; no ▶; bass honest; build + smoke green |
| D-72 | Same-style related-progressions design (user answer = reuse existing KB): decide the presentation — when a style is active, RelatedProgressions leads with same-style siblings reframed as "variations / sections to try in {style}" (labels/section framing that reads as bridge/chorus/variation without new content); how the active style is known (roulette seed carries it; live detection's match yields it — name the prop/source); whether cross-style entries stay as a secondary "other styles with these changes" section or are dropped when a style is locked; empty/edge states. Files disjoint from the rail/licks chain (RelatedProgressions.jsx only) → runs in PARALLEL | design | done | — | `docs/design/related-same-style.md` | presentation spec'd against the real RelatedProgressions/match.js; active-style source named; L-72 bounded |
| L-72 | Implement D-72: RelatedProgressions leads with same-style variations when a style is active; reframed labels; cross-style demoted/dropped per the doc. **Unblocked 2026-07-13** (no song forms). Resolutions: (finding-A) when a style IS locked, DROP the secondary cross-style section — same-style only, per goal #6 + the user's "not necessarily other styles"; keep cross-style ONLY when no style is locked (match.matched===false). (finding-B) null the role phrase when a same-style sibling shares NO transitions with the loop (no false "variation" claim — just name + level). Re-pin smoke §8 labels ('shares I7→V7'→'shorter form' etc.; scores stable) | engineering | claimed | D-72 | `src/components/RelatedProgressions.jsx`, `scripts/smoke.mjs` (§8 re-pin) | same-style-only when locked; honest cross-style only when unlocked; role phrase honest (finding-B); build + smoke green — **PASS** (`see commit` — findings A/B verified; gate added 2 durable smoke assertions, 893/893) |
| D-73 | **"Try this" chord-substitution feature** design (engine rules + UI): for a loop chord `{rootPc,quality}` in the detected key/style, a SMALL curated set (~3-4) of alternative chords — recommend the categories (relative/diatonic-third sub, borrowed-minor colour e.g. IV→iv, extension/colour e.g. maj7/add9/sus, a circle-of-fifths / secondary-dominant move) — each with a plain one-line WHY that teaches. Concrete worked examples for the user's AmCF case (both A-minor and C-major readings), arithmetically correct (the gate WILL recompute). The UI surface: where it mounts in the jam dashboard (per-station in the rail? a "Try this" line under the loop? — decide, keep it glanceable, tappable→ChordDetailModal), honest circle-of-fifths tie-in (a lens for the relative/neighbour subs, NOT claimed for borrowed/extension), edge states (no key / atonal), keep-it-simple (learnable, not a reharm engine). Use a SEPARATE component (disjoint from RelatedProgressions.jsx). No user gate: pick strongest, ≥2 rejected alternatives | design | done (returned once — 3 copy/plumbing fixes verified: chordRootPC→noteIndex circular-import, ♭6 flat spelling, mediant claim; rules all recomputed correct; `c2207ef`) | — | `docs/design/try-this-subs.md` | substitution categories + rules + why-copy spec'd and arithmetically honest; AmCF worked; UI surface + mount decided; L-73/L-74 bounded |
| L-73 | Substitution engine: `suggestSubstitutions({rootPc,quality}, keyInfo, opts?)` in `src/lib/theory.js` (additive) → `[{rootPc, quality, label, why, category}]` per D-73's rules + a smoke truth-table (expected subs for known chords/keys, sabotage-proven like the resolveDegree guard) | engineering | backlog | D-73 | `src/lib/theory.js` (additive), `scripts/smoke.mjs` | engine returns musically-correct subs for all 14 qualities in-key; smoke truth-table bites; build green | ← claimed 2026-07-13; **returned once** — Rule C self-suggested the sounding chord on 7th-chord inputs (Dm7→Dm7) + latent add9-on-minor mis-spelling; fixed + re-gate PASS (Dm7→[F], min7 sweep no add9, triad path intact, sabotage bites, 903/903); **done** `see commit`
| L-74 | "Try this" UI per D-73, with VARY/ROTATE (user decided 2026-07-13: "more surprising, more jam-like, keeps offering new ideas"): a new `TryThis.jsx` that, for the current playhead chord, shows ONE suggestion at a time (matches "try this" = a single nudge) and CYCLES to the next valid substitution each time the loop completes a pass (playhead wraps to station 0 — watch the position prop). Sequential cycling through the engine's ordered valid set (softest-first on first appearance) so the player eventually learns all options and never repeats until exhausted; a small "1 of N" / dot indicator; 0 subs → no card; 1 sub → static (no rotation). Tappable→ChordDetailModal; tokens/AA; glanceable. Supersedes D-73's static ≤4-chip display for the UI (engine/rules unchanged). Mount App.jsx-only in relatedSlot above RelatedProgressions (disjoint) | engineering | backlog | D-73, L-73 | `src/components/TryThis.jsx` (new), `src/App.jsx` (mount) | one fresh honest sub per chord, cycling each loop pass; zero-click; empties honest; build + smoke green | **done** `038fdfa` (Critic PASS — 2-pass rotation trace Dm→Fm verified, contract-clean)
| D-75 | **Related-area space layout** (user 2026-07-13, after seeing it — "we have enough space in that area… fit everything in one big screen"): (a) TRY THIS — show the current chord's up-to-4 substitutions SIDE BY SIDE (replaces the one-at-a-time rotation; user has seen rotation + prefers all-visible), each a small card = chord label + a mini instrument diagram of that chord's voicing (ChordDiagram guitar / MiniPiano piano, following the GLOBAL instrument selector; bass = honest simple) + a compact why + tap→ChordDetailModal; (b) SUGGESTED PROGRESSIONS (RelatedProgressions) — 2×2 grid instead of the vertical list. Honest space math for the LEFT column (~744px, wider than the 500px rail). Instrument prop threading for TryThis (App mount passes `instrument`). Bounded L-75/L-76 (disjoint: TryThis.jsx+App-mount vs RelatedProgressions.jsx) | design | ready | — | `docs/design/related-area-layout.md` | side-by-side try-this with per-sub diagrams + 2×2 related spec'd with honest column math; instrument-follow named; L-75/L-76 bounded |
| L-75 | Implement TryThis side-by-side + per-sub instrument diagrams per D-75 (drops the rotation; follows the loop/current chord; instrument-following diagram) | engineering | done `957ce88` (combined-gate PASS) | D-75 | `src/components/TryThis.jsx`, `src/App.jsx` (pass `instrument` to the mount — grep-clean) | up-to-4 subs side by side each with a playable-shape diagram in the current instrument; tap→modal; honest empties; build+smoke green |
| L-76 | Implement RelatedProgressions 2×2 grid per D-75 (same-style + cross-style sections in a 2-col grid using the left-column width) | engineering | done `e695716` (combined-gate PASS) | D-75 | `src/components/RelatedProgressions.jsx` | 2×2 layout; both sections adapt; no logic/scoring change; build+smoke green |
| D-76 | **Related-area v2** (user 2026-07-13, "one last change"): (a) VOICINGS RAIL — currently shows all loop stations when a loop matches, but only the SINGLE current chord in the heard-live/no-loop fallback (JamGuide railContent :373-424). User wants: ALWAYS show multiple chords' voicings, MOST RECENT FIRST — loop chords when matched (KEEP canonical order + a moving "now" playhead highlight — design call, reordering would break GlanceRail's between-adjacent voice-leading chips AND reshuffle rows every chord, contradicting the user's anti-jump preference; most-recent-first applies to the NO-LOOP history rail), else the recent distinct chord history (from chordHistory, cap ~6, most-recent-first). Never just one. **User confirm pending on the loop-ordering deviation (asked 2026-07-13).** (b) TRY THIS — cap at **3** suggestions (was 4); **STABLE fixed layout** (reserve 3 slots so 2-vs-3 subs never shifts position — the user: "annoying when the layout changes then u dont know where to look"); each suggestion shows **≥3 ways to play it** — guitar = **3×3** (3 subs × up to 3 getGuitarVoicings shapes each), piano = **1** MiniPiano each ("for piano it can be just one thats okay"), bass = root caption. Honest space math (left col ~744px for the 3×3 guitar; rail column for the multi-chord history). No user gate: pick strongest, ≥2 rejected alts | design | ready | — | `docs/design/related-area-v2.md` | rail always-multi-chord-most-recent-first spec'd; try-this 3-cap + stable-3-slot + 3-shapes-guitar/1-piano with honest math; L-77/L-78 bounded |
| L-77 | Voicings rail — HYBRID (user re-scope 2026-07-13): when a loop is found, HIGHLIGHT the loop chords as a "loop" group AND list the OTHER recent distinct chords from full chordHistory underneath ("also played"); when no loop, just the recent distinct history. Show **≥4 chords total** as soon as any chord history exists (top up from history to reach 4+). Loop group keeps canonical order + moving "now" playhead (voice-leading chips valid); history group most-recent-first, no chips. Each chord expands to its full voicing gallery (keep composition) | engineering | done `9415daf` (direct push per user) | D-76 | `src/components/JamGuide.jsx`, `src/components/GlanceRail.jsx` | loop highlighted + others underneath; ≥4 when history exists; no-loop → history ≥4 most-recent-first; galleries + focus preserved; audio contract untouched; build+validate+smoke green — **done** (GlanceRail +`showTransitions` prop (default true, byte-compat); JamGuide `recentDistinctChords`/`historyStations` memo + hybrid railContent; RAIL_TOTAL_CAP 8 / NO_LOOP_HISTORY_CAP 6; 903/903; only 2 locked files, contract-clean. Maestro folded 2 honesty fixes on shared GlanceRail: history group drops "the loop"/"playhead" framing; history rows non-focusable (no inert button). Full independent Critic gate waived per user "push when its done") |
| L-78 | Try-this per D-76: max 3 subs, stable 3-slot layout, 3 guitar shapes each (3×3) / 1 piano each | engineering | done `d543b98` (direct push per user 2026-07-13; verified build+validate+smoke 903/903 — full independent Critic gate waived for the push) | D-76 | `src/components/TryThis.jsx` (+ per doc) | ≤3 subs in fixed slots; guitar 3 shapes/sub; piano 1; layout stable 2-vs-3; reactivity preserved; build+smoke green |
| C-70 | Sprint-end sweep + PR update (BOTH gitea+github). Fold: drop stale ", each playable" from VoicingBrowser aria (:278/:314, combined-gate finding) | quality | backlog | L-70, L-71, L-72, L-74, L-75, L-76, L-77, L-78 | `src/components/VoicingBrowser.jsx` (aria one-liner) | all green; aria fixed; PRs updated |
> Sequencing (three parallel chains, file-disjoint): (A) D-70 → L-70 → L-71 (rail/licks); (B) D-72✓ → L-72 (related, same-style); (C) D-73 → L-73 → L-74 (try-this subs). ALL DONE except A's builds. **L-74b (2026-07-13, in-review):** TryThis loop-fallback so the card is visible for a rolled/detected loop without live input (user "i dont see rotating cards") — TryThis.jsx only, SSR-verified. **Batch plan:** L-70 ‖ L-71 ‖ L-74b (disjoint) → ONE combined gate (rail/licks + dock byte-identity + full-app SSR + contract) → commit all → push both remotes. C-70 closes.
---
## Shipped sprint: `sprint-integrated-glance` (branch: `sprint-jamguide-piano` — complete 2026-07-10, 4 iterations, PR #3 updated)
**Goal (user directive 2026-07-10, after testing the glance-mode sprint — "its already a lot better, but"):**
1. **Move it up & integrate** — "i would like to move it up and integrate it somewhat in the space of the main module up top. or maybe right below it as it is super important." The Jam Guide content is currently the LAST mount in App.jsx (line ~712); the main module (ProgressionBanner + instrument view) is at ~609-622.
2. **One loop display** — "i would like to be able to see the loop clearly, no need to have this repeated again. as its already in the main module." ProgressionBanner (top) and the Roadmap track (inside JamGuide) both show the detected loop — exactly one clear loop display must survive.
3. **One instrument selector** — "only one selection for GUITAR/PIANO/BASS and everything should show in that instrument." App.jsx line 58 ALREADY holds global `instrument` state ('piano'|'guitar'|'bass') driving the main views; JamGuide ignores it and has its own internal tabs. Everything (voicings, licks, guide) must follow the one selector. Bass has a main-view BassFretboard but zero KB content — needs an honest state (and a stretch chain to make it real).
4. **All chords' voicings visible at once** — "it's difficult to see as it changes when the chord is not playing so i'd like to see all the chords and their voicings in a specific way in case a loop is detected (or at least just like 4 chords or something at least, so you can follow and potentially learn new ways to play it while you are playing the loop." The playhead accordion (only the active station expanded) is hard to follow live — show EVERY loop station's voicings simultaneously (≥4 chords), playhead highlights rather than reveals.
5. **Scroll-first** — "scrolling is easier then clicking." Layout principle for everything above.
**Loop:** `/jam-loop` every 30 min for 12 h (24 iterations), started 2026-07-10 evening (cron 13,43). "let each agent do a part and revise the work" — standard ensemble + gates. Weights: Luthier 3, Muse 3, Professor 2, Critic gate.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-05 | Seed `sprint-integrated-glance`; schedule the 24×30m loop | maestro | done | — | `docs/agents/LEDGER.md` | seeded, cron created |
| D-40 | Integration concept doc: (a) where the Jam Guide content lands relative to the main module (in it vs right below — pick, record rationale); (b) which loop display survives (ProgressionBanner vs Roadmap track — the loser's unique value, e.g. guide-tone rails, must be honestly dispositioned); (c) JamGuide obeys App's existing global `instrument` — internal tabs retired; honest bass state until the bass chain lands; (d) the all-stations-expanded voicings layout (≥4 chords visible, playhead HIGHLIGHTS not reveals, scroll-first — the user explicitly licensed scrolling, so D-31's "everything expanded" rejection is overturned by directive); (e) what remains of the four-section dock below; (f) honest space math + migration order. No user gate: pick strongest, record rejected alternatives. **Returned once (2026-07-10):** piano worst-case Dm7-specific (G7 gallery ≈1,178px, roots above D need 2-octave crops → rows WRAP, screenful counts restated); LicksSection lives in JamGuide.jsx not ExplorePanel; ChordBox keeps importers (only RiffDiagram orphans); L-40 interim would ship the page-yank (GlanceRail scrollIntoView in page flow) — doc added the one-line effect deletion to L-40's lock, same-commit mandatory. Fixed + re-gate PASS (pixel-exact recompute: gallery 1,178, row 1,470, all table arithmetic verified) | design | done | — | `docs/design/integrated-glance.md` | doc names every component, the single-loop-display call, the instrument-threading contract, ≥2 rejected alternatives, bounded L-40/D-41 scopes |
| L-40 | App restructure per D-40: promote the Jam Guide content to the D-40 position; retire the duplicated loop display per the doc's call; JamGuide takes `instrument` as a prop from App's existing selector (internal tabs removed; VoicingsSection/LicksSection/ExplorePanel mounts follow too); honest bass empty-state. Ride-along (C-40 follow-up): add an export-only line to JamGuide's `resolveDegree` (JamGuide.jsx:73) so smoke §7 can sweep both copies directly (today it pins the validator side behaviourally). 🚨 App.jsx changes = layout/mount/UI-state ONLY — audio callbacks/refs/AudioCapture untouched (grep-gated) | engineering | done | D-40 | `src/App.jsx` (layout + UI-state only), `src/components/JamGuide.jsx`, `src/components/ExplorePanel.jsx` (VoicingsSection instrument prop), `src/components/GlanceRail.jsx` (scrollIntoView effect deletion ONLY, same commit as band promotion — D-40 §6.1) | one selector drives everything; guide content up top; loop shown exactly once; build + smoke green; audio contract grep-clean |
| D-41 | All-expanded voicings rail per D-40: every station's gallery visible simultaneously (≥4 chords), active station highlighted by the playhead (accent ring/header, NO reveal/hide), scroll-first reflow, licks strip follows the global instrument per the doc. **Folded (L-40 flag, 2026-07-10):** VoicingBrowser's `show` prop falls through unknown values to 'both' — the dock's VoicingsSection under bass passes show='bass' and renders BOTH galleries, violating D-40 §3 prose; fix in VoicingBrowser (honest bass empty-state or explicit 'bass' handling), lock extended accordingly. Also: bass row headers gain solo-scale/aim-dots here per D-40 row anatomy | design | done | D-40, L-40 | `src/components/GlanceRail.jsx`, `src/components/VoicingBrowser.jsx` (dense styling + show='bass' handling), `src/components/JamGuide.jsx` (row anatomy per doc) | all voicings of all loop chords on screen/scroll with zero clicks; playhead never hides content; AA + tokens; build + smoke green |
| C-40 | Drift guards in smoke (two hand-synced duplications, backlog debt): (a) JamGuide's `resolveDegree` copy vs validator's — 16-degree × 14-quality truth table; (b) technique vocab `validate-kb.mjs` LICK_TECHNIQUES ↔ `LickCard.jsx` TECHNIQUE_VOCAB. Ride-along: fix `scripts/loop-fixtures.mjs` header's stale "App.jsx:322-324" line-ref (C-31 sweep finding) | quality | done | — | `scripts/smoke.mjs`, `scripts/loop-fixtures.mjs` (comment only) | drift in either duplication turns smoke red (sabotage-proven); header ref current; smoke green |
| P-40 | Refresh `docs/kb-backlog.md`: mark all shipped cells done (gospel/pop guitar; jazz/gospel/rnb/blues piano), set the bass column as next (blues → jazz → funk per plan) | content | done | — | `docs/kb-backlog.md` | backlog reflects reality; next-cell pointer correct |
| C-41 | Bass play schema (additive): SCHEMA.md + validator + smoke bite-test for bass patterns (per-station patterns: root/fifth/approach-note walks — design the minimal honest shape with 4-string, fret 0-15 representation). Ride-along (C-40 gate finding): document in SCHEMA.md that `resolveDegree('7', maj6|min6)` = 9 (the 6th) in both hand-synced copies — a contract quirk, never misspells a chord, but authors should write `'6'` explicitly | quality | done | C-40 | `src/data/kb/SCHEMA.md`, `scripts/validate-kb.mjs`, `scripts/smoke.mjs` | schema documented; validator enforces; existing KB untouched-green; smoke proves the check bites |
| P-41 | First bass cell: **blues bass** (kb-backlog order blues → jazz → funk). C-41 gate notes: offset 11 (maj7 over qualities lacking it) is unrepresentable — if you hit it, STOP and report (schema extension, not workaround); approaches are terminal-only but mid-pattern passing tones are expressible as fixed degrees (b9/9/b3/11/b5/b13/6/b7 all covered) | content | done | C-41 | `src/data/kb/blues/bass.js`, `src/data/kb/index.js` | validator green; every pattern playable as written; prose arithmetic-verified |
| L-42 | Minimal bass pattern renderer for the guide (per-station BassPatternCard per D-40 §3; the computed root·fifth·approach line stays as fallback) — makes the BASS selector real end-to-end. C-41 gate note: `chrom-below` into a next root at open E has no pitch below the instrument — renderer must octave-displace the approach or place the root higher | engineering | done | C-41, P-41, L-40 | per D-40 doc — re-lock at promotion | bass stations render the authored patterns; guitar/piano paths untouched; build + smoke green |
| C-42 | Sprint-end sweep + PR #3 update per PROTOCOL §6. Folded (L-40 gate): wire smoke §7 to import JamGuide's now-exported `resolveDegree` (the jsx load hook already exists) and refresh the stale "unexported (checked 2026-07-10)" comment at smoke.mjs:855-862 — tiny Critic-owned fix inside the sweep | quality | done | L-40, D-41 | `scripts/smoke.mjs` (§7 wiring only) | all green; smoke sweeps both resolveDegree copies; PR updated |
> GATE 2026-07-10 (Critic) · **P-40 PASS** — validator totals verbatim-match; ALL 14 cell play-counts recounted from the real registry (sum 164 ✓); lick arrays counted per style (4/4/4/4/4/3 = 23 ✓); 10 dates cross-checked against ledger + git commits, all hold; diff +36/15 confined, format preserved. Non-blocking: piano next-cell = pop is a priority call (plan's default ranks bossa first — doc licenses reorder, accepted as Professor's call); L-42 row omits its L-40 dep (one word, fix if touched).
> Sequencing: D-40 ‖ C-40 ‖ P-40 file-disjoint, ready now. Then D-40 → L-40 → D-41 (App/JamGuide/GlanceRail serialized — same surfaces), and C-40 → C-41 → P-41 → L-42 (bass chain, stretch). C-42 closes. Critic gates every task.
---
## Shipped sprint: `sprint-glance-and-loop` (branch: `sprint-jamguide-piano` — complete 2026-07-10, 4 iterations, PR #3 updated)
**Goal (user directive 2026-07-10):** three asks, in the user's words:
1. **All voicing variations in one view** — "in the music theory … see all the variations G shape, C shape, etc in one view without having to push a button. so they all line up next to each other." VoicingBrowser currently chip-switches one shape at a time; replace with a gallery that renders every shape/style side by side, each independently playable.
2. **Fix the loop logic** — "it doesn't recognize when 3 chords return, or when its 5 and then 2 others." `detectRepeatingProgression` (theory.js) does exact contiguous block matching, lengths 26: one spurious misdetected chord breaks a rep; a 5-chord loop followed by 2 foreign chords (tag/turnaround) is missed; 78-chord loops can't be found at all. Redesign to be noise-tolerant; tune the App.jsx commit layer so a committed loop survives fills.
3. **Glanceable learn session** — "expand the learn session so we see as much as possible in voicing variations and styles without having to click buttons, the idea is to have it open as the jam is playing." Knowledge Center should auto-follow the live jam with zero clicks.
**Loop:** `/jam-loop` every 30 min for 12 h (24 iterations), started 2026-07-10 (cron 13,43). User is away — no user-gated tasks; Muse picks the strongest option and records rationale. Weights: Luthier 3, Muse 3, Professor 1, Critic gate, Herald 0.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-04 | Seed `sprint-glance-and-loop` from user directive 2026-07-10; schedule the 24×30m loop | maestro | done | — | `docs/agents/LEDGER.md` | sprint seeded, cron created |
| C-30 | Loop-detection truth fixtures: new `scripts/loop-fixtures.mjs` (+ smoke wiring) — realistic chord-history cases with expected loops: (a) clean 3-chord loop ×23 reps; (b) 3-chord loop with one spurious misdetection inside a rep; (c) consecutive duplicate commits of the same chord; (d) 5-chord loop followed by 2 foreign chords — loop must survive; (e) 7- and 8-chord loops; (f) section change loop-A→loop-B — detection must switch; (g) chromatic non-loop → null. Run each against the CURRENT `detectRepeatingProgression` and mark which fail today (`expectedFail: true`) so the suite is green now and L-30 flips the markers off | quality | done | — | `scripts/loop-fixtures.mjs`, `scripts/smoke.mjs` | fixtures runnable via smoke; failure map of the current algorithm documented in the fixture file header; smoke green (expected-fails annotated, not silently skipped) |
| L-30 | Redesign `detectRepeatingProgression` in `theory.js`: collapse consecutive duplicate chords before matching; tolerate ≤1 substitution/insertion per cycle (noise from misdetection); support loop lengths 28; recency-weighted scoring so an old section can't outvote the current loop; keep the pure signature, the rotation-`canonicalize` output, and every other export byte-untouched. Flip all C-30 `expectedFail` markers to passing. **C-30 findings folded in (2026-07-10):** (a) the `reps × len²` scoring artifact is the primary everyday bug — a clean 2-chord vamp ×4 reports a bogus 3-chord `[Am,Am,G]` via self-overlapping occurrences; candidate generation must reject candidates that are rotations/overlaps of a shorter period (not just exact periodic patterns at len ≥ 4); (b) 7/8-loops contain realistic non-adjacent internal chord repeats (`Am … Am`) — period detection must not collapse those into shorter false loops | engineering | done | C-30 | `src/lib/theory.js` (detectRepeatingProgression + private helpers only) | all C-30 fixtures green with zero expectedFail markers (incl. `vamp-2x4`/`vamp-2-sustained`); no other theory.js export changed; build + smoke green |
| L-31 | Commit-layer tuning in App.jsx's progression effect (lines ~154-173): a committed loop must survive transient misses (the miss-4-then-clear rule drops the loop during fills/turnarounds); a new loop replaces the old only with consistent evidence; first commit shouldn't need extra rounds when detection is already stable. **Primary trace case (C-30 finding, 2026-07-10):** pre-L-30 detection flaps between the true loop and ghost 4-patterns, so `progressionVoteRef` never sees 2 consecutive identical keys and nothing ever commits — verify post-L-30 stability makes the 2-vote commit reachable in the noisy fixtures, then tune (post-L-30 status: done). **L-30 gate findings folded in (2026-07-10):** (a) a 2-rep loop with one corrupted rep FLAPS through data-faithful sub-cycles commit-to-commit until the next clean rep — faster first-commit must NOT let a single transient sub-cycle detection replace an already-committed loop (replacement needs consistent evidence); note non-null detection resets the miss counter, so today's committed loop already survives the flap; (b) ride-along one-line fix: theory.js ~line 601-603 docstring overclaims "ghost occurs exactly once by construction" — false for same-chord-same-phase corruption (behavior fine, comment too strong); (c) deletions untolerated by design — fine at ≥3 reps, degrades to (a)'s flapping at exactly 2. 🚨 **Audio contract: touch ONLY the progression useEffect + its refs — no callback, ref-sync, or AudioCapture change** | engineering | done | L-30 | `src/App.jsx` (progression effect only) | loop survives fixture-style fills end-to-end (hand-trace documented in commit); App.jsx diff confined to the progression effect block; build + smoke green |
| D-30 | VoicingBrowser gallery: render ALL matching guitar shapes side by side (each = label + ChordDiagram + its own ▶) and all four piano styles side by side (label + MiniPiano thumb + ▶) — no chips, no selection state; grid wraps on narrow viewports; one-at-a-time playback preserved (new play stops the previous). All existing mounts (Voicings section, ChordDetailModal tabs, JamGuide station-enlarge) get the gallery automatically; `show` prop semantics unchanged | design | done | — | `src/components/VoicingBrowser.jsx` | every placeable shape/style visible simultaneously with zero clicks; AA contrast + tokens; keyboard-reachable play buttons; build + smoke green |
| D-31 | Glance-mode concept doc: the Knowledge Center panel open WHILE the jam plays — what auto-follows live detection with zero clicks (current station's voicing gallery inline? licks strip for the style? what stays on screen vs behind interaction), density/space budget vs the Roadmap track, narrow-viewport plan, and the migration order for L-33. No user gate: pick the strongest layout, record rationale + rejected alternatives. **Returned once (2026-07-10):** piano gallery width understated ~45% (2-octave crops for rootless 7th-chord voicings → ~940px not 640; scroll is the piano rail's normal state on most loops) + licks strip ~190px not 150 + 4 clarifying notes; layout itself held — fixed + re-gate PASS | design | done | — | `docs/design/glance-mode.md` | doc names every component to touch, the auto-follow rules, and honest space math (what fits at 1280×900 and at narrow) |
| L-33 | Implement glance mode per D-31 (`docs/design/glance-mode.md` — the "playhead accordion"): the station column at canonicalPos expands to the full D-30 gallery and advances with the playhead; licks strip below (level-filtered, token-boundary context match, strip-owned "fits — now" chrome, guitar licks under piano tab with honest heading); pin gesture inherits onFocusChord semantics; auto-follow never emits focus-chord and never auto-plays audio; piano rail EXPECTED to scroll (never assert one-row fits); follow the doc's 5-commit migration order | engineering | done | D-30, D-31 | `src/components/GlanceRail.jsx` (new), `src/components/JamGuide.jsx`, `src/components/VoicingBrowser.jsx` (optional additive `dense` prop only) | glance behaviours live per the doc; audio contract intact (App.jsx untouched or additive-only); build + smoke green |
| P-30 | KB expansion: **neo-soul/rnb piano** cell (next per `docs/kb-backlog.md` after jazz/gospel) | content | done | — | `src/data/kb/rnb/piano.js`, `src/data/kb/index.js` | validator green + registered; renders in the piano tab; prose claims arithmetic-verified |
| P-31 | KB expansion: **blues piano** cell. **Returned once (2026-07-10):** turnaround jump-kicks bars 3-4 dyad orientations flipped (breaks the play's own only-leap law — gate pre-verified the exact swap) + 2 prose rewordings (♭7 "unmoved all night" contradicted by bar 9; "octave-and-change" actually a major 7th) — fixed + re-gate PASS | content | done | P-30 | `src/data/kb/blues/piano.js`, `src/data/kb/index.js` | validator green + registered |
| C-31 | Sprint-end sweep: full build + validator + smoke + fixtures, then update PR #3 (push + PR body/comment summarising this sprint) per PROTOCOL §6 | quality | done | L-31, L-33, D-30 | (none — verification) | all green; PR #3 updated |
> Sequencing: C-30 ‖ D-30 ‖ D-31 ‖ P-30 are file-disjoint and ready now. Then C-30 → L-30 → L-31 (serial chain on theory.js/App.jsx), and D-30+D-31 → L-33. P-31 fills spare iterations. Critic gates every task.
> GATE 2026-07-10 (Critic) · **D-30 PASS** (`0945a08`) — scope confined to VoicingBrowser.jsx; build green, smoke 809/809, validator green. SSR of the real component (Cmaj7/G7/Asus2/F#m7 × show variants): guitar cell count === independently re-derived matchingShapes count (4/4/3/3), all four piano labels honest, ZERO chips/aria-pressed (button count === cell count), every ▶ aria-labeled chord+voicing, rootPc badge guard proven (rootless voicings show 0 R badges, root/shell exactly 1; buggy variant rendered + diffed = absent), show prop scoping correct, E-add9 empty state graceful. Playback single-handle verified by read. *Non-blocking:* thumb-size diagrams drop finger numbers → backlogged.
> GATE 2026-07-10 (Critic) · **C-30 PASS** — smoke 809/809 exit 0 with 8 annotated expected-fails (printed with today/contract values, never skipped); validator + build green. Failure map independently recomputed against the real function: vamp-2x4 self-overlap 2×3²=18 > pair 4×2²=16 → bogus `[Am,Am,G]` ✓; spurious-substitution ghost 4-pattern 2×16=32 > true 3×9=27 ✓; section-change stale-A 48 > 27 ✓; five-plus-tag genuinely passes pure-function (L-31 attribution honest) ✓. Sabotage ×3: broken guard → exit 1 named; stripped expectedFail → exit 1; stale marker → exit 1 with explicit STALE message — none can rot silently. `canonicalLoop` replica byte-equivalent to theory.js's private `canonicalize` + load-time self-check. clean-2x3 vs vamp-2x4 pins the exact boundary where the len² artifact kicks in. Nit (non-blocking): fixture header line 25 says `[Am,G,Am]` vs comment `[Am,Am,G]` — same loop pre/post canonicalization. NOTE: the transient smoke red the D-31 gate reported (`clean-3x3`) was this gate's own sabotage edit (a) running concurrently — tree restored, verified clean.
> GATE 2026-07-10 (Critic) · **D-31 RETURNED → PASS on scoped re-gate** — first gate verified the playhead-accordion layout, the App.jsx-zero-changes claim (all 7 props already flow; pin inherits selectedStation semantics incl. reset effects), chordContext data support, and the vertical budget (256px at 1280×900 recomputed from real component geometry) but returned one arithmetic finding: expanded piano gallery ~640px understated ~45% (rootless A/B of true-7th chords → 2-octave D-24 crops = 266px thumbs) + licks strip 150→190px. Muse fixed: 940 / 13501550 (scrolls at ~1200, not "borderline") / 2300 / 3,500+ / 190 / 1070, "scroll is the piano rail's normal state on most loops", commit-5 must never assert one-row-fits, + 4 notes (token-boundary chordContext match; strip-owned "fits — now" chrome; guitar licks under piano tab stated; licksFor "lifted not reused"). Re-gate recomputed Dm7 rootlessA [17,21,24,28] → 266px from piano.js/MiniPiano.jsx, grep-verified no stale figures, no regression to passed sections. Nuance (non-blocking, for L-33): "any true-7th chord" slightly overgeneral — some rootless voicings fit 1 octave (e.g. Dm7 rootlessB); 940 is the correct conservative worst case.
> GATE 2026-07-10 (Critic) · **P-30 PASS first try** (`b51daa1`) — validator 154 plays green, build green, shared-tree smoke 817/817. Independent arithmetic (own script from SCHEMA/CHORD_TYPES, not Professor's): max per-hand span 11 (≤15), ≤4 notes/hand, combined span ≤23 → every recipe renders for all 12 roots in the 36-key window (zero silent fallbacks); 11 hand-picked prose claims all recompute exactly (♭VI→V sink 1,1,1,1,2; 9sus RH = major triad on ♭7; So What [0,5,10,15,19]; I-RH ≡ vi7-RH pcs; 13sus = Type A bottom+1; ...). Rule-4 idiomatic difference genuine per pair; outside-key 9-on-iii honestly flagged; sources hedged. One chased-and-accepted oddity: ♭VI13 stab's CFG♭ pinch is deliberate voice-leading, not a stacking bug.
> GATE 2026-07-10 (Critic) · **L-30 PASS** (`4cc0009`) — smoke 817/817 (all 17 fixtures plain guards, 9 original greens no regression), validator + build green. Diff confined: theory.js 2 hunks in the repeating-progression section only, `canonicalize` unchanged context; loop-fixtures.mjs = marker removals + historical rewordings, every history/expect array untouched (frozen contract intact). 15 novel generalization probes: 11 correct, 3 data-faithful (only phase-locked exactly-alternating corruption yields a doubled pattern — genuinely 6-periodic data no algorithm could distinguish), 1 better-than-expected (all-reps-edited loop found via clean rotation). Every reportable "ghost" now corresponds to a pattern that exactly recurred — the old structurally-fake ghosts are gone. Perf 0.210.73 ms/call ×1000. Consumer contract at App.jsx:154-173 type-matches. 3 non-blocking findings folded into L-31's row.
> GATE 2026-07-10 (Critic) · **L-33 PASS** (`see commit`) — build green, smoke 817/817, validator green; diff exactly the 3-file lock (App.jsx/theory.js diffs attributed to L-31). SSR of the real JamGuide 37/37: expanded-column cell counts == independently derived shape counts (dom7@G=4, min7@D=4), aria-current one-per-list, mic microcopy exactly once (dense suppresses per-mount copies), pin semantics diffed line-by-line identical to old selectedStation (deps + emit/clear), GlanceRail imports no chordAudio + auto-follow has zero focus/audio side effects (scrollIntoView reduced-motion-guarded), heard-live + nothing-heard paths correct. Token matcher proven through the real render on a hostile country I-vs-I7 case (3 fits not 4) + full 23-lick chordContext audit — no false positive possible; exotic glyphs (♯/°/ø) outside the char class fail conservative (miss, never false-fit). `dense`-less VoicingBrowser SSR **byte-identical** to committed 0945a08. Zero-click audit: all variations + all licks in initial markup. Deviations accepted (staging cosmetic; heard-live licks strip musically right). Non-blocking: first-mount scroll on unknown playhead benign; LicksStrip perf fine unmemoized. Committed `c78baf4`.
> GATE 2026-07-10 (Critic) · **L-31 PASS** (`ce24d54`) — 🚨 audio contract CLEAN: 1 hunk in the progression useEffect, contract-grep zero hits, no ref-sync/mount props; theory.js ride-along comment-only (verified zero executable lines). Independent re-trace with own mirror + real detector: spurious-substitution commits #7 zero drops; section change replaces with zero intermediate nulls; breakdown first-null at foreign-commit 28 (comment's "~28" numerically exact) and clears at exactly 6 nulls; 2-rep flap survives with rival counter provably reset. HOSTILE-1 proved REPLACE_VOTES=3 load-bearing (rival hit 2 before agreement reset — 2 would displace-and-flap); alternating rivals never accumulate; newSong null-shape defensively handled. Build/smoke 817/817/validator green. 2/3/6 judged musically sensible; v-a commit-then-upgrade UX accepted over blank display. Non-blocking: "consecutive" comment nuance (nulls are neutral, not resetting — amend to "consecutive non-null" if ever touched); threshold consts re-created per render (trivially cheap, hoisting would exceed the lock); Luthier's +53/12 was arithmetic sloppiness for +47/6.
> GATE 2026-07-10 (Critic) · **P-31 RETURNED → PASS on scoped re-gate** (`81cd230`) — first gate verified 90%+ of the pack exactly (♭VI7→V7 five-voice plane numerically perfect; all spans 11/4/22 legal; all 96 recipes render for 12 roots; rule-4 contrasts genuine) but returned 3 findings: jump-kicks bars 3-4 dyad orientations flipped (broke the play's own only-leap law; gate pre-verified the exact swap), "unmoved all night" contradicted by bar 9's own note, "octave-and-change" = actually a major 7th (11 semitones). Professor applied all 3; re-gate recomputed the lap chain from scratch: E4,B♭4 → G4,D♭5 → F4,C5 → F4,B4 → E4,B♭4 — "only leap" now provably unavoidable (all pairwise pc distances = 3), validator 164 plays / smoke 817/817 / build green, no fourth edit area.
---
## Shipped sprint: `sprint-knowledge-center` (branch: `sprint-jamguide-piano` — complete 2026-07-09, PR #3)
**Goal (user directive 2026-07-08):** revise the **visual structure of the Knowledge Center** — today's knowledge lives in three disconnected surfaces (JamGuide/Roadmap, ExplorePanel, EducationPanel). Four user asks, verbatim priorities:
1. **Playable voicings per chord** — browse *and hear* alternative voicings for any chord (guitar shapes + generated piano voicings), with simple switching.
2. **Simple ways of seeing techniques for licks** — lick cards with technique markers (hammer-on, slide, bend…), per style.
3. **Intermediate-level progressions** — research them and find the *easiest* way to surface them in-app (level tags + filter, not a new panel).
4. **Keep expanding music knowledge** — continue KB cells per `docs/kb-backlog.md` in spare iterations.
**Loop:** `/jam-loop` every 30 min for 12 h (24 iterations), started 2026-07-08. User is away — no user-gated tasks this sprint; where the old sprint would have asked (concept selection), Muse picks the strongest option and records the rationale in the concept doc. Weights: Muse 3, Luthier 3, Professor 2, Critic gate, Herald 0.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-03 | Seed `sprint-knowledge-center` from user directive 2026-07-08; carry L-11 forward (hold lifted — user asked to continue on this branch) | maestro | done | — | `docs/agents/LEDGER.md` | sprint seeded, loop scheduled |
| L-11 | Wire piano into `JamGuide.jsx`: Piano tab active; per station render `MiniPiano voicing={…}` from `pianoVoicing`/`pianoVoicingChain`; keep the guitar path intact. **Carried from piano sprint; user hold lifted 2026-07-08** | engineering | done | — | `src/components/JamGuide.jsx` | piano tab shows per-station keyboards synced to the loop; guitar unchanged; build + smoke green |
| D-20 | Knowledge Center concept doc: one unified IA for JamGuide (live) + ExplorePanel (browse) + EducationPanel (learn) — sections *Jam Guide / Explore / Voicings / Licks & Techniques*, where the voicing player and lick cards mount, level-filter placement, narrow-viewport plan. **No user gate: pick the strongest layout, record rationale + rejected alternatives in the doc** | design | done | — | `docs/design/knowledge-center.md` | doc names every component to touch, the target structure, and the migration order for L-22; honest about what stays untouched |
| L-20 | `src/lib/chordAudio.js` — Web Audio voicing playback: `playVoicing(notes, {strumMs, durMs})` (piano `notes` are absolute 036 above C3; also accept guitar `{string,fret}` arrays via a midi mapper), own `AudioContext` created lazily on first user gesture, simple triangle/partials envelope, `stopAll()`. **Must not touch the detection pipeline's contexts**; document mic-feedback caveat (playback may be heard by detection) | engineering | done | — | `src/lib/chordAudio.js` | pure module + tiny API; no import from AudioCapture/App; plays a Cmaj7 shell audibly in dev; build green |
| D-21 | `VoicingBrowser.jsx` — for `{rootPc, quality}`: guitar alternatives (all matching `voicings.js` shapes via `ChordDiagram`) + piano alternatives (`pianoVoicing` root/shell/rootlessA/rootlessB via `MiniPiano voicing`) as switchable chips, each with a ▶ button calling `chordAudio`. Note (D-20 gate): `GUITAR_SHAPES` is private — lock includes an **export-only** line in `voicings.js`; do not cite the D-20 doc for small-text AA on active chips (use surface-background rule) | design | done | L-20 | `src/components/VoicingBrowser.jsx`, `src/lib/voicings.js` (export-only) | renders + plays all styles for any KB quality in any key; design tokens; AA contrast; keyboard-reachable |
| L-21 | Integrate VoicingBrowser: `ChordDetailModal` (replace/extend its static voicing grids) + JamGuide station-enlarge view — tap any chord anywhere → browse + audition voicings | engineering | done | D-21, L-11 | `src/components/ChordDetailModal.jsx`, `src/components/JamGuide.jsx` | both entry points work; legacy modal content preserved where not superseded; build + smoke green; audio-callback contract intact (App.jsx untouched or additive-only) |
| C-20 | Schema + validator + smoke for the two new KB shapes (both **optional/additive**): (a) `level: 'foundation'\|'intermediate'` on progressions; (b) per-style `licks``{id, name, level, chordContext, techniques[]}` from a fixed technique vocab (hammer-on, pull-off, slide, bend, double-stop, ghost-note, chromatic-approach, vibrato) + `tab: [{string, fret, technique?}]` ordered notes. Existing KB stays green untouched | quality | done | — | `src/data/kb/SCHEMA.md`, `scripts/validate-kb.mjs`, `scripts/smoke.mjs` | validator enforces the vocab + tab shape when present; 10-style KB still green; smoke still 776+ green |
| P-20 | Intermediate progressions: research per `docs/progression-repertoire.md`, then tag existing KB progressions with `level` and author **2 new intermediate progressions each** for jazz, gospel, neo-soul/rnb (secondary dominants, chained ii-Vs, backdoor, borrowed iv…) with guitar plays | content | done | C-20 | `src/data/kb/**` (progressions + guitar files of jazz/gospel/rnb), `src/data/kb/index.js` | every progression carries `level`; 6 new intermediate progressions validator-green; tips written for the "confident enough to jam" player (GOAL Part 2 audience) |
| P-21 | Licks pack #1: author 34 licks each for **blues, jazz, funk** guitar using the C-20 lick schema — technique tags, chordContext (which station/quality it fits), honest attribution | content | done | C-20, P-20 (done) | `src/data/kb/blues/guitar.js`, `src/data/kb/jazz/guitar.js`, `src/data/kb/funk/guitar.js` | validator green; every lick playable as written (Critic hand-checks fret/string sanity) |
| L-23 | Fix latent `getGuitarVoicings` bug (found by L-20): `strIdx = shape.rootStr - 1` indexes `OPEN` (ordered s6…s1) wrongly — rootStr 5 reads the B string's pc, rootStr 4 reads G's; A-shape C major computes fret 1 instead of 3. Use the ChordDiagram convention `6 - rootStr`. Affects fret labels in ChordDetailModal/ExplorePanel/CurrentJamPanel for rootStr 4/5 movable shapes; ChordDiagram itself is correct. Also fix the `playChord` docstring octave example in `chordAudio.js` (Critic nit) | engineering | done | — | `src/lib/voicings.js`, `src/lib/chordAudio.js` (docstring only) | A-shape/C-shape fret labels correct (hand-verify 3 shapes × 2 keys); build + smoke green |
| D-22 | `LickCard.jsx` — tab-style SVG lick renderer: ordered notes on a string×fret window, technique glyphs (h, p, ⌒ slide, ↑ bend), compact card + technique legend; graceful on empty/malformed | design | done | C-20 | `src/components/LickCard.jsx` | renders every P-21 lick; glyph legend readable at card size; tokens; AA contrast |
| L-22 | Knowledge Center shell per D-20: restructure how JamGuide/ExplorePanel/EducationPanel mount into the unified IA; add the **level filter chip** (foundation/intermediate) wherever progressions list; mount Licks section (LickCard grid per style) | engineering | done | D-20, D-22, P-20, P-21 (licks commit may land empty-state-first per the D-20 doc). Ride-along polish (D-22 gate nit): LickCard stack-collision guard should check all same-column notes, not just prev (`LickCard.jsx:100`) | `src/components/JamGuide.jsx`, `src/components/ExplorePanel.jsx`, `src/App.jsx` (mount only) | unified structure live; level filter works; licks browsable per style; audio contract intact; build + smoke green |
| P-22 | KB expansion: **jazz piano** cell (first piano cell per `docs/kb-backlog.md`) — authored comp voicings override computed where they add signature value | content | done | L-11 | `src/data/kb/jazz/piano.js`, `src/data/kb/index.js` | validator green + registered (SCHEMA "Piano play" recipes); **rendering the authored pack is L-24, not this task** — status: done |
| C-22 | `checkPianoRecipe` span check: enforce SCHEMA rule 3 (each hand ≤ a 10th = 15 semitones) in the validator so future piano cells don't rely on hand-verification (P-22 gate follow-up) | quality | done | P-22 | `scripts/validate-kb.mjs`, `scripts/smoke.mjs` | span violation fails validator; existing KB green; smoke proves the check bites |
| D-23 | VoicingBrowser `show="guitar"\|"piano"\|"both"` prop (default both — zero change for existing mounts) + LickCard stack-collision guard checks ALL same-column notes not just prev (D-22 gate nit, `LickCard.jsx:100`) | design | done | D-21, D-22 | `src/components/VoicingBrowser.jsx`, `src/components/LickCard.jsx` | prop-gated rows; all existing mounts render identically with no prop; guard fixed; build + smoke green |
| L-25 | ChordDetailModal Guitar/Piano tabs pass `show="guitar"`/`show="piano"` to VoicingBrowser (JamGuide station-enlarge + Voicings section keep both rows) | engineering | done | D-23 | `src/components/ChordDetailModal.jsx` | tabs show only their instrument's row; build + smoke green |
| D-24 | MiniPiano voicing-path compact window: crop the keyboard to the voicing's octave span (+1 key padding each side) so Jam Guide station thumbs aren't ~390 px (L-11 gate observation); `size="full"` and the legacy lh/rh path byte-unchanged | design | done | D-10 | `src/components/MiniPiano.jsx` | thumbs materially narrower for ≤1-octave voicings; root/bass marks intact; legacy consumers render identically; build + smoke green |
| P-24 | Licks pack #2: 34 licks each for **rock, country, reggae** guitar (C-20 schema; same bar as P-21 — playable as written, honest sources) | content | done | C-20, P-21 | `src/data/kb/rock/guitar.js`, `src/data/kb/country/guitar.js`, `src/data/kb/reggae/guitar.js` | validator green with ~21+ licks; every note serves its chordContext (Critic verifies) |
| L-24 | JamGuide piano branch prefers an authored piano pack (SCHEMA piano recipes) over computed `pianoVoicingChain` when the style has one; fall back to computed otherwise. Recipe→notes convention: order inside each hand = voicing order low→high (documented at `jazz/piano.js:14`) | engineering | done | P-22, L-22 | `src/components/JamGuide.jsx` | jazz piano stations render the authored comp; other styles keep computed voicings; build + smoke green |
| P-23 | KB expansion: **gospel piano** cell | content | done | P-22 | `src/data/kb/gospel/piano.js`, `src/data/kb/index.js` | validator green; renders in the piano tab |
| C-21 | Sprint-end sweep: full build + validator + smoke, cross-browser sanity notes, PR body draft summarising the sprint for `main` | quality | done | L-21, L-22, P-21 | (none — verification) | all green; PR body ready |
> Sequencing: L-11 ‖ D-20 ‖ L-20 ‖ C-20 are all file-disjoint and ready now. Then D-21 → L-21, and P-20/P-21/D-22 → L-22. P-22/P-23 fill spare iterations. Critic gates every task as usual.
---
## Shipped sprint: `sprint-jamguide-piano` (branch: `sprint-jamguide-piano` — piano resolver phase complete; L-11 carried into the sprint above)
**Goal:** extend the shipped Roadmap Jam Guide to **piano** (guitar→piano→bass roadmap). When the Piano instrument tab is selected, each Roadmap station shows a *generated* piano voicing on a mini-keyboard — voicings computed from the progression's `degrees`+`qualities` (GOAL G4: generate piano voicings from interval recipes; no authored data needed for the MVP). Branch cut off `sprint-jam-guide` HEAD. Weights: Luthier 3, Muse 2, Critic gate.
| id | title | domain | status | depends-on | files (lock) | definition of done |
|----|-------|--------|--------|-----------|--------------|--------------------|
| M-02 | Cut `sprint-jamguide-piano` branch off `sprint-jam-guide`; seed sprint | maestro | done | — | (branch) | branch cut, ledger seeded |
| L-10 | `src/lib/piano.js` — pure piano voicing resolver: `pianoVoicing({rootPc, quality}, opts?)` → shell (1-3-7), rootless A/B (3-5-7-9 / 7-9-3-5), root-position; picks the inversion minimizing movement from a previous voicing (voice-leading); returns absolute key positions + pcs + a label | engineering | done | M-02 | `src/lib/piano.js` | pure fns; correct tones for all 14 CHORD_TYPES; voice-leading-minimal vs a prev voicing; build + smoke green; output shape documented for D-10/L-11 |
| D-10 | **Extend** existing `src/components/MiniPiano.jsx` (already imported by `ChordDetailModal`/`ExplorePanel` via `{rootPc, lh, rh}`) with an ADDITIVE `voicing` prop that renders a `pianoVoicing` output (`{notes,pcs,bass,style,label}`) on a 23 octave keyboard — root in accent, bass marked, thumb/full sizes; **legacy lh/rh path unchanged** | design | done | L-10 | `src/components/MiniPiano.jsx` | renders any `pianoVoicing` in any key; **ChordDetailModal + ExplorePanel render identically (legacy path untouched)**; build green; design tokens; AA contrast |
| L-11 | Wire piano into `JamGuide.jsx` | engineering | **carried → sprint-knowledge-center** | L-10, D-10 | — | see the active sprint table above (hold lifted by user 2026-07-08) |
| C-10 | Extend `scripts/smoke.mjs`: assert `pianoVoicing` returns a valid voicing for every KB quality (no crash, notes in range, contains the chord's defining tones); also assert no duplicate absolute note across styles (the sus2 forced-rootless nit from L-10 gate) | quality | done | L-10 | `scripts/smoke.mjs` | smoke covers the piano resolver; exits non-zero on regression — **currently red (1/776): surfaces the sus2 dup-note nit → L-13 fixes the resolver** |
| L-13 | Resolver dedupe: `pianoVoicing` must never emit a **duplicate absolute note** (sus2 forced-`rootlessB` collides pc2 → `notes=[26,26,31]`). Drop/merge collided notes so every voicing's `notes` are distinct; keep `pcs`/`bass` valid; default + chain paths unchanged | engineering | done | L-10 | `src/lib/piano.js` | no duplicate absolute note for any quality×style; C-10 smoke goes green (776/776); build green; existing 56-voicing correctness preserved |
> Piano authored packs (signature comps overriding computed voicings) are deferred to a later sprint — computed voicings suffice for the piano MVP.
---
## Shipped sprint: `sprint-jam-guide` (branch: `sprint-jam-guide`, PR #2 — complete)
Emphasis this sprint: **ship the Jam Guide MVP** (put the 8 guitar style packs on screen, synced to live detection) + **reframe the repo as a learning platform**. Weights this sprint: Luthier 3, Muse 3 (design-heavy), Professor 2, Herald 2, Critic gate.
@@ -49,13 +264,37 @@ Emphasis this sprint: **ship the Jam Guide MVP** (put the 8 guitar style packs o
> GATE 2026-06-15 (Critic) · **C-01 PASS** — `node scripts/smoke.mjs` → `✓ Smoke test passed — 71/71 checks green (10 styles, 50 progressions)`, exit 0; reports the FULL final KB (10 styles, derived from the loaded registry, not hardcoded). Imports the REAL `kb/index.js` + `match.js` (no mocks); asserts registry integrity (every style meta/progressions[]/instruments.guitar, per-prog degrees/qualities/rn/bars consistency, cross-KB id uniqueness) and matcher correctness (iiVI matched:true + structural rebased-degree-shape check, rotation invariance to the SAME derived id with non-zero rotation, axis match guarded with skip-if-absent, chromatic → matched:false/id:null, findLoopPosition in-range/-1/-1-on-empty). Exits non-zero on failure (mirrors validate-kb). **Adversarial proof**: sabotaged `matchLoopToProgression` to always return no-match → smoke FAILED 4 checks, **exit code 1** (assertions are NOT too weak — a broken matcher cannot pass). match.js restored, no diff. **Resolve hook judged SOUND**: the inline `module.register` ESM hook retries ONLY on `catch`, ONLY for relative+extensionless specifiers (`/^\.{1,2}\//` && `!/\.[mc]?js$/`) — verified the regex skips `./theory.js`, `react`, `node:url`, `./a.mjs` and retries only `./theory`/`../lib/match`; it cannot mask a genuine missing module (the `.js` retry itself surfaces the real ERR_MODULE_NOT_FOUND). Correctly chosen over editing match.js (locked to L-01). **No npm script added** (validate-kb has none) — `package.json` untouched (git: only `src/data/kb/index.js` is modified; smoke.mjs/pop/CONTRIBUTING/templates are new untracked). No hardcoded fragile ids — expected ids derived from the loaded KB; survives KB growth.
> GATE 2026-06-15 (Critic) · **D-03 FAIL (returned)** — build green (vite, 90 modules, 10.66s); validator green (`✓ KB valid — 10 style(s), 50 progressions, 100 plays`, no KB change). 🚨 **Audio contract INTACT**: `git diff -- src/App.jsx` is purely additive — exactly (a) one new `useState(jamFocusChord/null)` placed in the UI-state block (outside all audio-callback/ref logic, with a comment that it is not read by any callback), (b) `jamFocusChord={jamFocusChord}` on the existing `<Fretboard>` mount, (c) `onFocusChord={setJamFocusChord}` on the existing `<JamGuide>` mount. Grep of the **changed lines** for `handleNote|handleChroma|handleOnset|useCallback|AudioCapture|Ref|useEffect` → **NO MATCHES**. No callback, ref, ref-sync useEffect, or AudioCapture prop touched. Black-screen/infinite-restart risk avoided. **Wiring correct**: JamGuide emits `{rootPc, quality:qualities[i]}` (station's actual KB quality) on select, `null` on deselect; the existing `selectedStation→null` reset effect (loop/style/instrument change) flows through the new cross-link effect and clears the highlight; an unmount-cleanup effect also clears; all guarded `onFocusChord?.` so JamGuide stays standalone. Fretboard **null path verified unchanged** (`hasFocus=false` ⇒ `tag` always null ⇒ `if(!color&&!tag)` collapses to original `if(!color)`; no halo/badge/legend). Emphasis is visually distinct (purple ring `DOT_R+3` + degree badge, accent token `#a855f7`). Triad labeling **correct** for maj/min/dim/aug/sus4/sus2 (all `hasSeventh:false` → badge/legend read "5"). **DEFECT (blocking)**: `guideTones`' secondary-anchor heuristic is `hasSeventh = ints.length >= 4`, so the **4-tone non-seventh** KB qualities `add9` `[0,2,4,7]`, `maj6`/`min6` `[0,4,7,9]` return `hasSeventh:true` with `seventh = ints[last]` = the **5th** (add9) or **6th** (maj6/min6). D-03's `focusLabel` trusts that boolean and badges those tones **"7"**, legend reads **"3 / 7"** — a perfect fifth / sixth rendered to the user as a seventh on the flagship Fretboard. **Reachable**: `add9` is in gospel progression qualities (×4), `min6` in bossa + rnb qualities — tapping those stations mislabels a non-7th. Verified by running `guideTones(0,'add9')→{third:4,seventh:7,hasSeventh:true}` (G badged "7"), `guideTones(0,'min6')→{third:3,seventh:9,hasSeventh:true}` (A badged "7"). The DoD's "the chord's guide tones (3rd/7th)" / "badge reads 5 not 7 for a triad" contract is violated for these KB-present qualities. **Fix direction (return to Luthier):** make the secondary anchor honest for extended non-7th chords — either tighten `guideTones` so a chord with no minor/major 7th reports `hasSeventh:false` and falls back to the 5th (root cause, L-01b owns theory.js), or have `focusLabel`/the badge derive the actual interval of `seventh` above root (10/11 ⇒ "7", 9 ⇒ "6", 7 ⇒ "5", 2 ⇒ "9") rather than trusting the boolean. Re-gate after fix.
> GATE 2026-06-15 (Critic) · **D-03 PASS (re-gate)** — the returned defect is fixed at the root cause and hardened. `npm run build` green (vite, 90 modules, built in 3.25s); `node scripts/smoke.mjs` → `✓ Smoke test passed — 71/71 checks green (10 styles, 50 progressions)`, exit 0; `node scripts/validate-kb.mjs` → `✓ KB valid — 10 style(s), 50 progressions, 100 plays` (no KB change). **Root-cause fix VERIFIED by running the real `guideTones`**: `hasSeventh` now keys on the actual presence of interval 10 or 11 (`ints.find(i=>i===10||i===11)`), not `length>=4`. Independent truth table (root C): add9→{third:2,seventh:7,**hasSeventh:false**,anchor=5th G}; maj6→{4,7,false,5th}; min6→{3,7,false,5th}; dom7→{4,10,true,7=A♯}; maj7→{4,11,true,7=B}; min7→{3,10,true,7=A♯}; triads maj/min/sus4/sus2→false,anchor 5th(7); dim→anchor ♭5(6); aug→anchor #5(8); dim7→♭5(6); half_dim→true,10. Return shape `{third, seventh, root, hasSeventh}` **unchanged** (keys verified). **Badge hardening (Fretboard) VERIFIED**: `focusSeventhLabel` derives the label from the *actual* interval of the anchor pc above the chord root (10/11→"7", 9→"6", 8→"♭6", 7→"5", 6→"♭5"), so a wrong boolean can't mislabel — adversarial sweep of all 14 KB qualities × keys {3,7,11}: a "7" badge appears iff the interval is truly 10/11; **NO MISLABEL**. Unknown quality → `maj` fallback, no crash. **Null-focus path byte-equivalent**: `jamFocusChord=null` ⇒ `hasFocus=false` ⇒ `tag` always null ⇒ `if(!color&&!tag)` collapses to the original `if(!color) return null`; no halo/badge/legend; `focusSeventhLabel` is dead-but-harmless. **No collateral**: `voiceLeadingPairs`/`soloScale` signatures untouched (theory.js diff hits only `guideTones` body+jsdoc); iiVI rails still correct (Dm7→G7 C→B [0→11,1]; G7→Cmaj7 F→E [5→4,1]) and `voiceLeadingPairs` does NOT crash for the now-5th-anchored add9/maj6/min6 (Cadd9→G7, Cmaj6→F, Amin6→Dm7 all return smooth rails). match.js/RoadmapTrack/ChordDiagram/KB untouched (`git diff --name-only` = only the 4 declared D-03 files). 🚨 **Audio contract INTACT**: `git diff -- src/App.jsx` purely additive (one `useState(jamFocusChord/null)` outside the callback/ref block + an additive `jamFocusChord=` prop on `<Fretboard>` + `onFocusChord=setJamFocusChord` on `<JamGuide>`); grep of changed lines for `handleNote|handleChroma|handleOnset|useCallback|AudioCapture|Ref|configRef|useEffect` → NO MATCHES; the sole "" line is the Fretboard mount being re-emitted with the added prop. *Non-blocking observation (pre-existing, out of D-03 scope):* `guideTones` uses `ints[1]` for the 3rd, so `add9` `[0,2,4,7]` reports its **9th (pc 2)** as `third`, not the major 3rd (pc 4) — true at L-01b time, unchanged by this fix, and D-03's bug was strictly the seventh/secondary anchor; worth a future tidy, not a return.
> GATE 2026-06-15 (Critic) · **L-10 PASS** — (re-gated cleanly after the prior dispatch died on an API error pre-verdict.) `npm run build` green (vite 7.3.1, 90 modules, built in 2.24s); `node scripts/smoke.mjs` → `✓ Smoke test passed — 71/71 checks green (10 styles, 50 progressions)` exit 0; `node scripts/validate-kb.mjs` → `✓ KB valid — 10 style(s), 50 progressions, 100 plays`. **Purity confirmed** by reading the full module: exports `pianoVoicing({rootPc,quality},opts?)`→`{notes,pcs,bass,style,label}` plus `pianoVoicingChain`, `hasTrueSeventh`, `voicingToneSet` (and re-exports `guideTones`); imports ONLY `{CHORD_TYPES, guideTones}` from `./theory`; no `Date`/`Math.random`/module-level mutable state — determinism verified (every quality voiced twice → byte-identical). **Music verified myself** via a throwaway ESM script (deleted): swept **all 14 CHORD_TYPES × 4 styles = 56 voicings** at rootPc 0 — every `pcs ⊆ voicingToneSet(...)` (**NO out-of-chord note**), real 3rd present (sus→2/5), every TRUE 7th (interval 10/11: dom7/maj7/min7/half_dim) present in shell+rootless, all `notes ∈ [0,36]` (≤3 octaves), `bass=min(notes)`. Spot-checks exact: **Cmaj7 shell→{0,4,11}** ✓, **Dm7 rootlessA→{5,9,0,4}=F-A-C-E** ✓, **G7 shell→{7,11,5}** ✓. **Awkward qualities honest**: half_dim shell→{0,3,10} (true ♭7 kept), rootlessA→{3,6,10,2} "3-5-7-9" ✓; **dim7 correctly NOT a true-7th chord** — its 7-slot is interval 9 (𝄫7 = enharmonic maj6, not 10/11), so `hasTrueSeventh('dim7')=false`, shells as R-3-5 {0,3,6}, no fabricated 7th; **min6/maj6** (no true 7th) → root {0,3,7,9}/{0,4,7,9}, rootless labels honestly read "3-5-6-9" using the 6th as upper colour — no wrong note. **Voice-leading confirmed**: `pianoVoicingChain([Dm7,G7,Cmaj7])` total semitone motion **16 vs 18** unthreaded (`opts.prev` slides whole shapes by octaves toward the previous voicing); pcs **unchanged** by threading (per-chord pc sets identical to unthreaded — re-registered only, never corrupted). **Adversarial**: bogus/empty/null chord → graceful `maj` fallback, no crash. **One non-blocking nit (NOT a defect):** forcing `rootlessB` (or `rootlessA`) explicitly onto a **sus2** chord produces a cosmetic duplicate absolute note (`notes=[26,26,31]`) because the suspended-2nd "3rd-slot" tone (pc2) and the synthesized 9th (pc2) collide — still no wrong pc, in range, and honestly labeled "no 7th, 9-3-5 colour". It is **unreachable on the shipping path**: `defaultStyle(sus2)='root'` and L-11/`pianoVoicingChain` use defaults, so sus2 renders as clean root `[0,2,7]`; the dup only appears under an explicit forced-rootless override of a sus chord (documented graceful degradation). Default-style sweep of all 14 qualities confirmed zero duplicate notes. Recommend a future tidy (dedupe collided absolute notes in the rootless fallback) — not a return. `src/lib/piano.js` NOT edited; throwaway script removed.
> GATE 2026-06-15 (Critic) · **D-02 PASS** — the load-bearing integration is correct. **Independent rotation check**: `canonicalPos = ((position rotation) % n + n) % n` translates a `findLoopPosition` index (which is into the *detected loop*) into the KB-canonical station RoadmapTrack/stationVoicings render. Worked a rotated [ii V I VI] of KB [I VI ii V] (rotation=2, n=4): playhead@detected-idx1(V)→canonical 3(V), @2(I)→0(I), @3(VI)→1(VI), @0(ii)→2(ii) — NOW lands on the chord actually playing. ✓ **rootPc parity** confirmed: thumbnail `rootPc` and RoadmapTrack station root are byte-identical `(((keyRoot+deg)%12)+12)%12`, and `keyInfo.root` (a note *name*, e.g. `detectKey`→"F#") is converted once via `chordRootPC` → pc, guarded `>=0`. stationVoicings `chords[i]` aligns 1:1 with `degrees[i]` (canonical). Auto-scroll is prop-driven off `position` (no rAF on the audio thread). Reflows (`flex-wrap`/`sm:flex-nowrap`), keyboard-reachable, AA contrast. NO_MATCH path → dashed fallback, never empty/crash. *Non-blocking deferral*: the DoD's "tap-station → **fretboard** guide tones" cross-link and `tailwind.config.js` edit were not delivered — the implementation cross-links via an inline enlarged ChordDiagram instead (flagged in-code as deferred). Panel is fully functional without it; recommend Maestro file the fretboard cross-link as a phase-2 follow-up.
> GATE 2026-06-16 (Critic) · **D-10 PASS** — `npm run build` green (vite 7.3.1, 90 modules, built in 9.36s); `node scripts/smoke.mjs` → 776/776 exit 0; `node scripts/validate-kb.mjs` → 10 styles/50/100 (no KB change). **ADDITIVE confirmed** by reading the full diff: the public `MiniPiano` now dispatches `if (voicing) <VoicingPiano/> else <LegacyPiano/>`. The legacy `{rootPc,lh,rh}` path is the SAME code, only refactored to named constants holding the IDENTICAL hex values (`LH_BLUE=#3b82f6`, `ACCENT=#a855f7`, `WHITE_FILL=#f5f5f5`, `WHITE_STROKE=#374151`, `BLACK_FILL=#1f2937`, `BLACK_STROKE=#111827`) — geometry (OCTAVES=2, WW/WH/BW/BH, BLACK_OFFSETS), highlight map, R-label all unchanged. **Consumers render identically**: `grep` confirms `ChordDetailModal.jsx:86` and `ExplorePanel.jsx:85` both call `<MiniPiano rootPc lh rh />` with NO `voicing` prop → `voicing` is `undefined` → both hit `LegacyPiano` → byte-equivalent output. **Voicing path correct**: maps absolute `notes` (0=low C, [0,36]) to keys via `oct*12+pc`, root pc lights accent `#a855f7` + "R", bass key amber-ringed (`#fbbf24` AA), other tones soft accent `#c084fc`; OCTAVES auto-spans 23 to contain `max(notes)`. Worked example `pianoVoicing({rootPc:0,quality:'maj7'})` → default shell, pcs `{0,4,11}`=C-E-B (R-3-7): C lit accent+R, B & E soft purple, C bass-ringed — musically right. `role="img"`+`aria-label`. Design tokens used. No legacy regression, no colour/render bug.
> GATE 2026-06-16 (Critic) · **C-10 PASS** — `node scripts/smoke.mjs` → **776/776 exit 0** (was 71 pre-piano; +705 piano checks). Diff ADDED a piano block, kept ALL prior registry/matcher checks. Sweeps 14 qualities × {C,G} × {root,shell,rootlessA,rootlessB,default} asserting: valid shape (notes/pcs/bass/style/label), `pcs ⊆ voicingToneSet(quality,actualStyle)`, real 3rd (or sus tone) present, true 7th present in shell/rootless when `hasTrueSeventh`, `notes ∈ [0,36]`, `bass===min(notes)`, no-dup-note, determinism, and chain pcs-preservation. **Adversarially proven NON-vacuous**: inject pc1 into pcs → **125 fails, exit 1** (pcs⊆toneSet bites); `bass=max(notes)` → **140 fails, exit 1**; revert L-13 dedupe (`notes=placed`) → the no-dup check fails on exactly `sus2@0 [rootlessB] notes=[26,26,31]` + `sus2@7 [21,21,26]`, **exit 1**. So the suite now passes LEGITIMATELY because L-13 fixed the resolver, not because any check was weakened. piano.js restored to its L-13 diff after each sabotage (git: 9 insertions, clean).
> GATE 2026-06-16 (Critic) · **L-13 PASS** — minimal fix at the single funnel point in `pianoVoicing`: `const notes = [...new Set(placed)]` (dedupe ABSOLUTE notes), `pcs`/`bass` derived from the deduped array so both stay consistent. Verified via a throwaway resolve-hook ESM check (written + deleted): (a) `pianoVoicing({rootPc:0,quality:'sus2'},{style:'rootlessB'})` → `[26,31]` distinct (was `[26,26,31]`); (b) NO default-style voicing across all 14 qualities has a duplicate, so the dedupe is a pure **no-op on the default/chain path** — L-11's render is unaffected; ii-V-I chain `[14,17,24]|[19,23,29]|[24,28,35]` all distinct & voice-led. The full 56-voicing correctness is re-asserted by the now-776-green smoke (pcs⊆toneSet, 3rd, 7th, [0,36], bass for every quality×style). **Safety reasoning — dedupe NEVER drops a needed note**: a JS `Set` of absolute integers merges two entries only when they are the *identical integer*, i.e. identical pc AND identical octave — the *same physical key*, which can sound only one note anyway. Two musically-distinct intended tones (different pc, or same pc a different octave like 14 vs 26) yield different integers and are never merged. The sus2 collision is a genuine unison (pc2 stand-in 3rd at +24=26 vs synthesized 9th at +12=26, both pc2 same octave) — a redundant doubling, safe to drop. No information loss possible. build green; default + chain paths unchanged.
---
## Backlog (future sprints)
- **Jam Guide phase 2:** `MiniPiano.jsx` + piano recipe resolver (unblocks piano packs); bass pattern renderer.
- **Retire `EducationPanel.jsx`** — confirmed orphaned (no importer anywhere in `src/`, D-20 gate verified); delete after the Knowledge Center ships. Fold `CurrentJamPanel`'s overlapping content (voicings/scales/similar progressions) into the Knowledge Center and retire it too.
- **Level-tag `FAMOUS_PROGRESSIONS`** (`src/lib/education.js`, Professor): famous-progression cards are exempt from the level filter this sprint (Maestro call 2026-07-08, per D-20 open question 1).
- **Drift guards in smoke (Critic, tiny):** two hand-synced duplications need permanent smoke checks — JamGuide.jsx's copy of the validator's `resolveDegree` (fold in the L-24 gate's 16-degree × 14-quality drift test) and the 8-word technique vocab duplicated between `validate-kb.mjs` `LICK_TECHNIQUES` and `LickCard.jsx` `TECHNIQUE_VOCAB` (C-21 finding).
- **`pianoVoicing` should return `rootPc` (Luthier, tiny):** callers currently must attach it themselves (JamGuide and VoicingBrowser both do); returning it at the source removes the false-"R" foot-gun for future consumers (D-24 gate observation — NOT a live bug, both call sites verified correct 2026-07-08).
- **`docs/kb-backlog.md` is stale (Professor, tiny):** still lists gospel/pop guitar + jazz/gospel piano as "todo" though shipped; P-30 (rnb piano) AND P-31 (blues piano, both 2026-07-10) need done entries — refresh next content iteration (flagged by P-30 + C-31 sweep, outside their locks).
- **`scripts/loop-fixtures.mjs` header comment drift (tiny):** cites "App.jsx:322-324" for adjacent-dup suppression; L-31 shifted it to ~line 364 — comment-only, fix when the file is next touched (C-31 sweep finding).
- **Try-this vs Suggested-progressions should show TWO DIFFERENT things (product direction, user 2026-07-13 — "keep as is for now… revise later"):** today both are chord/loop-relative but overlap conceptually. Intent: **Try this** = per-chord substitutions (an alternative to the CURRENT chord; built via `suggestSubstitutions`). **Suggested progressions** = currently same-style KB siblings (other real progressions in the style); the desired distinction is to make it **loop-level** — propose altered/reharmonized versions of the USER'S ACTUAL loop (apply `suggestSubstitutions` across every loop chord to generate modified progressions), i.e. the "computed modifications" option deferred earlier. The engine (L-73) now exists to power it. Keep same-style-siblings for now; revisit as a distinct feature.
- **TryThis duplicate-name-loop rotation (Luthier, small — L-74 gate 2026-07-13):** `loop.indexOf(currentChord)` returns the FIRST index, so a loop with a repeated chord name (e.g. a collapsed 12-bar where I7 recurs) double-advances the rotation (~2× pacing) and can mislabel Rule D's "next" chord. Subs for the current chord stay correct. Honest fix needs App to pass a true playhead station index (beyond L-74's mount-only lock) — wire it if TryThis ever couples to the loop engine.
- **TryThis/related category-tag contrast (Muse, tiny — L-75/L-76 gate 2026-07-13):** the decorative category tag uses `text-gray-500` at 9px (~3.4:1, under AA for small text) — the app-wide secondary-label idiom (also in section headers/DebugView), so pre-existing and non-load-bearing; consider a bump to `gray-400` system-wide someday.
- **ProgressionBanner strip chips are div-onClick (Muse, small):** pre-existing a11y debt — history/loop chips should be real buttons (L-50 gate 2026-07-11; RelatedProgressions' chips already show the pattern to copy).
- **Test-infra note (any agent writing throwaway SSR harnesses):** a bare `import('esbuild')` inside a `data:` module hook dies silently (ERR_MODULE_NOT_FOUND in the hooks thread, exit 1, zero output) — smoke.mjs:1047's interpolated `import.meta.resolve` pattern is load-bearing; prefer esbuild pre-bundle harnesses (confirmed empirically twice, 2026-07-11).
- **GUITAR_SHAPES self-audit in smoke (Critic, small — P-62 gate suggestion 2026-07-11):** pc-spell every GUITAR_SHAPES entry against its quality in smoke — the validator audits only KB chord steps, never the shape library itself; would have caught both wrong shapes below and guards future additions.
- **Pop piano prose uses absolute note names (Professor, tiny — P-62 gate flag):** ~8 spots (pop/piano.js:88,117,130-133,159,186) say e.g. "the G holds; top C→B" — correct only in the declared reference key; degree-ify before any piano-prose render surface lands (sibling of the bass-tips-surface backlog item).
- **Two wrong GUITAR_SHAPES in live data (Luthier, small — P-62 audit finding 2026-07-11):** (1) `half_dim "E Barre"` offsets `[0,1,2,0,0,'x']` sounds {0,3,6,7} — natural 5th clashing the ♭5, NO ♭7; correct E-form ø7 = `[0,1,0,0,'x','x']`. (2) `add9 "Open Dadd9"` (xx0230 = D-A-D-E) has no 3rd — it's Dsus2, duplicating the sus2 open D. Both pre-existing; fix after P-62 commits (additive lock kept P-62 from editing them).
- **Matcher blues/jazz disambiguation (Luthier, small):** `['C7','A7','Dm7','G7']` matches `jazz-rhythm-a` (identical IVIiiV degree shape, quality tie → jazz), so `blues-turnaround`'s bass plays are live-unreachable — pre-existing tie-break in match.js; consider quality-profile weighting (all-dom7 → blues). Evidence-verified by the L-42 gate 2026-07-10.
- **Bass play `tips` have no render surface (Muse/Luthier, small):** the authored teaching prose in bass packs renders nowhere (card shows label/feel/position/note only; the dock has no bass section) — real content-surface gap, L-42 gate 2026-07-10.
- **TransitionChip "2 step down" wording (Muse, one line):** whole-step rails render as "2 step down/up" (52 of 268 real KB transitions) — verbatim port of RoadmapTrack.jsx:59; "whole step down" is the musician's phrase (D-41 gate note 2026-07-10).
- **Fingering view lost at gallery thumb size (Muse, small):** D-30's gallery renders ChordDiagram at `size="thumb"`, which never draws finger numbers — nothing in the browser shows fingering anymore (D-30 gate note 2026-07-10). If pedagogically wanted: tap-to-enlarge to `size="full"` inside a gallery cell.
- **Negative-fret shape handling inconsistency (Luthier, small):** `voicings.js` skips shapes that compute negative frets while `chordAudio.guitarShapeToNotes` slides them up an octave — pre-existing, flagged at the L-23 gate; unify someday.
- **Jam Guide phase 3:** bass pattern renderer (guitar → piano → **bass** roadmap; MiniPiano + piano recipe resolver shipped in sprint-knowledge-center).
- **Content:** piano packs (jazz → gospel → neo-soul first), then bass packs (blues → jazz → funk first) — see `docs/kb-backlog.md`.
- **`guideTones` third bug (L-12, Luthier — small):** `guideTones` takes `ints[1]` as the "third", so `add9` `[0,2,4,7]` reports its **9th (pc 2)** as the 3rd instead of the major 3rd (pc 4) — wrong "3rd" lane/badge for add9 (live in gospel + pop-axis Cadd9). Pre-existing since L-01b; flagged by Critic during the D-03 re-gate. Fix: pick the actual 3rd/4th interval (3 or 4, or sus 2/5) rather than positional `ints[1]`. Smoke + a guideTones truth-table check.
- **Learning features (Professor + Luthier):** drills tab seeded from `docs/learn-curriculum.md`; target-note highlighting; ear-training quiz on own chord history; pocket report from the onset pipeline.
@@ -68,9 +307,35 @@ Emphasis this sprint: **ship the Jam Guide MVP** (put the 8 guitar style packs o
_(Maestro appends one line per completed iteration: `<date> · <task ids done> · <next>`.)_
- 2026-07-13 · **sprint-dashboard-polish — direct push (user "push everything now")** · done: L-78 (`d543b98` Try-this 3×3 ways-to-play — up to 3 guitar grips / 1 piano per suggestion, fixed anti-jump 3-slot frame; verified build+validate-KB+smoke 903/903; full independent Critic gate waived at user request) · L-77 re-scoped SAME DAY per user: rail should HIGHLIGHT loop chords when a loop is found AND list the other recent chords underneath, ≥4 total once history exists (was: replace-with-history). Rebuilding + pushing per "add this to the branch also and push when its done" · next: build L-77 (hybrid loop+history rail) → verify → push both remotes
- 2026-07-13 · **L-77 done + pushed** (`9415daf`) · hybrid voicings rail: loop group highlighted ("the loop") + "also played" recent-distinct chords underneath (most-recent-first, ≥4 once history exists), no-loop → history rail replaces the single-chord fallback; GlanceRail gains `showTransitions` (default true, loop byte-unchanged). Maestro verified build+validate+smoke 903/903 and folded 2 honesty fixes on the shared GlanceRail (history group no longer says "loop"/"playhead"; history rows non-focusable → no inert button). App.jsx/audio untouched. Pushed both remotes · next: C-70 sprint-end sweep (aria one-liner + PR updates) when user confirms the rail looks right
- 2026-06-14 · done: M-01 · in-review (awaiting user pick): D-00a/b/c viz concepts · next: D-SEL (user chooses) → then L-01/D-01/D-02 implement chosen concept
- 2026-06-15 · done: D-00a/b/c, D-SEL (Roadmap chosen), L-01 (match.js + banner refactor), L-01b (guideTones/voiceLeadingPairs/soloScale) — Critic PASS both · next: L-02 (JamGuide shell) → D-01 (RoadmapTrack) ‖ D-01b (ChordDiagram)
- 2026-06-15 · done: L-02 (JamGuide shell + App mount), D-01 (RoadmapTrack), D-01b (ChordDiagram), D-02 (assembly + playhead rotation + thumbnails) — Critic PASS all 4, audio contract intact (App.jsx +10/0) · **Roadmap Jam Guide MVP is live & builds green** · next: D-03 (fretboard cross-link, backlog) ‖ P-01 (gospel content) ‖ H-01 (README reframe)
- 2026-06-15 · done: P-01 (gospel guitar pack — 5 progs × 2 plays, validator 9 styles/45/90), H-01 (README reframed as learning platform, stale frontend/ paths fixed) — Critic PASS both · next ready: P-02 (pop pack) ‖ H-02 (CONTRIBUTING) ‖ C-01 (smoke harness) ‖ D-03 (fretboard cross-link)
- 2026-06-15 · done: P-02 (pop guitar pack — KB now 10 styles/50/100), H-02 (CONTRIBUTING.md + issue templates), C-01 (scripts/smoke.mjs — 71/71, adversarially proven to catch a broken matcher) — Critic PASS all 3 · **SPRINT `sprint-jam-guide` COMPLETE** → opening PR to main · remaining (next sprint): D-03 fretboard cross-link, piano/bass packs, drills
- 2026-06-15 · done: D-03 (tap station → guide tones on the main Fretboard; root-cause fix to `guideTones` hasSeventh + badge hardening) — Critic **returned once** (add9/maj6/min6 mislabeled 5th/6th as "7"), fixed, **PASS on re-gate** · audio contract intact · folded into PR #2 (completes the flagship) · filed L-12 (guideTones third bug) to backlog · next: seed piano phase-2 sprint (resolver + MiniPiano + wire)
- 2026-06-15 · **new sprint `sprint-jamguide-piano`** cut off sprint-jam-guide (keeps PR #2 stable) · done: M-02 (seed), L-10 (`src/lib/piano.js` voicing resolver — shells/rootless A·B/root, voice-leading threading; Critic PASS, 56 voicings, 0 wrong notes) · next ready: D-10 (MiniPiano) ‖ C-10 (smoke piano) → then L-11 (wire piano tab) · L-10 chosen as a new unimported lib so the user's live frontend review stayed undisturbed
- 2026-06-16 · done: D-10 (extended existing `MiniPiano.jsx` with additive `voicing` prop — legacy lh/rh path for ChordDetailModal/ExplorePanel byte-unchanged), C-10 (smoke +705 piano checks → 776 total), L-13 (resolver dedupe — `[...new Set]`, fixes sus2 dup-note C-10 caught) — Critic PASS all 3 (adversarially proved C-10 checks bite + dedupe never drops a needed note) · **mid-iteration corrections:** D-10's "new file" premise was wrong (MiniPiano already existed + imported) → re-scoped to additive extend; C-10 correctly turned the branch red surfacing a real wart → filed+fixed L-13; 3 subagents hit API errors (2 produced nothing, 1 landed its diff before dying) · **L-11 (wire piano tab) intentionally HELD** — it's the first UI-visible change; waiting until the user finishes reviewing localhost:5173 · next: L-11 on the user's go
- 2026-07-08 · **new sprint `sprint-knowledge-center`** seeded on the SAME branch (user directive: continue on `sprint-jamguide-piano`) · user asks: playable voicings per chord, lick/technique cards, intermediate progressions (easiest in-app surface = level tags + filter), Knowledge Center visual restructure, keep expanding KB · L-11 hold LIFTED, carried forward · loop scheduled: /jam-loop every 30 min × 24 iterations (12 h) · ready now (file-disjoint): L-11 ‖ D-20 ‖ L-20 ‖ C-20
- 2026-07-08 · **iteration 1/24** · done: M-03, L-20 (`4b0f0c8` audio engine), L-11 (`7b669f8` piano tab LIVE), D-20 (`96dda6a` Knowledge Center concept), C-20 (`793e60a` lick/level schema, smoke 787) — Critic PASS all four, zero returns · findings folded into the board: D-21 lock += `voicings.js` export-only (GUITAR_SHAPES private); L-22 deps += P-21; P-21 serialized behind P-20 (`jazz/**` overlap); filed L-23 (pre-existing `getGuitarVoicings` rootStr fret-label bug, found by L-20); D-20 discovered ExplorePanel + EducationPanel are ORPHANED (never mounted) → retirement backlogged; famous-progressions level-filter exemption recorded · next ready (file-disjoint): D-21 ‖ P-20 ‖ D-22 (D-22 may build against the SCHEMA fixture until P-21 lands)
- 2026-07-08 · **iteration 2/24** · done: D-22 (`44d9c4f` LickCard), D-21 (`3c903ad` VoicingBrowser — returned once: rootless voicings badged lowest voice as "R", one-line rootPc fix, PASS on re-gate), P-20 (`c08b334` — returned once: 3 caption theory misstatements, string fixes, PASS on re-gate; KB 56 progs/112 plays, all jazz/gospel/rnb progressions level-tagged) · incident: both first-round gates stalled on API watchdog (600s) twice for P-20 — fresh critic instances completed them; one cron fire absorbed into gate completion · Critic gate quality note: both returns were real musical defects caught before commit
- 2026-07-08 · **iteration 4/24** · done: P-21 (`6ea1089` 12 licks blues/jazz/funk — every note pitch-verified), P-22 (`9e2567c` jazz piano cell, KB's first authored piano pack, 126 plays — returned once: 6 prose voice-leading overclaims on fifths-apart dominants, fixed + arithmetic-verified, PASS on re-gate), L-22 (`78706ce` **Knowledge Center shell LIVE** — 4-section dock, level filter, licks grid; App.jsx +1 line, audio contract grep-clean) · filed: C-22 (validator span check), L-24 scoped out of P-22 (authored-pack rendering) · promoted: L-24, C-22, P-23 · iteration 5 batch already in flight: D-23 ‖ D-24 ‖ P-24
- 2026-07-09 · **iteration 8/24 — SPRINT `sprint-knowledge-center` COMPLETE** · done: C-21 (sprint-end sweep — build/validator/smoke all green on 72c6d45; full-App SSR renders; authored vs computed piano paths both proven; zero dead imports; audio contract +1 line since seed) · **PR #3 opened: https://github.com/whattheflat/JamBuddy/pull/3** (supersedes PR #2 — main hadn't absorbed it) · all 21 sprint tasks done, 4 returned-then-fixed by the gate, 0 unresolved · loop cron deleted after 8 of 24 budgeted iterations (board empty) · remaining backlog: EducationPanel retirement, FAMOUS_PROGRESSIONS level tags, smoke drift guards, pianoVoicing rootPc, negative-fret unify, L-12, bass renderer
- 2026-07-09 · **iterations 67/24** · done: L-25 (`e24aa4b` instrument-scoped modal tabs), C-22 (`b4e8f12` validator hand-span rule, smoke 799), P-23 (`564a9e0` gospel piano cell, 140 plays — returned once: one improv-row scale claim false for vi7/iii7, split into exact rows, PASS re-gate; 39/40 first-pass claims held), L-24 (`2165bb5` authored piano packs render at stations — implementer agent hung at verification after ~1 h, killed, completion-pass agent audited + finished; Critic PASS with 0 resolver drift) · incidents: P-23 stalled once mid-authoring (resumed from transcript, no loss); L-24 hung silently (diff intact, completed by fresh agent) · backlog: resolveDegree drift guard filed · **board empty except C-21 → sprint-end sweep + PR**
- 2026-07-08/09 · **iteration 5/24** · done: D-23 (`db397f6` VoicingBrowser show prop + LickCard stack-guard), D-24 (`e2110ae` MiniPiano thumbs crop to voicing span, 266→142 px), P-24 (11 licks rock/country/reggae — KB now **23 licks across 6 styles**, every note pitch-verified) — Critic PASS all three, zero returns · D-24 gate raised a false alarm on the D-21 rootPc fix (its harness bypassed VoicingBrowser; Maestro verified line 297 intact — no regression); hardening idea backlogged (`pianoVoicing` return rootPc) · promoted L-25 · next ready (all file-disjoint): L-24 ‖ L-25 ‖ C-22 ‖ P-23, then C-21 closes the sprint
- 2026-07-10 · **sprint-integrated-glance iteration 4/24 — SPRINT COMPLETE** · done: L-42 (`af7c3cc` **BASS real end-to-end** — BassPatternCard tab cards with playback; gate re-realized all 912 placements exact, byte-identity on untouched paths, import cycle proven safe), C-42 (`218c0ba` smoke §7 sweeps BOTH resolveDegree copies, 866/866 — the sweep agent authored the wiring then died on the ACCOUNT MONTHLY SPEND LIMIT; Maestro completed the sweep inline: build/validator/smoke green at HEAD, sabotage-proved the new guard [b13 perturbation → red naming the cell → restored green], whole-sprint App.jsx contract grep = 0 hits; per-instrument SSR relied on the L-42 gate's run minutes earlier — only smoke.mjs changed since) · backlogged: matcher blues/jazz tie-break (turnaround bass plays live-unreachable), bass tips surface · all 11 sprint tasks done, 2 returned-then-fixed (D-40, and D-41's predecessor D-31 pattern held: zero returns this sprint besides D-40), 0 unresolved · PR #3 updated; cron deleted (4 of 24 iterations) · ⚠️ NOTE: the Anthropic monthly spend limit is HIT — no further subagent work possible until raised
- 2026-07-11 · **sprint-roulette-kb iterations 1-2/12** (notification-driven; hourly cron as fallback) · done: M-07, C-60 (`5f4e2b7` piano lick schema — enclosures native, 25-cap proven tight, dormant renderer guard), P-62 (`ffc1bb1` pop piano cell 182 plays + 8 shapes; found 2 WRONG pre-existing shapes → backlog), D-61 (`c999c95` circle of fifths — returned once on modal hub signature, now teaches parent-major relation), P-60 (`70263e2` first piano licks, jazz+blues — PASS first try 35/35), D-60 (`a7dbd6a` PianoLickCard piano-roll renderer — PASS, 41/41 realization audit), D-62 (`e87b2bb` jam-roulette spec — returned TWICE, round-3 literal-implementation test passed; surfaced the pre-existing live bug: 10 progressions incl. blues-12bar never match detection; fix (a) specced into L-60), P-61 (`2c18c71` gospel+rnb licks, 39 total — returned once on one interval claim, gate-prescribed fix verified) · KB today: 172→182 plays, 23→39 licks, 6th piano style, circle of fifths · remaining: L-60 (blocked on one-screen C-50) → C-61
- 2026-07-11 · **BOTH SPRINTS COMPLETE** · sprint-roulette-kb: L-60 (`8d74e54`+`1df6fe8` **Jam Roulette LIVE** + the matcher collapse fix repairing the pre-existing live 12-bar/8-bar empty-JamGuide bug — Critic PASS on Opus: pool sweep reproduced from spec 4/52, fix-(a) additivity proven registry-wide, seed timeline hand-traced), C-61 (combined sweep — build/validator 182·39/smoke 891 all green, full-App SSR ×6 combos, whole-branch audio contract clean; PASS) · gate stats across both sprints: 9 first-try passes, 5 returns across 4 tasks (D-50, P-61, D-61, D-62×2) all re-gated to PASS · cron deleted · PR #3 updated with the combined summary · backlog: PianoLickCard LicksStrip wiring (needs shared sequencer-stop), 2 wrong GUITAR_SHAPES, strip-chip a11y, matcher blues/jazz tie-break, bass tips surface, 6 pre-existing orphan components
- 2026-07-11 · **sprint-one-screen iterations 2-3 + roulette-kb progress** · one-screen COMPLETE: L-50 (`800fd43`+`e58a7a6` dashboard grid, slim strip, jam view), D-51 (`d5a45f4` rail column adaptation — verified to the built CSS), L-51 (`6e8d8f4` RelatedProgressions — collapse step proven load-bearing), C-50 (`4deba7e` sweep, smoke 886, ranking pinned + registry id-uniqueness) — all Critic PASS · roulette-kb: P-61 (`2c18c71` gospel+rnb licks, 39 total) · **incident:** the L-60 (Jam Roulette) dispatch hit the account MONTHLY SPEND LIMIT on Fable 5 mid-read (no files written, clean tree); user switched the session to Opus 4.8 and L-60 re-dispatched fresh on Opus — proceeding · remaining: L-60 → C-61 closes both sprints
- 2026-07-11 · **sprint-one-screen iteration 1** (notification-driven) · done: M-06, D-50 (`d24bf35` one-screen dashboard + jam-view concept — returned once: strip height, geometrically-inert sticky, double-counted padding, collapse-blind ranking; all fixed, re-gate PASS with recomputed budgets) · L-50 (the build) in flight · then D-51 ‖ L-51 → C-50 → unlocks L-60
- 2026-07-10 · **sprint-integrated-glance iteration 3/24** · done: D-41 (`677d7b9` **all-expanded rail LIVE** — every station a permanently expanded row with education header [solo-scale, aim dots, voice-leading chips incl. wrap-around] + full gallery; playhead highlight-only proven byte-equal modulo highlight artifacts; focus toggle keeps the onFocusChord contract; show='bass' fall-through fixed; dense byte-identity proven across 336 SSR combos; black-on-accent 5.31:1 beats the old sub-AA white) — gate PASS, 19/19 SSR incl. independent theory recompute of a row's education · backlogged: TransitionChip "2 step down"→"whole step" wording (52 of 268 transitions) · L-42 (bass pattern renderer) dispatched — then C-42 closes
- 2026-07-10 · **sprint-integrated-glance iteration 2/24** · done: P-41 (`01a7c32` **the KB's first bass cell** — blues, 8 plays/172 total; gate machine-realized all 76 patterns in C AND A, 12 identities hold key-agnostically; PASS first try), L-40 (`c899132` **the restructure is live** — band below the main module, banner = the single loop display, RoadmapTrack/CurrentJamPanel unmounted, App's one GUITAR/PIANO/BASS selector drives band + dock, honest bass rows, GlanceRail yank-effect deleted; gate SSR 22/22, audio contract grep-clean, deletion sweep clean) · folded: smoke §7 resolveDegree wiring → C-42; VoicingBrowser show='bass' fall-through fix → D-41 (lock extended) · D-41 (all-rows-expanded rail) dispatched — then L-42 → C-42 closes
- 2026-07-10 · **sprint-integrated-glance iteration 1/24** · done: M-05, P-40 (`6f59add` kb-backlog refreshed — gate audited all 14 cells + 10 dates), C-40 (`090d3a9` drift guards, smoke 836 — gate recomputed all 224 truth-table cells), D-40 (`7d1f64c` integrated-glance concept — returned once: Dm7-specific piano math + 3 factual fixes incl. the interim page-yank, fixed, PASS re-gate with pixel-exact recompute), C-41 (`996218f` bass play schema, smoke 849 — degree-based, typed approaches, PASS with 19-semitone bound proven exactly maximal) · in flight: L-40 (App restructure — band up top, single loop display, one selector) ‖ P-41 (blues bass, first bass cell) · then D-41 → L-42 → C-42 closes
- 2026-07-10 · **iteration 4/24 — SPRINT `sprint-glance-and-loop` COMPLETE** · done: P-31 (`81cd230` blues piano cell, 164 plays — returned once: jump-kicks bars 3-4 dyad orientations flipped + 2 prose rewordings, fixed, PASS scoped re-gate), C-31 (sprint-end sweep at `81cd230` — build/validator/smoke 817 all green; full-App SSR renders with rail+gallery+strip coexisting; whole-sprint App.jsx diff = ONE hunk in the progression effect, contract grep 0 hits; no dead imports; every gate-promised follow-up verified filed) · all 11 sprint tasks done, 2 returned-then-fixed (D-31, P-31), 0 unresolved · PR #3 updated with the sprint summary; loop cron deleted after 4 of 24 budgeted iterations (board empty) · new backlog: loop-fixtures header line-ref drift; kb-backlog needs rnb+blues done entries
- 2026-07-10 · **iteration 3/24** · done: L-33 (`c78baf4` **glance mode LIVE** — playhead accordion, licks strip, heard-live fallback; gate SSR 37/37, dense-less VoicingBrowser byte-identical to 0945a08, token matcher proven hostile-proof, App.jsx untouched by construction), L-31 (`ce24d54` commit layer 2/3/6 — gate re-traced all five scenarios independently + 3 hostile traces; REPLACE_VOTES=3 proven load-bearing; audio contract grep-clean) · **all three user asks now end-to-end on the branch** · P-31 (blues piano, 164 plays) authored — gate in flight; its verifier self-caught 3 prose overclaims pre-review · C-31 promoted (holds until P-31 lands so the sweep sees a settled tree) · next: gate P-31 → C-31 closes the sprint
- 2026-07-10 · **iteration 2/24** · done: P-30 (`b51daa1` rnb piano cell, KB 154 plays — PASS first try, a piano-pack first; found+fixed its own 36-key-window stacking defect pre-review), L-30 (`4cc0009` detector rewrite: dup-collapse, weak-period ghost rejection, len 28, ≤1 edit/cycle with ≥2-exact evidence gate, recency-weighted coverage — smoke 817/817, gate ran 15 novel probes, 0.20.7ms/call) · L-33 built (playhead accordion + LicksStrip + heard-live fallback, SSR 24/24 self-checked) — gate in flight · L-31 dispatched with both gates' findings folded (flap-survival constraint, docstring ride-along) · both watchdog-stalled agents recovered cleanly via resume · promoted: P-31 · next: gate L-33, land L-31, then C-31 closes
- 2026-07-10 · **iteration 1/24** · done: M-04, D-30 (`0945a08` VoicingBrowser gallery — all shapes/styles side by side, no chips; PASS first try), C-30 (`fdd93c7` 17 loop fixtures + smoke wiring; PASS — found the len² self-overlap artifact as the root cause of the user's missed 3-chord loops, folded into L-30/L-31 DoDs), D-31 (`6c7a1a7` glance-mode "playhead accordion" doc — returned once on piano-gallery width math, fixed, PASS re-gate) · in flight: L-30 (detector redesign, dispatched early — C-30 contract ready), P-30 (rnb piano) — both stalled once on the 600s API watchdog near completion, both resumed via SendMessage · promoted: L-33 (ready, locks per D-31 doc) · finding worth noting: "5 chords then 2 others" passes at pure-function level — the live failure is the ghost-pattern flapping starving the 2-vote commit layer (L-31's trace case)
- 2026-07-10 · **new sprint `sprint-glance-and-loop`** seeded on the SAME branch (commits extend PR #3) · user asks: all voicing variations side-by-side with no button pushing; fix loop detection (misses a returning 3-chord loop and a 5-chords-then-2-others shape); glanceable zero-click learn session that follows the live jam · loop scheduled: /jam-loop every 30 min × 24 iterations (12 h, cron 13,43) · ready now (file-disjoint): C-30 ‖ D-30 ‖ D-31 ‖ P-30, then C-30→L-30→L-31 and D-30+D-31→L-33
- 2026-07-08 · **iteration 3/24** · done: L-21 (`951d544` VoicingBrowser live in ChordDetailModal Guitar/Piano tabs + JamGuide enlarged stations — the "playable voicings per chord" user ask is now end-to-end), L-23 (`f4e0ac6` getGuitarVoicings base-fret fix — 252 movable-shape placements corrected, A-shape C was labeled fret 1 not 3) — Critic PASS both, zero returns this round · follow-ups filed: VoicingBrowser `show` prop (Muse), negative-fret handling inconsistency (Luthier), stale JamGuide header comment · P-21 lock narrowed to the 3 guitar.js files → P-22 now disjoint · next ready (file-disjoint): P-21 ‖ P-22 ‖ L-22 (licks section may land empty-state-first per D-20 doc)
+510
View File
@@ -0,0 +1,510 @@
# Dashboard polish — rail + licks (task D-70)
Concept doc for `sprint-dashboard-polish`. Revises the rail/licks layout that
`docs/design/one-screen.md` §4 and D-51 established, per the user directive of
2026-07-13 ("this looks amazing" + six refinements). No code here — this specs
the two bounded implementation tasks **L-70** (rail) and **L-71** (licks) and
proves the numbers.
Design tokens only (`tailwind.config.js`): `surface` #0f0f0f, `panel` #1a1a1a,
`border` #2a2a2a, `accent` #a855f7, plus the SVG note language already mirrored
in `MiniPiano`/`ChordDiagram`/`LickCard` (amber #f59e0b secondary, ACCENT_SOFT
#c084fc chord-tone, BASS_RING #fbbf24). No new colour is introduced.
The column geometry we build against (from D-51 / one-screen.md §4, unchanged):
```
right column 500px
section border+p-2 18
row border+p-1.5 14
vertical scrollbar 17 (classic Windows) … 8 (the thin bar we add in §2)
= row interior 451px worst case (classic) · 460px (thin) · 468 (none)
```
All fits below are proven against the **conservative 451px** interior; the thin
scrollbar we introduce in §2 only ever makes them more comfortable.
---
## 0. Scope boundary — dashboard only (user refinement 2026-07-13)
> "perhaps within the knowledge center it could be nice but leave it for now as
> is, only in the main JAM FULL SCREEN we need to optimize what we show."
**The net boundary (two settled user clarifications, 2026-07-13):**
- **Dashboard** (always-open band + ⛶ jam-view fullscreen) = **full visual
optimisation**: guitar ≤4, 2×2 smaller piano, uniform licks, dark scoped
scrollbars, no ▶.
- **Knowledge Center dock** (`KnowledgeDock`'s VoicingsSection + LicksSection,
the Circle of Fifths) **and `ChordDetailModal`** = **layout UNCHANGED** (all
shapes, normal piano, current lick size) **except the ▶ play buttons are
removed** — the user decided "then leave them off, better not," so ▶ comes off
**everywhere**, not just the rail.
So there are **two** kinds of change with **two** scopes: the *visual layout*
changes are **dashboard-only** (gated behind the dashboard fork), while the
*▶ removal* is a **deliberate global** change across every mount.
The trap is **shared components**:
| component | dashboard mount | Knowledge Center / modal mount | how they differ today |
|---|---|---|---|
| `VoicingBrowser` | GlanceRail rows + heard-live (`dense`) | VoicingsSection + ChordDetailModal (**no `dense`**) | the `dense` flag already forks them |
| `LickCard` | LicksStrip (`size="thumb"`) | LicksSection (`size="full"`) | the `size` prop already forks them |
| `MiniPiano` | rail thumbs (`size="thumb"`) | modal/ExplorePanel (`size="thumb"`/`"full"`) | needs a **new** `size="mini"` variant |
| `PianoLickCard` | LicksStrip (new wiring) | **never mounted** | no KC concern at all |
**The rule: gate the *visual* optimisations behind the dashboard fork and change
no default there; remove ▶ globally.** Concretely:
- `VoicingBrowser`*visual, dashboard-only:* guitar ≤4 + piano 2×2 apply
**only under `dense`** (the flag only dashboard mounts pass); non-dense
(VoicingsSection + ChordDetailModal) keeps **all shapes + the normal piano
layout**. *Global:* the ▶ is **removed from the component outright** (§3) — no
mount wants it anymore.
- `MiniPiano`: the smaller keyboard is a **new additive `size="mini"`**; `thumb`
and `full` are byte-untouched, so the modal/ExplorePanel render identically.
- `LickCard`: the uniform footprint is imposed **at the dashboard-strip mount**
(a wrapper box), **not** in `LickCard` — its default footprint is unchanged.
`LickCard` itself is edited only if it must lose a ▶ (it has none — see §3.3),
so the dock's LicksSection (`size="full"`) renders unchanged. `PianoLickCard`
is all-new to the strip.
- Scrollbar CSS: a **scoped `.dark-scroll` class** on the dashboard scrollers
only — the KC's own scrolling keeps the OS default.
**Restated L-70/L-71 byte-identity DoD:** the dock's VoicingsSection /
LicksSection and `ChordDetailModal` render **byte-identical to today EXCEPT the
▶ buttons are gone** (the D-41/D-51 non-dense-mount precedent — Critic
diff-checks it: the only permitted diff in those mounts is the removed play
button + its now-dead wiring).
---
## 1. Guitar: ≤4 shapes, recommended-first (dashboard `dense` only)
### 1.1 What changes structurally
Today the rail's guitar station shows a **separate own-cell** (the KB play's
recommended shape, accent border, "play" badge — `GlanceRail` StationRow
:215-231) **plus** `VoicingBrowser`'s full gallery of *every* placeable shape
(`matchingShapes` :76 returns all). Two problems: (a) the recommended shape is
usually also in `matchingShapes`, so it renders **twice**; (b) `maj`/`min`/`dom7`
have 5-6 placeable shapes, so own-cell + gallery = 6-7 cells that wrap to a
second line.
**Decision:** centralise the ≤4 rule inside `VoicingBrowser` and **delete the
separate own-cell**. `GlanceRail` passes the recommended shape down; the browser
renders it as the badged first cell and caps the total.
- New `VoicingBrowser` props (additive, default-off so modal/dock stay
byte-identical): `recommended` (a shape object) and `max` (number).
- `GlanceRail` (dense rail) passes `recommended={st.shape}` and `max={4}`.
- Non-dense mounts (`ChordDetailModal` Guitar tab, `KnowledgeDock` VoicingsSection)
pass neither → they keep showing **all** shapes with no cap (a detail view
should be exhaustive; the ≤4 fit constraint is the rail's alone).
This removes the pre-existing duplicate and guarantees ≤4 in one place.
### 1.2 The top-4 selection rule (exact ordering + tiebreak)
`matchingShapes(quality, rootPc)` still returns every placeable shape. The rail
then orders and slices:
1. **Recommended first** — the KB play's shape (`recommended`, matched into the
list by `label`; if it was filtered out as unplaceable, prepend it anyway).
Badged `play`, accent border — "the answer" prominence the old own-cell had,
now cell #1 of the row.
2. **Open-position forms** — shapes with an `Array.isArray(shape.frets)` grip
(open chords). They sit at the nut, sound the most idiomatic, and are what a
player reaches for first.
3. **Movable / barre forms by lowest base fret ascending** — closest to the nut
first (easiest hand position, most common voicing). Base fret is the value
`matchingShapes` already computes (`mod12(rootPc OPEN_PCS[idx])`, 0→12).
4. **Tiebreak** at equal category/base fret: **fewer muted strings first**
(count of `'x'` in `frets`/`offsets` — a fuller voicing wins), then the
shape's **declared order in `GUITAR_SHAPES[quality]`** (stable, honours the
KB author's priority). Deterministic — no reflow flicker as the root moves.
Take the first **4** (recommended + up to 3 more, recommended deduped so it
never repeats). **Qualities with <4 placeable shapes just show what they have**
— the rule is a cap, never padding; nothing is invented to reach four.
### 1.3 It fits one line
Guitar `GalleryCell` (dense, **no play button** — see §3): `ChordDiagram` thumb
75px + p-1.5 (12) + border (2) = **89px** box. Four across:
```
4×89 + 3×6 (gap-1.5) = 356 + 18 = 374 ≤ 451 ✓ (a 5th would be 469 ✗)
```
Four shapes on **one horizontal line, no wrap, no scroll** — exactly the user's
"4 guitar options visible so it would fit without scrolling."
---
## 2. Piano: 2×2 of compact MiniPianos (dashboard `dense` only)
### 2.1 The grid
**Under `dense`** the four `pianoVoicing` styles (`root` / `shell` / `rootlessA`
/ `rootlessB`, `PIANO_STYLES` :67) render as a **2-column × 2-row CSS grid**
(`grid-cols-2 gap-1.5`) — one clean 2×2 per chord. **Non-dense** (VoicingsSection,
ChordDetailModal) keeps today's flex-wrap gallery at `MiniPiano size="thumb"`
(0.8) with ▶ — byte-identical. As with guitar, the **separate own-cell is
dropped for piano**; the 2×2 *is* the chord's voicings. If the station's
authored voicing corresponds to one of the four styles (match on
`voicing.style`), that cell gets the accent border — the "recommended" signal,
for free, without a fifth cell. (Fuzzy-authored voicings that match no style →
no highlight; honest.)
Because the own-cell is gone, the piano grid spans the **full row interior**
(the `basis-[320px] flex-1` gallery column grows to ~451px), so each of the two
grid columns is `(451 6)/2 = 222.5px`.
### 2.2 The scale — arithmetic
`MiniPiano` VOICING thumb geometry: `baseW = 22·(7·OCTAVES + 1) + 2`,
`SVG_W = baseW · scale`, `SVG_H = (60 + 4)·scale`. Today `thumb` scale = **0.8**:
| crop | baseW | SVG_W @0.8 | cell box @0.8 (+14) | two-up + gap |
|---|---|---|---|---|
| 1-octave | 178 | 142.4 | 156.4 | 318.8 ≤ 451 ✓ |
| 2-octave | 332 | 265.6 | 279.6 | **565.2 > 451 ✗** |
So 0.8 **cannot** put two 2-octave crops side by side (the brief's 532>456). The
2-octave crop (the rootless 7th-chord voicings — `rootlessA/B` of `min7`/`dom7`/
`maj7` whose span pushes past one octave) dictates the scale. Solve for a column
of 222.5px:
```
332·scale + 14 ≤ 222.5 → scale ≤ 208.5 / 332 = 0.628 (the ceiling)
```
**Chosen: a new uniform `size="mini"` at scale 0.60** — below the 0.628 ceiling,
leaving a robust ~19px margin for sub-pixel rounding and the classic-scrollbar
worst case:
| crop @ **0.60** | SVG_W | cell box (+14) | two-up + gap (6) | fits 451? |
|---|---|---|---|---|
| 1-octave | 106.8 | 120.8 | 247.6 | ✓ (203 spare) |
| 2-octave | 199.2 | 213.2 | **432.4** | ✓ (18.6 spare) |
`grid-cols-2` sizes every cell to the 222.5px column, so 1- and 2-octave cells
share one uniform grid — a true 2×2 at both crops. A thumb crop never exceeds
**2 octaves** (a 4-note `pianoVoicing` spans ≤24 semitones; `OCTAVES =
ceil((maxNote octStart·12)/12) ≤ 2`), so 2-octave is the proven worst case —
no 3-octave escape hatch needed.
### 2.3 Legibility at 0.60 — the marks stay honest
White key = 22·0.60 = **13.2px** wide (vs `ChordDiagram`'s 11px string gap —
comparable, legibly playable). The root/bass signal is carried **primarily by
colour**, which does not shrink in meaning: root key = full accent #a855f7, other
tones = ACCENT_SOFT #c084fc, bass = amber ring #fbbf24 — the established tier
language. The "R" glyph and the amber ring are secondary reinforcement. Because
the SVG viewBox scales text with the keys, at 0.60 the `R` renders ~4.8px and the
ring ~1.2px — thin. **So `size="mini"` bumps the in-SVG `R` fontSize (8→10 in
viewBox units) and the bass-ring `strokeWidth` (2→2.5)** so both stay readable at
the smaller render. This is an additive branch in `MiniPiano.jsx` (Muse-owned SVG
renderer); the existing `thumb`/`full` paths are byte-untouched, so the modal and
dock render identically.
### 2.4 Row height (piano)
`MiniPiano` mini SVG_H = 64·0.60 = **38.4px**. Piano `GalleryCell` (dense, no
play): caption ~13 + gap-1.5 (6) + SVG 38.4 + p-1.5 (12) + border (2) = **71.4px**.
Two rows + grid row-gap (6) = **148.8px** for the 2×2 block — versus the old
gallery's ~3 wrapped cell-lines of ~118px each (~366px). Nearly halved (§6).
---
## 3. Remove ▶ everywhere (deliberate global removal)
Standing principle (memory): **glance over audio.** The user settled it — "then
leave them off, better not." So ▶ comes off **every mount**: the dashboard rail,
the dashboard strip, **and** the Knowledge Center + `ChordDetailModal`. Because no
mount wants playback, the machinery is **deleted outright**, not gated — this is
intended, not a side-effect.
### 3.1 `VoicingBrowser.jsx` (L-70) — delete the play machinery
- The `PlayButton` component (:103-121).
- `import { playVoicing, guitarShapeToNotes } from '../lib/chordAudio'` (:62).
- `handleRef` + `stopCurrent` (:184-188) and the `useEffect(() => stopCurrent,
[chordKey])` cleanup (:191) — both now dead.
- `playGuitar` / `playPiano` handlers (:197-211).
- The `<PlayButton>` inside `GalleryCell` (:149) and its `playLabel`/`onPlay`
props; the `playLabel`/`onPlay` passed at each call site (:243-244, :280-281).
- The mic-feedback microcopy (:300-309) — nothing plays anywhere now, so the
caveat is false; delete it.
- Now-unused after the above: the `useRef`/`useEffect` imports and the `chordKey`
local (only the deleted effect read it). Update the file-header comment.
This is the **only** permitted change to the non-dense (VoicingsSection /
ChordDetailModal) render — those mounts are otherwise byte-identical (all shapes,
normal piano layout); the visual `dense`-fork of §1/§2 leaves them alone.
### 3.2 `GlanceRail.jsx` (L-70) — dashboard-exclusive
`GlanceRail` is mounted **only** by the JamGuide rail, so its edits never leak:
- Delete the footer microcopy "▶ previews play through your speakers…"
(:292-295); replace with nothing (or a quiet "voicings follow the loop").
- Delete the own-cell `<figure>` block (:215-231) — folded into `VoicingBrowser`
per §1; pass `recommended={st.shape}` + `max={4}`.
- Update the header comment (":45 …every ▶ lives inside the gallery").
### 3.3 The licks strip (L-71)
- **`LickCard.jsx` has no play path** — the guitar tab card never had a ▶
(verified: no `PlayButton`, no `chordAudio` import). Nothing to remove there;
the dock's `size="full"` LickCards are unchanged.
- **`PianoLickCard.jsx` is the only lick ▶.** Remove: `import { playVoicing,
stopAll } from '../lib/chordAudio'` (:73); the `PREVIEW_BPM`/`currentSeq`/
`stopLick`/`playLick` sequencer (:167-198); the `PlayButton` component
(:484-502) and its render (:606-609); the `useEffect(() => () => stopLick(),
[])` unmount silence (:530, then drop the now-unused `useEffect` import). Keep
the `resolveDegree` import — realization needs it.
### 3.4 `chordAudio.js` stays — verified importers
`grep chordAudio src/**` → importers are `VoicingBrowser.jsx` (▶ deleted in
§3.1), `PianoLickCard.jsx` (▶ deleted in §3.3), and **`BassPatternCard.jsx`**
(untouched — the bass-rail pattern previews the user did **not** ask to remove,
out of both locks); the rest are doc comments in `voicings.js`.
`ChordDetailModal.jsx` does **not** import it directly — it plays via
`VoicingBrowser`, so deleting that ▶ removes the modal's too, exactly as the
user's global decision intends. So `chordAudio.js` stays (for `BassPatternCard`),
but nothing in the voicing/lick UI plays.
### 3.5 The shared-sequencer blocker is eliminated
D-60 flagged that `BassPatternCard` and `PianoLickCard` each hold a **private
module-level `currentSeq`**, so their previews could layer once both mount — the
reason PianoLickCard was never wired into the strip. Removing PianoLickCard's
playback deletes its `currentSeq` entirely: **there is no piano sequencer left to
conflict with.** The strip becomes purely visual; `BassPatternCard`'s sequencer
lives only under the BASS selector (where the strip is hidden anyway). So
PianoLickCard wires into the strip (§5) with **no `currentSeq` collision** —
confirmed.
---
## 4. Hidden-but-scrollable dark scrollbars
### 4.1 Mechanism — a scoped utility, defined once in `index.css` (L-70)
```css
/* Thin, dark, overlay-feel scrollbars for the jam dashboard's scrollers.
Scoped (a class), NOT global — the KnowledgeDock/Debug/Tuner/Settings
below keep the OS default. Raw hex is unavoidable here: ::-webkit-scrollbar
pseudo-elements are not reachable by Tailwind utilities. The values mirror
the design tokens (border #2a2a2a, panel #1a1a1a). */
.dark-scroll {
scrollbar-width: thin; /* Firefox */
scrollbar-color: #2a2a2a transparent; /* thumb=border token · track transparent */
}
.dark-scroll::-webkit-scrollbar { width: 8px; height: 8px; } /* WebKit/Blink */
.dark-scroll::-webkit-scrollbar-track { background: transparent; }
.dark-scroll::-webkit-scrollbar-thumb {
background: #2a2a2a; border-radius: 4px; /* border token */
}
.dark-scroll::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
```
- **Scoped, not global** (`*`): the recommendation is a `.dark-scroll` opt-in
class. Global would restyle every scroller in the app (the whole normal-mode
page, the dock, Settings' full-screen scroller). The user's ask is about the
dashboard's rail; keep the blast radius there.
- **Raw-hex exception, flagged to Maestro:** the DoD says "no raw hex outside
`tailwind.config.js`," but `::-webkit-scrollbar` cannot consume a Tailwind
class. `index.css` (which already carries the raw `#0f0f0f` body background)
is the correct home; the values are documented as mirroring the `border`
token. No *new* colour — #3a3a3a hover is a one-step lift of the same family;
if Maestro prefers, use `panel` #1a1a1a for the base and `border` #2a2a2a for
hover instead (both existing tokens). Either is fine.
- Contrast: a #2a2a2a thumb on the #0f0f0f/#1a1a1a surface is intentionally
quiet — it is chrome, not content, so it is exempt from AA text contrast; it
is still clearly grabbable (the point of "make them black or something").
### 4.2 Where it applies — every dashboard scroll container
| # | scroller | file:line | task | note |
|---|---|---|---|---|
| 1 | **rail right column** `xl:overflow-y-auto` | `JamGuide.jsx:484` | **L-71** | the headline visible bar |
| 2 | left column (jam-view) `xl:overflow-y-auto` | `JamGuide.jsx:475` | L-71 | consistency |
| 3 | LicksStrip horizontal `overflow-x-auto` | `JamGuide.jsx:888` | L-71 | the licks row |
| 4 | per-cell `overflow-x-auto` (voicing) | `VoicingBrowser.jsx:148` | L-70 | rarely triggers now (§2) — apply for the edge case |
| 5 | timeline/keyboard `overflow-x-auto` | `PianoLickCard.jsx:576,585` | L-71 | wide-lick edge case |
**File-collision resolution (the brief's ask):** the rail's *outer vertical
scroller lives in `JamGuide.jsx`*, which is **L-71's exclusive lock** — not
`GlanceRail`, not `App.jsx`. So the class **definition** ships in `index.css`
(L-70), and each `className="… dark-scroll"` **application** is made by whichever
task owns the file it lives in: L-70 applies it in `VoicingBrowser` (#4), L-71
applies it in `JamGuide` (#1-3) and `PianoLickCard` (#5). The class exists before
L-71 runs because **L-71 depends-on L-70** (already in the ledger). Zero shared
files. The visible rail bar is styled in L-71 — acceptable, because that scroller
was always a JamGuide-column concern, not a `GlanceRail` one.
---
## 5. Licks: uniform size + follow the instrument
### 5.1 The strip follows the global instrument
`instrument` already reaches the strip: App's global selector → `JamGuide`
`instrument` prop (:177) → `LicksStrip({ …, instrument })` (:433-445, :863).
Today the strip **always renders `LickCard`** (guitar), even under PIANO, with an
apologetic heading "(no piano licks in the KB yet)" (:885). Change:
- `guitar` → `LickCard` (unchanged renderer).
- `piano` → `PianoLickCard` (wire it in — the D-60 component, never mounted).
Needs `rootPc` + `chordLabel` from the playhead `context` station (which
carries `rootPc`/`quality`/`label`), and each lick carries its own `quality`.
- `bass` → the strip is already gated off (:432/:439 `instrument !== 'bass'`);
render a slim honest line "No bass licks in the KB yet" instead of nothing, so
the section doesn't silently vanish when a bassist is selected.
The licks reader `licksFor(id)` (:136) is **hardcoded to
`instruments.guitar.licks`** — L-71 generalises it to
`licksFor(id, instrument)`, reading `instruments.piano.licks` under piano, and
**filtering piano licks to the structured ones** (those with a `notes` array) so
prose-only entries don't render as `PianoLickCard` placeholders (see §5.3).
### 5.2 Uniform footprint — measure, target, change
Both are wrapped by the strip in `w-[220px]` (closed) / `w-[340px]` (open)
(:894), so **width is already uniform**. The gap is **height** — the two SVGs
auto-size by different aspect ratios:
- **`LickCard` thumb** (`layoutTab`): viewBox 96 units tall (17 + 5·14 + 9),
`TabSvg` `maxWidth = width·1.3`; inside a 204px inner box it renders ~125px
tall. Card ≈ 163px.
- **`PianoLickCard` thumb** (`layoutLick`): height = 14 + `plotH` + 8 (+10 beat
row), `plotH = max(26, range·semi)` — **varies with the lick's pitch range**,
so a wide lick is much taller than a narrow one and neither matches LickCard.
**Target: a shared thumb card of `220 × 150px`** (closed), `340px` wide (open).
**Imposed at the dashboard-strip mount, not inside the cards** (per the scope
refinement — do not touch `LickCard`'s default footprint). The `LicksStrip`
wrapper (JamGuide, L-71) that already sets `w-[220px]`/`w-[340px]` (:894) also
sets a **fixed content height** and normalises the card's SVG to fill it, e.g.
`class="… h-[150px] [&_svg]:!h-[104px] [&_svg]:!w-full"`. The cards' SVGs already
carry a `viewBox`, so `preserveAspectRatio="xMidYMid meet"` (the SVG default)
scales the tab / timeline to the 104px box and centres it — **zero edit to
`LickCard` or `PianoLickCard` internals.** Every card — guitar tab or piano roll —
then occupies the **same box**, "all the same size," and flips instrument in
place. (The `maxWidth: width·1.3/1.4` inline caps mean a short lick renders
narrower than 220 and centres — the card *box* is uniform; content is centred.)
**Scope proof (KC untouched):** the fixed-box CSS lives on the **`LicksStrip`
wrapper only** — a dashboard-exclusive element. `LickCard`'s and `PianoLickCard`'s
own geometry is unchanged, so the dock's LicksSection `size="full"` LickCards
(:817) render **byte-identical** (the L-71 DoD asserts it). `PianoLickCard` has no
KC mount at all.
### 5.3 KB coverage + empty-per-style behaviour
Verified against the KB (`instruments.piano.licks` with a structured `notes`
array — PianoLickCard-renderable):
| style | guitar licks | piano licks (structured) |
|---|---|---|
| jazz, blues, gospel, rnb | ✓ | ✓ (P-60/P-61) |
| pop | ✓ | **prose only** (`over`/`description`) — not renderable |
| bossa, country, funk, reggae, rock | ✓ | ✗ |
- **Guitar:** all 10 styles have tab licks — the strip works everywhere.
- **Piano:** structured, renderable licks exist for **jazz, blues, gospel, rnb**
only. Pop's `piano.licks` are the old prose education entries (no `notes`) —
the structured filter drops them, so pop reads as empty under piano too.
- **Empty-per-style:** today the strip returns `null` when empty (hides). Keep
hide-on-empty for **guitar** (the default; a silent gap is fine). For **piano
with zero structured licks** (pop + the 5 styles above), show a **slim honest
line** — "No {style} piano licks yet" — because the user *actively switched to
piano* and a vanished section is confusing there. Same slim line for bass.
---
## 6. Recomputed budget
Per-station row (row p-1.5 12 + border 2 + header block ~54 + gallery):
| | gallery block | **new row** | pre-polish row |
|---|---|---|---|
| Guitar | 4 cells ×1 line, no ▶ = **105px** | **~173px** | ~207px (5-6 cells, ▶, wraps) |
| Piano | 2×2 mini, no ▶ = **148.8px** | **~217px** | ~445px (0.8, ▶, 3 wrapped lines) |
Rail overhead (section p-2 16 + border 2 + h4 title ~22 + footer ~40) ≈ 80px;
rows joined by `gap-2` (8px).
| loop | instrument | **new total** | pre-polish | Δ |
|---|---|---|---|---|
| 4-chord | guitar | 80 + 4·173 + 24 = **796** | ~932 | 15% |
| 4-chord | piano | 80 + 4·217 + 24 = **972** | ~1884 | **48%** |
| 8-chord | guitar | 80 + 8·173 + 56 = **1520** | ~1720 | 12% |
| 8-chord | piano | 80 + 8·217 + 56 = **1872** | ~3640 | **49%** |
**Headline: the piano rail nearly halves (48%), and the guitar row is now a
guaranteed single line (≤4, never wraps).** Every total still exceeds the 500px
column, so **the rail remains the dashboard's one vertical scroller** — which is
exactly what §2's dark thin scrollbar dresses, and what the user licensed ("it
can scroll if we need to"). The polish makes each row compact and the scroll
pretty; it does not (and need not) fit a whole loop in 500px.
---
## 7. Migration order + bounded scopes
**L-70 — the rail.** Files (file-disjoint from L-71):
`src/components/GlanceRail.jsx`, `src/components/VoicingBrowser.jsx`,
`src/components/MiniPiano.jsx` (new `size="mini"` + R/ring bump — additive),
`src/index.css` (define `.dark-scroll`).
Does: guitar ≤4 recommended-first, **dense-only** (§1); piano 2×2 mini @0.60,
**dense-only** (§2); ▶ **deleted globally** from `VoicingBrowser`, own-cell +
footer from `GlanceRail` (§3.1-3.2); `.dark-scroll` defined + applied to
VoicingBrowser's cell scroller (§4 #4). `MiniPiano.jsx` is safe to lock here — no
other polish task touches it (`PianoLickCard`/`LickCard` carry their **own**
keyboard geometry and do not import `MiniPiano`).
**DoD byte-identity:** the non-dense `VoicingBrowser` render (VoicingsSection +
ChordDetailModal) is byte-identical to today **except the ▶ is removed**;
`MiniPiano` `thumb`/`full` byte-untouched (new `mini` is additive).
**L-71 — the licks.** Files: `src/components/JamGuide.jsx` (LicksStrip +
`licksFor` + the fixed-box wrapper + the scroller classNames),
`src/components/PianoLickCard.jsx`. **`LickCard.jsx` is *not* edited** — it has no
▶ and its footprint is imposed from the strip wrapper (§5.2), so it drops out of
the lock (dock LicksSection unaffected).
Does: uniform 220×150 thumb via the **strip wrapper** (§5.2); instrument branch +
PianoLickCard wiring + piano/bass empty states (§5.1/5.3); ▶ deleted from
`PianoLickCard` (§3.3); `.dark-scroll` applied to JamGuide's three scrollers +
PianoLickCard's (§4 #1-3,5).
**DoD byte-identity:** the dock LicksSection's `size="full"` LickCards render
byte-identical to today (no ▶ existed to remove there).
**Serialise L-70 → L-71** (already the ledger's `depends-on`): they are
**file-disjoint** (no shared file — the `.dark-scroll` *class* is defined in
L-70's `index.css` and merely *referenced* by L-71's JSX, which is not a file
edit collision), and L-71 needs L-70's class to exist. `JamGuide.jsx` belongs to
**exactly one** task (L-71), so the rail-column scrollbar has a single owner — no
shared-file clash. Critic gates each; `C-70` closes the sprint.
### Rejected alternatives
1. **Shrink `MiniPiano`'s global `thumb` scale (0.8→0.6) instead of a new
`mini`.** Rejected — it also shrinks the `ChordDetailModal` and dock thumbs,
which have room to spare and benefit from the larger keys; a scoped `mini`
variant keeps those byte-identical and confines the change to the rail.
2. **Give 2-octave piano crops their own full-width row (mixed cell sizes) at a
larger scale (~0.7).** Rejected — it breaks the clean "2×2 for each chord" the
user asked for; a uniform 0.60 grid keeps every chord a tidy 2×2 and 0.60 is
still legibly playable (13.2px keys ≈ the guitar diagram's string gap).
3. **Keep the separate own-cell and cap the gallery to 3.** Rejected — it leaves
the ≤4 rule split across two components (own-cell in `GlanceRail`, cap in
`VoicingBrowser`) and preserves the today's recommended/gallery duplicate;
centralising in `VoicingBrowser` (§1.1) is one place, one rule, no dupe.
4. **Global `*` scrollbar styling.** Rejected — restyles the entire app
(dock/Debug/Tuner/Settings) for a dashboard-scoped ask; a `.dark-scroll`
opt-in class is surgical.
+314
View File
@@ -0,0 +1,314 @@
# Glance Mode — the Knowledge Center while the jam plays (task D-31)
> **Thesis:** while a loop is live, the Jam Guide section stops being "Roadmap + one
> thumbnail per chord, tap to see more" and becomes a **playhead accordion**: a
> station-aligned rail under the Roadmap where the *current* station's column is
> expanded to the full D-30 voicing gallery (every placeable guitar shape, or every
> piano style, side by side) and every other station shows its recommended thumb.
> The expansion **follows the playhead** — over one loop cycle you see every
> variation of every chord with **zero clicks**. A licks strip for the matched style
> sits directly below, auto-sorted to the chord you're on.
>
> User directive (2026-07-10, verbatim): *"expand the learn session so we see as
> much as possible in voicing variations and styles without having to click buttons,
> the idea is to have it open as the jam is playing."*
**Decision authority:** per the sprint header (user away, no user gate), Muse picks
the strongest layout and records rationale + rejected alternatives (§6).
Implementation is task **L-33**; this doc is its blueprint. Depends on **D-30**
(VoicingBrowser becomes an all-variations gallery — chips removed, every
shape/style rendered simultaneously, each with its own ▶).
---
## 0. What exists today (read from the code, not assumed)
- `JamGuide.jsx` §jam renders `RoadmapAssembly`: `RoadmapTrack` on top, then a
**voicing strip** — ONE thumb per station (ChordDiagram thumb 75×72 px, or
MiniPiano D-24 cropped thumb ≈142 px for a 1-octave voicing / ≈266 px for a
2-octave one), tap-to-enlarge → full diagram + a `VoicingBrowser` mount.
Variations are therefore **one click away per chord** — the exact thing the
directive kills.
- `canonicalPos` (playhead station index, canonical KB order) already exists and
already drives `scrollIntoView` on the strip. **All glance data is already in
the component.**
- `VoicingBrowser` (post-D-30) renders ALL matching guitar shapes side by side
(cells ≈90120 px wide) and all four piano styles side by side (cropped
MiniPiano thumbs ≈140 px+), each independently playable. Placeable guitar
shapes per chord: **35** (maj: 4 movable + 1 native open; min7/dom7/maj7: 34;
dim/half_dim: 2). Piano styles: always **4** (root/shell/rootlessA/rootlessB),
or the authored recipe (L-24) plus the computed four.
- `LickCard` has `size="thumb"` and `LicksSection` already knows how to read
`kb[style].instruments.guitar.licks` defensively.
---
## 1. Chosen layout — the playhead accordion
```
┌ KNOWLEDGE CENTER — iiVI in C major ────────────────────────────────── ▲ ┐
│ [▶ Jam Guide ●] [Explore] [Voicings] [Licks & Techniques] │
│ [🎸 Guitar][🎹 Piano][🎵 Bass] · [Jazz●][Blues][Rock]… │
│ ┌─ ROADMAP ──────────────────────────────────────────────────────────────┐ │
│ │ Dm7 (ii) ──C→B── G7 (V) «NOW» ──F→E── Cmaj7 (I) ▁▁▁▂█▂▁▁▁ beat │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
│ ┌─ VARIATIONS · follows the playhead ────────────────────────────────────┐ │
│ │ Dm7 ┃ G7 — every shape ┃ Cmaj7 │ │
│ │ [thumb] ┃ [E Barre][A7 Barre][D Shape][Open G7] ┃ [thumb] │ │
│ │ (recmd.) ┃ ▶ ▶ ▶ ▶ ┃ (recmd.) │ │
│ └─────────────┸───────────────────────────────────────┸───────────────────┘ │
│ ┌─ JAZZ LICKS · over the V7 first ─────────────────────────── (scroll) ──┐ │
│ │ [lick thumb «fits G7»] [lick thumb] [lick thumb] … │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
```
- **Columns = stations** (canonical KB order — the kb-plan §4 grid intent,
finally literal): the rail's columns sit under the Roadmap's stations, same
order, same labels/rn.
- **Active column = expanded**: the station at `canonicalPos` renders the full
D-30 gallery (`<VoicingBrowser rootPc quality show={instrument}/>`). Collapsed
columns render today's recommended thumb (the KB play's shape / the threaded
piano voicing) — so the loop context and lookahead never disappear.
- **The accordion advances with the playhead.** Chord changes are the animation;
nothing else moves. Constant footprint: expanding one column collapses the
previous one, so the rail never grows taller mid-jam.
- **Licks strip** below: thumb LickCards for the active style, level-filtered,
sorted current-chord-context first (see §2.4).
Why this wins: it satisfies "as much as possible without clicking" *without*
pretending everything fits at once (§3 shows it can't) — across one loop cycle
the player is shown 100% of the variations, always for the chord their hands are
on, which is when a variation is actually learnable.
---
## 2. Auto-follow rules (zero clicks, precisely)
1. **Driver = `canonicalPos`** (already computed in JamGuide from
`findLoopPosition` + `match.rotation`). Expanded column = `canonicalPos`;
`position === -1` (loop known but playhead unknown) → station 0 expands, so
the rail is never all-collapsed. The active column auto-scrolls into view
(`scrollIntoView({inline:'center'})` — the existing strip pattern, prop-driven
off `position`, **no rAF, nothing tied to the audio thread**). Respect
`prefers-reduced-motion`: `behavior: 'auto'` instead of `'smooth'` (new —
today's strip smooth-scrolls unconditionally; fix while in there).
2. **Instrument tab** (existing) selects the gallery family — guitar shapes vs
piano styles. It's a mode preference, not a per-chord click; it keeps its
current default/behaviour.
3. **Loop change** (`match.id` / style / instrument change): rail re-derives from
the new `stationVoicings`, any pin (§4) resets — this is the *existing*
`selectedStation` reset effect, renamed. **No loop matched but chords are
committing** (`currentChord` set, `match.matched` false): the rail degrades to
a single "heard live" gallery — `parseChord(currentChord)` (the same
`src/lib/voicings.js` parser `VoicingsSection` uses) → one expanded
VoicingBrowser, re-aimed on every chord commit. **Nothing heard at all**: the
existing dashed empty state; no rail, no licks strip.
4. **Licks strip**: `kb[activeStyle].instruments.guitar.licks` (the defensive
read `LicksSection`'s local `licksFor` helper already implements), shared
level filter applied. Sort: licks whose `chordContext` matches the current
station's rn or quality first, with an accent ring + "fits G7 — now"
microcopy on those; re-sorts as the playhead advances (a reorder of ≤4 thumb
cards, cheap). `chordContext` is **free text** — the match MUST be
token-boundary on rn/quality (a naive substring makes rn "I" match "♭VII",
"Imaj7", "I7"); never ship "fits G7" on a ♭VII lick. The ring + "fits — now"
microcopy are **strip-owned chrome** rendered around the card — LickCard
itself shows `chordContext` only at `size="full"` and stays untouched, as §5
promises. Licks are **guitar-only in the KB**: when the instrument tab is
piano, the strip still shows the guitar licks (consistent with the existing
Licks & Techniques section, which does the same) and says so in its heading
("guitar licks"). Style has no licks → the strip **hides entirely**; an
empty state would steal glance space to say nothing.
5. **No auto-sound, ever.** Auto-follow never triggers `chordAudio` — speaker
output feeds the live mic and would poison the detection that drives the
playhead (the L-20 caveat becomes a feedback loop). Every ▶ stays a gesture.
The rail shows the mic-feedback microcopy once, not per gallery.
6. **`onFocusChord` (D-03 Fretboard link) stays gesture-driven.** Auto-follow
does NOT emit focus-chord — repainting the main fretboard every 2 s
uninvited would fight the player's own key view. Only a pin (§4) emits it,
preserving today's semantics exactly.
---
## 3. Density & space budget — honest math
Geometry sources: dock body = 70vh; RoadmapTrack station min-width 168 px + 34 px
rail; ChordDiagram thumb 75×72 px (+label); MiniPiano cropped thumb 142 px
(1-octave voicing) to 266 px (2-octave, e.g. most rootless voicings) × ~51 px
tall; D-30 gallery cells ≈ 90120 px (guitar) / ≈ 140280 px (piano) wide,
≈ 140 px (guitar) / ≈ 125 px (piano) tall including label + ▶.
### 1280 × 900 (the target the task names)
Vertical: dock body 630 px section nav ≈ 49 instrument/style row ≈ 47
content padding 32 RoadmapTrack ≈ 230 gap 16 = **≈ 256 px glance budget**.
- Guitar rail (heading + one row of cells ≈ 190 px): **fits**. ~66 px spare.
- Piano rail (≈ 175 px): **fits**.
- Licks strip (thumb LickCard ≈ 165 px; heading + thumb row ≈ 190 px): does
**NOT** also fit — 190 + 190 = 380 > 256. It sits just below the fold,
reachable by the dock's existing vertical scroll (a flick, not a click).
Fully above the fold only from ≈ 1070 px window height. Said plainly:
**at 1280×900 you get Roadmap + the full variations rail without scrolling;
licks are one scroll-flick down.**
Horizontal (~1200 px usable): collapsed guitar column ≈ 95 px; collapsed piano
column ≈ 160280 px (D-24 crop width varies with voicing span); expanded guitar
gallery 35 cells ≈ 340540 px. **Expanded piano gallery — the honest figure:**
root/shell cells are 1-octave crops ≈ 160 px, but **rootless A/B of any true-7th
chord span past one octave** (e.g. Dm7 rootlessA → notes [17, 21, 24, 28]), so
D-24's crop gives them a 2-octave keyboard = 266 px thumb ≈ 284 px cell. The
gallery is therefore 160 + 160 + 284 + 284 + gaps + section p-3 ≈ **940 px**
not the ~640 px four 1-octave cells would suggest.
| Loop | Guitar rail width | Piano rail width | One row? |
|---|---|---|---|
| 34 stations | 23×95 + ~450 ≈ **640740 px** | 23×~200 + ~940 ≈ **13501550 px** | guitar ✓ · piano ✗ (scrolls at ~1200 usable) |
| 8 stations (post-L-30) | 7×95 + ~450 ≈ **1115 px** | 7×~200 + ~940 ≈ **2300 px** | guitar ✓ (just) · piano ✗ |
**Cut order (what goes first):**
1. **Licks strip drops below the fold** (never cut, just deferred to scroll).
2. **Rail scrolls horizontally** with the active column auto-centred (the
existing strip pattern) — cells are **never shrunk** below the D-30 sizes;
a diagram you can't read is worth less than one you scroll to. This is the
piano rail's **normal state on any loop containing 7th chords — i.e. most
of them** (a rootless gallery is ~940 px on its own), not just long loops;
L-33's commit-5 viewport check must expect the piano rail to scroll, never
assert "one row fits".
3. **Narrow only (§ below): collapsed columns reduce to "next" only.**
### ~640 px wide (half-snapped window)
~576 px usable. The rail flips to the kb-plan §4 narrow rule — one thing per row:
- Row 1: the expanded gallery for the current station (guitar: 5 cells wrap to
2 rows ≈ 300 px; piano: 4 cells wrap to 2 rows ≈ 260 px).
- Row 2: a single **"next: Cmaj7"** collapsed thumb (lookahead is the one piece
of context worth its pixels at this width); other stations are dropped — the
Roadmap above still shows the whole loop.
- Licks strip: single-column, below, via vertical scroll.
Glance guarantee at narrow = **current chord's full gallery + the next chord's
thumb**, no interaction.
### 1280 × 800 (the older Electron-default figure in D-20)
Budget shrinks to ≈ 186 px — the guitar rail (~190 px) is 1 row of cells with the
heading merged into the rail's top edge (drop the standalone heading line,
18 px) and fits; everything else as at 900.
---
## 4. Interaction stays optional (but stays)
Nothing essential is behind a click; everything useful still responds to one:
- **▶ per gallery cell** (D-30): audition that voicing. Keyboard-reachable,
descriptive `aria-label`s, one-at-a-time playback (D-30's stop-previous
contract).
- **Pin a station**: tapping a *collapsed* column pins its gallery open,
overriding auto-follow (the accordion stops moving) — this **replaces**
today's tap-to-enlarge and inherits its semantics: the pinned station emits
`{rootPc, quality}` via `onFocusChord` (D-03 Fretboard guide tones), and the
existing reset effect (loop/style/instrument change → null) clears it.
Unpin = tap again or tap the visible "follow the jam" chip that appears while
pinned. `aria-pressed` on columns, `aria-current` on the live one.
- **Tap a lick thumb** → the card enlarges inline (`size="full"`); tap again to
collapse. The thumb already shows the full tab shape — enlarging is comfort,
not information.
- **Chord label tap** → `onChordClick` → ChordDetailModal, as everywhere else.
Focus order follows DOM order (columns left→right, then licks); all targets keep
`focus-visible:ring-2 ring-accent`, min 32 px height. Tokens only — everything
here uses existing `surface/panel/border/accent` + amber; **no new colour**.
Contrast inherits the measured D-20 §8 commitments (accent small text on
`bg-surface` cards; gray-400 floor for load-bearing labels; gray-500 microcopy
only).
---
## 5. Migration order for L-33 (green at every commit)
**App.jsx contract: UNTOUCHED — zero changes, not even additive.** Every input
glance mode needs (`detectedProgression`, `keyInfo`, `chordHistory`, `bpm`,
`currentChord`, `onFocusChord`, `onChordClick`) already flows into JamGuide.
Audio callbacks are therefore untouched by construction. If L-33 finds a gap,
the rule is prop-addition-only on the existing mount, never a callback/ref edit.
Files (for Maestro to re-lock at promotion):
| File | Kind of change |
|---|---|
| `src/components/GlanceRail.jsx` | **NEW** — pure presentational: props `{ stations, activeIndex, pinnedIndex, onPin, instrument, keyRoot }`; composes collapsed thumbs (existing ChordDiagram/MiniPiano) + one `<VoicingBrowser show={instrument}/>` for the expanded column |
| `src/components/JamGuide.jsx` | **Restructured (jam section only)** — RoadmapAssembly's voicing strip + enlarge block replaced by GlanceRail + LicksStrip; `selectedStation` becomes `pinnedStation` (same reset effect, same `onFocusChord` wiring); `licksFor` — today a closure-local function inside `LicksSection` (JamGuide.jsx:489), not an export — is **lifted out during the restructure** and shared with the strip. Sections 24, the shell, nav, and collapsed bar untouched |
| `src/components/VoicingBrowser.jsx` | **Additive-optional** — a `dense` prop (trim section padding, suppress the per-mount mic microcopy since the rail shows it once). Skip entirely if the D-30 cells already sit within the §3 budget |
| `src/components/LickCard.jsx` | **Untouched** (`thumb`/`full` already exist) |
| `src/App.jsx`, `RoadmapTrack.jsx`, `MiniPiano.jsx`, `ChordDiagram.jsx`, all `src/lib/**` | **Untouched** |
Commit order:
1. **Extract `GlanceRail.jsx`** rendering *today's* strip behaviour verbatim
(thumbs + tap-to-enlarge), JamGuide mounts it — a pure move, zero visual diff.
2. **Accordion**: expanded column = `activeIndex` (auto-follow off
`canonicalPos`), pin/unpin replaces tap-to-enlarge, the VoicingBrowser mount
moves from the enlarge block into the expanded column; reduced-motion guard
on the auto-scroll.
3. **No-loop fallback**: `parseChord(currentChord)` single gallery.
4. **LicksStrip**: thumb cards, level filter, context-first sort + live ring,
hide-when-empty, tap-to-enlarge.
5. **Narrow reflow + cut rules** (§3): horizontal-scroll behaviour, ≤640 px
next-only collapse; check 1280×900, 1280×800, ~640 px.
Each commit: `npm run build` + `node scripts/smoke.mjs` green; Critic gates.
---
## 6. Rationale + rejected alternatives (no user gate this sprint)
**Chosen — playhead accordion**, because: (a) it is the kb-plan §4 grid
(columns = chords, active-column highlight, narrow → one-per-row) applied to
variations; (b) constant footprint that survives 8-station loops (L-30) instead
of degrading; (c) 100% of variations shown per loop cycle with zero clicks, and
always for the chord under the player's hands — the moment a grip is learnable;
(d) it *reuses* D-30's gallery as-is and App.jsx needs nothing.
**Rejected A — "everything expanded" grid** (every station × every variation at
once — the literal maximal reading of the directive). Killed by §3's math: piano
is 4 stations × 4 styles = 16 cells at the honest §3 sizes (rootless cells
≈ 284 px) ≈ **3,500+ px** wide, or 3+ wrapped rows ≈ 480 px
tall — both force scrolling *while playing*, which is worse than zero clicks:
it's continuous manual tracking. At 8-station loops it's hopeless on any
viewport. Guitar-only at exactly 3 stations barely fits — a layout that only
works for its demo case is not a design.
**Rejected B — "Now panel"** (full-width mega-view of only the current chord:
giant gallery + licks + scale, no station columns). Maximum per-chord detail,
but it discards lookahead — mid-jam the *next* chord matters more than the one
already sounding — and at 120 BPM a 4-chord loop swaps the entire panel every
~2 s: visually violent, nothing is on screen long enough to read. The accordion
keeps 80% of the detail and all of the context.
**Rejected C — side-by-side split** (Roadmap left, variations dock right).
A 4-station track already needs 4×168 + 3×34 ≈ 774 px; splitting 1280 gives it
~640 — the flagship Roadmap gains a permanent horizontal scrollbar to make room
for a panel that duplicates its station order 90° rotated. Collapses entirely at
narrow. Rejected on viewport economics.
**Rejected D — timed carousel** (auto-cycle variations for the current chord
every N seconds). Zero clicks, technically — but motion untied to the music is
the most distracting thing a stage display can do, and it invents a second clock
next to the playhead. The music already provides the rhythm of change; follow it.
---
## 7. Out of scope / flags for Maestro
- **Explore/Voicings/Licks sections**: unchanged; glance mode lives entirely in
the jam section. (The Voicings section already follows `currentChord` — that
behaviour is untouched.)
- **Piano collapsed-thumb width variance** (142266 px per D-24's span-crop) is
the piano rail's main width pressure; if Critic finds real loops where it
reads badly, a future D-task could cap collapsed piano thumbs to a 1-octave
window around the bass — **not** in L-33's scope.
- **`dense` prop on VoicingBrowser** is optional and Muse-owned; L-33 should
attempt the rail with plain D-30 cells first.
- No new tokens, no new dependencies, no KB/theory/audio changes anywhere in
this design.
+422
View File
@@ -0,0 +1,422 @@
# Integrated Glance — the Jam Guide joins the main module (task D-40)
> **Thesis:** the Jam Guide stops being the last collapsible at the bottom of the
> page and becomes a **full-width, always-open band directly below the instrument
> view** — the third element of the main module. The loop is shown **once**, in
> ProgressionBanner (where the user says it already lives); the Roadmap track
> retires and its education (solo scales, guide tones, voice-leading) folds into
> the rail's station headers. The rail itself flips from the D-31 playhead
> accordion to **all stations expanded at once, as vertical rows** — every loop
> chord's full voicing gallery permanently visible, the playhead highlighting
> (never revealing) the active row. One global GUITAR/PIANO/BASS selector — App's
> existing `instrument` state — drives everything.
>
> User directive (2026-07-10, verbatim): *"i would like to move it up and
> integrate it somewhat in the space of the main module up top. or maybe right
> below it as it is super important. … i would like to be able to see the loop
> clearly, no need to have this repeated again. as its already in the main module
> … only one selection for GUITAR/PIANO/BASS and everything should show in that
> instrument. … i'd like to see all the chords and their voicings in a specific
> way in case a loop is detected (or at least just like 4 chords or something at
> least, so you can follow and potentially learn new ways to play it while you
> are playing the loop.) scrolling is easier then clicking"*
**Decision authority:** per the sprint header (no user gate), Muse picks the
strongest option and records rejected alternatives (§7). Implementation is
**L-40** (App restructure, §6.1) then **D-41** (rail rework, §6.2). This doc
supersedes `glance-mode.md` §1's accordion where they conflict — the user's
scroll license overturns D-31's "everything expanded" rejection (Rejected A
there), with the axis flipped to vertical (§4).
---
## 0. What exists today (read from the code)
App.jsx mount order: `ProgressionBanner` (~609) → instrument row (~618630:
`Fretboard`/`BassFretboard`/`Piano` at 70% + `ProgressionSuggestions` 30%) →
`CurrentJamPanel` (~634) → `LoopStation` (~642) → Debug/Drum/Tuner collapsibles →
**`JamGuide` last (~712)**. The global `instrument` state (App.jsx:58,
`'piano'|'guitar'|'bass'`) has its selector in the controls bar (~484) and drives
the main instrument views + DebugView — but **JamGuide ignores it** and runs its
own internal Guitar/Piano/Bass tabs (JamGuide.jsx ~405434, local state ~208).
The detected loop renders **twice**: ProgressionBanner's loop row (compact chips,
active chip highlighted via `findLoopPosition`) and `RoadmapTrack` inside the
JamGuide jam section (stations with solo-scale labels, guide-tone dots,
voice-leading rails, playhead + beat grid). Below the Roadmap, `GlanceRail`
(L-33) is a playhead **accordion**: one station's gallery expanded at a time —
the exact "it changes when the chord is not playing" complaint.
---
## 1. Placement — a full-width band directly below the instrument view
**Chosen: the Jam Guide content mounts as a full-width, always-open band
immediately below the instrument row, replacing `CurrentJamPanel`'s slot (before
`LoopStation`).** The four-section Knowledge Center dock stays at the bottom as
the browse/study area, minus its jam section (§5).
Why *below* the main module and not *inside* it:
- **Width math kills "inside".** The only free space inside the main module is
the 30% `ProgressionSuggestions` column (~360px at 1280) and the banner's
interior. A single piano station's gallery is **~1,178px** worst case: the
gallery calls `pianoVoicing` with no `prev` (VoicingBrowser.jsx:161), and
MiniPiano's D-24 crop is C-aligned (`octStart = floor(minNote/12)`), so any
station rooted **above D** crosses the C boundary even in root position and
shell — recomputed G7: root [7,11,14,17], shell [19,23,29], rootlessA
[23,26,29,33], rootlessB [17,21,23,26] → **all four cells are 2-octave 284px
crops** ≈ 4×284 + 24 gaps + 18 chrome ≈ 1,178px. (glance-mode.md's ~940px was
the Dm7-specific figure; 1-octave root/shell crops exist only for roots CD.)
Nothing gallery-shaped fits inside the module without crushing the neck/keys —
the surface the player's eyes track continuously.
- **"The main module" to the user = banner + big instrument view** — the
real-time detection surface. The guide answers a different question ("what
can I play on each chord of this loop") at a different rhythm (study-while-
looping). Directly below = one saccade down, same screenful top edge, no
competition for the detection pixels. The user himself offered "or maybe
right below it" — and the space math makes that the only honest reading.
- **Always open, zero chrome.** No collapse header (scroll past it if unwanted
— scroll > click), no section nav, no internal instrument tabs, no style
tabs, no level chips. The band is a pure auto surface: detection picks the
loop and style, the ONE controls-bar selector picks the instrument. The
`styleOverride`/style-tab machinery (JamGuide.jsx ~210212, ~438458) **dies
with the tabs**: the band always follows `match.style`; the heard-live
LicksStrip's `styleId` falls back to `styles[0]` when nothing is matched;
browsing OTHER styles stays reachable via the dock's own style chips
(LicksSection and ExploreSection each keep theirs). When no loop is matched
the band degrades to the existing "heard live" single gallery for
`currentChord`; when nothing is heard, a slim one-line hint (~40px) so it
never wastes main-module space.
- The band gets a micro-header line (`JAM GUIDE — {matched name} · in C major`,
uppercase tracking-widest gray-500 style), not a button.
Vertical position at 1280×900 (~860px usable): header ≈56 + controls bar ≈52 +
banner ≈140 + instrument row ≈300 + margins ≈24 → **the band starts ≈570px
down**; its first ≈290px are visible at rest, and one scroll-flick puts the
whole rail at the top of the viewport (§4 math). Estimates for the module
heights; verified figures for the rail.
---
## 2. The single loop display — ProgressionBanner survives, RoadmapTrack retires
**Call: ProgressionBanner's loop row is THE loop display. RoadmapTrack is
unmounted** (L-40 removes the import/mount; the file stays in place like the
EducationPanel precedent — deletion filed to backlog).
The user told us where the loop lives: *"no need to have this repeated again.
as its already in the main module"* — i.e. the banner. The banner is compact,
up top, always visible, and **already carries the playhead**: `findLoopPosition`
highlights the active loop chip (accent glow + amber rn). There is nothing to
absorb on that front — the beat grid's "current beat" was chord-accurate anyway
(RoadmapTrack's own comment: "coarse, chord-accurate — matches
ProgressionBanner"). **ProgressionBanner.jsx needs zero edits.**
Honest disposition of RoadmapTrack's unique value:
| RoadmapTrack feature | Disposition |
|---|---|
| Playhead (active station) | Already in the banner's loop chips — nothing lost |
| Beat grid + progress bar | **Dropped.** It never showed sub-chord progress (chord-accurate by construction); the BPM readout already lives in the controls-bar badge. Loss: the downbeat tick visual. If missed, a slim progress underline beneath the banner's loop chips is a future 1-point polish — explicitly NOT in L-40/D-41 |
| Solo-scale label per station ("G mixolydian") | **Folds into each rail row's header** (§4) via `soloScale` from theory.js |
| Guide-tone lane (3rd filled / 7th hollow dots) | **Folds into each rail row's header** ("aim" dots, same accent-filled/hollow language) via `guideTones` |
| Voice-leading rails (7→3 half-step arrows) | **Folds into a compact transition chip** at the end of each row header: "next: F→E · ½ step down" (via `voiceLeadingPairs`; wrap-around chip on the last row says "loop"). The between-columns arrow SVG dies; the information survives |
| Station "next" lookahead glow | Superseded: next row gets a small "next" tag; the whole loop is visible anyway |
Interim honesty: L-40 unmounts RoadmapTrack **before** D-41 builds the row
headers, so for one gate cycle the solo-scale/guide-tone/voice-leading education
is absent from the page (the banner still shows the loop; the accordion rail
still shows voicings). Accepted — D-41 follows immediately in the same serialized
chain; Critic should not flag the gap as a regression.
---
## 3. Instrument threading — one selector, honest bass
JamGuide's internal `INSTRUMENTS` tabs, `COMPUTED_INSTRUMENTS`,
`availableInstruments`, and local `instrument` state (JamGuide.jsx ~4247, ~178
184, ~208, ~405434) are **deleted**. App's existing `instrument` flows down as
a prop. Full prop paths to every consumer:
| Consumer | Path |
|---|---|
| GlanceRail (band) | `App.jsx instrument` (line 58) → `<JamGuide instrument={instrument}>``<GlanceRail instrument={instrument}>` (prop already exists; only its source changes) |
| VoicingBrowser, heard-live fallback (band) | App → JamGuide → `<VoicingBrowser show={instrument}>` (JamGuide.jsx ~494) |
| LicksStrip (band) | App → JamGuide → `<LicksStrip instrument={instrument}>` (both mounts, ~498 and ~757) |
| `stationVoicings` memo (band) | App → JamGuide — the memo's `instrument` dependency reads the prop |
| VoicingsSection (dock) | App → `<KnowledgeDock instrument={instrument}>` (§5) → `<VoicingsSection instrument={instrument}>` → its `<VoicingBrowser show={instrument}>` (ExplorePanel.jsx:425, today defaulting to `'both'`) |
| LicksSection (dock) | **No prop** — LicksSection is a module-local function in **JamGuide.jsx:562** (NOT an ExplorePanel export), and its heading is already statically honest ("Guitar licks · tab reads high e on top…"); licks are guitar-only in the KB (C-20 schema), so an `instrument` prop would be dead on arrival. Recorded so nobody threads it |
| ExploreSection (dock) | **No prop needed** — it renders progression chips + famous progressions, no instrument-specific renderer; chord taps open ChordDetailModal, which has its own user-driven Guitar/Piano tabs. Recorded so nobody threads a dead prop |
| DebugView | Already receives `instrument` (App.jsx ~676) — untouched |
The only `ExplorePanel.jsx` signature change is
`VoicingsSection({ keyInfo, chordHistory, currentChord, instrument })`
(its named exports are LevelChips / ChordPickerToolbar / GuitarGrid / PianoGrid /
ExploreSection / VoicingsSection — no LicksSection there).
### The honest bass state (until C-41/P-41/L-42 land)
BassFretboard covers the main view; the KB has **zero bass content** and both
gallery generators are wrong for bass (guitar shapes are not bass patterns;
`pianoVoicing` is piano). Showing guitar diagrams under BASS would break the
one-selector promise the user just made. Instead, when `instrument === 'bass'`
and a loop is matched:
- Station rows still render their full headers — chord, rn, solo scale, aim
dots. **Guide tones ARE the bassist's target notes**; none of this is
instrument-specific.
- The gallery slot renders a computed **root · fifth · approach** line per
station: root name, fifth name, and the chromatic approach into the NEXT
station's root ("approach: G♯ → A", computed from `stations[i+1].rootPc 1`
semitone — pure arithmetic on data the component already has; **no theory.js
change**). This is the honest useful minimum, not a placeholder.
- ONE notice for the whole rail (not per row): *"Authored bass patterns are on
the way (blues first) — meanwhile: roots, fifths, and the approach into the
next chord."*
- The licks strip hides under bass (guitar tab licks are noise to a bassist
mid-jam; under piano the strip keeps today's honest "guitar licks" heading).
**What L-42 slots in:** a per-station `<BassPatternCard>` (new component,
Luthier/Muse per the C-41 schema — 4-string, frets 015) mounted in the same
gallery slot of each row, replacing the computed line **when the matched style
ships a bass cell**; the computed root/fifth/approach line remains the
per-station fallback for styles without bass content. The rail's row structure,
highlight, and header need zero changes for L-42 — that's the contract.
---
## 4. The all-stations-expanded rail — vertical rows, playhead highlights
**Axis call: stations are VERTICAL ROWS** — one row per loop chord, each row =
station header + that chord's full horizontal voicing gallery; the page scrolls
down. All rows render all cells, always. **The playhead HIGHLIGHTS the active
row and never hides, collapses, or reveals content.**
Why vertical beats all-horizontal: a 4-station piano loop laid out as expanded
columns is ≈4 × 1,470px ≈ **5,900px wide** — continuous sideways tracking while
playing, on the axis mouse wheels don't scroll. Vertically, the worst piano row
is ≈ 284 (threaded cell — an authored LH 3-5-7-9 also crops 2 octaves) + 8 +
1,178 (§1 gallery) ≈ **1,470px of cells**, which does NOT fit 1,240px usable —
the gallery **flex-wraps to a second cell line** (~300px row height). **No
horizontal scroll survives because rows wrap, not because they fit.** Rows stack
~170300px tall and ≥4 chords sit within one to one-and-a-half screenfuls —
the "at least 4 chords so you can follow" ask, under the user's scroll license.
### Row anatomy (canonical KB order, same as the banner's loop after rotation)
- **Header (~30px):** chord label (gray-100 bold) + rn + "now" badge (accent,
when active) / "next" tag · solo-scale label ("solo · G mixolydian") · aim
dots (3rd filled accent, 7th hollow — RoadmapTrack's GuideDot language,
honest "5th" fallback kept) · transition chip ("next: F→E · ½ step down";
last row: "loop"). Header data via theory.js `guideTones` /
`voiceLeadingPairs` / `soloScale` — read-only imports.
- **Gallery:** first cell = the *station's own* voicing — guitar: the KB play's
recommended shape badged "play" (when present); piano: the threaded/authored
`stationVoicings[i].voicing` labeled honestly (e.g. "LH 3-5-7-9") — this is
where the accordion's collapsed-thumb value survives. Then the full
VoicingBrowser gallery (`show={instrument}`, `dense`): every placeable guitar
shape / all four piano styles, each with its own ▶ (D-30 one-at-a-time
playback contract). Bass: the §3 computed line (later the L-42 pattern card).
- **Active row:** `border-accent ring-2 ring-accent bg-accent/10` + "now" badge
+ `aria-current="true"`. Inactive rows `border-border bg-surface`, opacity
floor 0.85 (never dim below AA). Tokens only; no new colour.
- **Mic-feedback microcopy** once below the last row (rail-owned; galleries run
`dense`), as today.
### Focus semantics — pin simplified
With everything always expanded, the pin has nothing to hold open. It collapses
to a **focus toggle**: tapping a row header toggles that station as
`focusedStation` (renamed from `pinnedStation`, same JamGuide-owned state, same
reset-on-loop/style/instrument-change effect, same `onFocusChord({rootPc,
quality})` emission — the D-03 fretboard guide-tone contract is byte-compatible).
A focused row shows an "aim on fretboard" chip; tap again (or the loop changes)
to clear. `aria-pressed` on the header button, min 32px target,
`focus-visible:ring-2 ring-accent` everywhere.
**No auto-scroll.** The band lives in page flow, so `scrollIntoView` would yank
the whole page while the user reads the looper below — the accordion's
auto-centre effect is **removed**, not ported (deleted in the same L-40 commit
that promotes the band, §6.1 step 2 — today it is contained only by the dock's
70vh scroller, which the band no longer has). The playhead highlight travels;
the user owns the scrollbar (their explicit preference). On 4-row loops the
whole rail is one screenful anyway; on 8-row loops the banner up top always
shows the position. (Internal-scroll variant rejected: a nested scrollbar caps
the rail at ~62vh ≈ 3 rows — breaks the ≥4-visible goal at 900px.)
### Licks strip
Directly below the last station row, unchanged in behaviour: thumb LickCards
(~165px wide, strip ≈190px tall with heading), context-sorted to the playhead
station via the token-boundary matcher, strip-owned "fits X — now" ring, hides
entirely when the style has no licks, hidden under bass (§3). One flick below
the rows — consistent with its D-31 position in the scroll order.
### Space math (verified numbers: guitar cell ~93px, piano cells 160284px, piano gallery ~1,178px worst — §1, licks thumb ~165px)
Row heights: guitar row ≈ header 30 + cells ~140 + padding ≈ **185px**; piano
row ≈ 30 + one cell line ~125 + padding ≈ **170px** single-line, ≈ **300px**
when the gallery wraps to two cell lines. Row widths (cells): guitar ≈ play
cell + 35 gallery cells ≈ **460650px**; piano ≈ threaded cell up to ~284 +
gallery up to ~1,178 ≈ **~1,470px worst case**. Piano rows rooted above D with
a true 7th — i.e. most stations of most jazz/gospel loops — exceed 1,240px and
**wrap** (single-line piano rows exist only for roots CD or triad qualities);
rows never scroll horizontally.
| Scenario | 1280×900 (~1,240×860 usable) | ~640px wide (~576 usable) |
|---|---|---|
| 4-chord loop, guitar | 4×185 = **740px** — all 4 rows in one screenful (band scrolled to top); +190 licks strip = one flick more | cells fit one line (5×93+gaps ≈ 500); 4 rows ≈ 740px ≈ 1.3 screenfuls |
| 4-chord loop, piano | best case (roots CD / triads) 4×170 = **680px** ≈ one screenful; honest 7th-chord case (the jazz flagship): rows wrap → up to 4×300 ≈ **1,200px ≈ 1.4 screenfuls** — still zero clicks; the scroll license covers it | gallery wraps to 23 cell-lines → row ≈ 300430px; 4 rows ≈ 1,2001,700px ≈ 23 screenfuls, zero clicks |
| 8-chord loop (post-L-30) | guitar ≈ 1,480px ≈ **1.7 screenfuls** / piano ≈ up to 2,400px ≈ **2.8 screenfuls** — scroll, highlight travels, banner keeps the position | ≈ 2.56 screenfuls; still zero clicks |
At rest (no scroll) the band's visible ≈290px shows the header line + ~11.5
rows — enough to see the "now" row when it's early in the loop; one flick brings
the rail to the top. The user licensed exactly this trade.
---
## 5. What remains below — the dock slims to three sections, CurrentJamPanel retires
- **`KnowledgeDock`** (named export from JamGuide.jsx, §6.1): the bottom
collapsible keeps **Explore / Voicings / Licks & Techniques** — the browse
and study area (chord picker, KB progression browser, full lick grids, the
shared level filter). The **jam section is removed** (it IS the band now);
the dock's header drops the live match label and becomes static ("Knowledge
Center — browse & study"). Level-filter chips stay dock-only; the band shows
all levels (a glance surface filters nothing — directive 4).
- **`CurrentJamPanel` is unmounted by L-40.** The backlog already flags folding
it; the band moving into its exact slot makes its duplication terminal
(voicing strips → the rail; similar progressions → Explore; per-chord scale
labels → row headers). Honest loss: its mode-level `SCALE_IDEAS` prose and
`STYLE_VARIATIONS` cards exist nowhere else — the existing backlog item
("fold CurrentJamPanel's unique bits into the Knowledge Center") stays open
for Professor/Muse; the file is retired-in-place, deletion filed with
EducationPanel's. Note for Maestro: only `RiffDiagram.jsx` goes orphaned with
it — `ChordBox.jsx` is still imported by ChordDetailModal.jsx (lines 2, 58)
and ExplorePanel.jsx (lines 18, 170) and must **NOT** be deleted.
- **LoopStation** does not move — the band replaces `CurrentJamPanel` directly
above it, so it ends up right below the jam surface it feeds for free.
Debug/Drum/Tuner collapsibles unchanged.
- **ChordDetailModal, ProgressionSuggestions, Fretboard/Piano/BassFretboard,
ProgressionBanner:** zero edits.
Resulting App.jsx order: banner → instrument row → **Jam Guide band**
LoopStation → Debug → Drum → Tuner → **KnowledgeDock**.
---
## 6. Migration order — bounded scopes, green at every commit
Serialized: L-40 → D-41 (same surfaces). Each commit: `npm run build` +
`node scripts/smoke.mjs` green; Critic gates.
### 6.1 L-40 (Luthier) — App restructure + instrument threading + single loop display
**Files:** `src/App.jsx` (mounts + prop pass ONLY — 🚨 audio callbacks, refs,
AudioCapture props untouched, grep-gated), `src/components/JamGuide.jsx`,
`src/components/ExplorePanel.jsx` (VoicingsSection signature only — LicksSection
lives in JamGuide.jsx), `src/components/GlanceRail.jsx` (**one-line effect
deletion only**, see step 2 — re-lock at promotion per the ledger row).
**Not touched:** RoadmapTrack.jsx / CurrentJamPanel.jsx (unmounted, not edited),
ProgressionBanner.jsx, VoicingBrowser.jsx, all `src/lib/**`.
1. **Thread the instrument.** App passes `instrument` to the JamGuide mount;
JamGuide deletes its internal tabs/state/availability gating and consumes
the prop everywhere (§3 table); VoicingsSection gains the prop. Guide still
at the bottom, four sections intact. Green.
2. **Split and promote.** JamGuide.jsx → default export `JamGuide` (the band:
micro-header + jam content, always open, no section nav) + named export
`KnowledgeDock` (collapsible, 3 sections, level filter). App mounts the band
in CurrentJamPanel's slot, retires the CurrentJamPanel mount, keeps the dock
last. **RoadmapTrack unmounted** (loop now shown exactly once — the banner).
The band body for now = existing GlanceRail accordion + LicksStrip +
heard-live/empty fallbacks. **Same commit, mandatory:** delete GlanceRail's
auto-centre effect (GlanceRail.jsx:5667 `scrollIntoView`) — it is contained
today only by the dock's 70vh `overflow-auto` body; in page flow the nearest
scroller is the DOCUMENT, so every playhead advance would yank the whole
page — the exact failure §4 forbids. Promoting the band and deleting the
effect must land together. Green.
3. **Honest bass state.** `instrument === 'bass'` + loop matched → the §3
computed root/fifth/approach rows + single notice (band-level; no further
GlanceRail edits). Green.
### 6.2 D-41 (Muse) — the all-expanded rail
**Files:** `src/components/GlanceRail.jsx` (rework), `src/components/JamGuide.jsx`
(band wiring: pass `keyMode`, `pinnedStation``focusedStation` rename,
LicksStrip/bass-slot composition into rows), `src/components/VoicingBrowser.jsx`
(**optional**, `dense`-path styling only). **Not touched:** App.jsx,
RoadmapTrack.jsx, ProgressionBanner.jsx, MiniPiano/ChordDiagram/LickCard, libs.
1. **Rows.** Accordion → all-expanded vertical rows: every station renders
header + full gallery permanently; active row highlight (`aria-current`);
pin → focus toggle (same onFocusChord contract). The `scrollIntoView`
effect is already gone (L-40 step 2) — verify none is reintroduced. Green.
2. **Absorb the roadmap.** Row headers gain solo-scale, aim dots, transition
chip (theory.js read-only imports); gallery gains the "play"/threaded first
cell. Green.
3. **Reflow + verify.** Narrow (~640px) cell-wrap per row; eyeball 1280×900,
1280×800, ~640; AA/focus audit; verify **rows wrap and never scroll
horizontally** (the piano worst case ≈1,470px of cells does NOT fit 1,240 —
§4), and recompute the honest screenful counts against the §4 table. Green.
---
## 7. Rejected alternatives
**Rejected A — the guide inside the main module** (banner absorbs the rail, or
the rail replaces the 30% ProgressionSuggestions column). Killed by width math —
and the corrected worst case only strengthens it: ~360px column vs a ~1,178px
piano gallery (§1); inside the banner it competes with the
key/history/now-chord — the one surface that must stay instantly readable. The
user's "or maybe right below it" is the version of his own ask that survives
arithmetic. Also rejected structurally: ProgressionBanner doing loops + history
+ now-chord + galleries is a god-component.
**Rejected B — all-horizontal expanded rail** (stations as columns, every column
expanded). The literal reading of "all voicings at once", and the axis the old
accordion already had. With the corrected cell widths it gets worse, not better:
4-station piano ≈ 5,900px wide; 8-station ≈ 11,800px; continuous sideways
tracking on the axis wheels don't scroll, whole stations hidden off-edge at any
moment — the directive's "follow while playing" fails exactly when it matters.
Vertical rows carry the same content with zero horizontal scroll (rows wrap,
§4).
**Rejected C — RoadmapTrack survives as the single loop display** (banner's loop
row dies instead). Keeps the education-dense artefact, but contradicts the
user's own account of where the loop lives ("it's already in the main module"),
costs ~230px of premium height above the rail, and the banner would still show
near-loop-shaped history chips — the "repeated again" feeling survives its own
fix. Folding the education into row headers (§2) keeps ~90% of the value at
~30px per row.
**Rejected D — keep the pin/accordion semantics inside the expanded rail**
(pinned row grows a bigger gallery). With everything expanded there is nothing
left to reveal; a "bigger on pin" state reintroduces layout shift mid-jam — the
exact complaint. The pin's two real jobs (fretboard guide tones, "hold still")
survive as the focus toggle.
**Rejected E — internal max-height scroller for the band** (~5062vh, contained
auto-scroll). Caps visible rows at ~3 (< the user's "at least 4"), adds a nested
scrollbar inside the page scroll, and only exists to enable auto-scroll the
design doesn't want. Page flow + user-owned scrolling is simpler and matches
"scrolling is easier than clicking".
---
## 8. Out of scope / flags for Maestro
- **ProgressionBanner polish** (progress underline beneath loop chips) — future
1-pointer, only if the beat grid is missed. Not in L-40/D-41.
- **Cleanup ticket:** RoadmapTrack.jsx, CurrentJamPanel.jsx and its now-orphaned
RiffDiagram.jsx join EducationPanel.jsx in the retire-then-delete backlog
item. ChordBox.jsx stays — it is live in ChordDetailModal + ExplorePanel (§5).
- **`SCALE_IDEAS`/`STYLE_VARIATIONS` prose** (CurrentJamPanel's unique content)
— the existing fold-into-Knowledge-Center backlog item stays open.
- **L-42 contract** (§3): bass pattern card mounts in the row gallery slot;
rail structure frozen for it.
- No new tokens, no new dependencies, no KB/theory/audio changes anywhere in
this design. All figures either verified (guitar/licks cells from the D-31
gate; piano worst case recomputed at the D-40 gate — G7 all-284px, §1) or
marked as estimates (module heights).
+658
View File
@@ -0,0 +1,658 @@
# Jam Roulette — design spec (task D-62)
> **Thesis:** one button, two clicks, a jam. "Jam roulette" in the controls bar
> opens a genre menu (the 10 KB styles + Surprise me); picking one instantly
> rolls a random key + an interesting KB progression and **seeds the exact
> state live detection already writes** — `lockedKey`, `detectedProgression`,
> and a committed-shape `progressionVoteRef` — so the loop strip, the voicing
> rail, the licks strip, and the related-progressions card all populate
> **exactly as if the loop had been detected**. Musicians read the screen and
> start playing; the L-31 commit layer then treats the seed like any committed
> loop: agreeing detections confirm it, a genuinely different loop replaces it
> after `REPLACE_VOTES`, and New Song clears it. **No new parallel state** —
> the seed is a writer into the existing machine, not a second machine.
>
> User ask (verbatim, sprint goal 2026-07-11): *"one button that would be a
> random chord progression selection. a button up top 'jam roulette' and then
> select a genre (like we have jazz, blues rock etc) and then have a random key
> chosen and an interesting progression show up as a loop in the screen. it
> would fill in the loop section and a 4 bar progression or something so that
> everyone can see the key and the chords to be played with different voicing
> so they can start playing… then musicians can start playing and it continues
> from it"*
**Dependency note:** L-60 is dep-blocked on **C-50** (one-screen close-out).
This spec is written against `docs/design/one-screen.md`'s **target** layout
(controls bar per §1.1, slim loop strip per §1.2, the two-column dashboard),
which L-50 is building concurrently. Everything here that names the controls
bar or the strip means the *post-L-50* versions; the seed mechanism (§3) is
layout-independent and verified against App.jsx as it stands today (~b753b58).
Standing principles honoured: reuse, don't duplicate; nothing shown twice;
scroll > click; tokens only, no raw hex; the 🚨 App.jsx audio contract
(callbacks / ref-sync / AudioCapture untouched).
---
## 1. UX flow
### 1.1 The button
- **Where:** right end of the controls bar, in the global-chrome cluster next
to one-screen §1.1's `⛶ Jam view` toggle ("a button up top" — the controls
bar is the app's persistent top chrome; the header row stays reserved for
Settings / New Song / Start).
- **What:** `🎲 Jam roulette` — same button language as the existing controls:
`px-3 py-1 rounded-lg border border-border text-sm text-gray-200
hover:border-gray-500 focus-visible:ring-2 focus-visible:ring-accent
transition-colors`. While a seed is active (unconfirmed, §1.3) the button
carries the seeded accent: `border-accent/40 text-accent bg-accent/10` +
`aria-pressed="true"` — same active treatment as the locked-key pill.
- **Keyboard:** real `<button>`, Tab-reachable, Enter/Space opens the menu.
### 1.2 The genre menu
Click → an anchored popover (not a page takeover; the jam never leaves the
screen): `absolute` panel under the button, `bg-panel border border-border
rounded-xl shadow-lg p-1 z-20`, one column of `<button>` rows
(`w-full text-left px-3 py-1.5 rounded-lg text-sm text-gray-200
hover:bg-accent/10 focus-visible:ring-2 focus-visible:ring-accent`):
1. **`✨ Surprise me`** — first row, divider under it (`border-b border-border`)
— uniform pick over the 10 styles, then §2 as normal.
2. **The 10 KB styles**, straight from the registry:
`Object.entries(kb).map(([id, s]) => s.meta.label)` — never a hard-coded
list; an 11th style appears here for free.
3. When a seed is active, row 0 becomes **`⟳ Re-roll — {styleLabel}`** (same
style, fresh key + progression, honouring §2's no-repeat memory) and
`✨ Surprise me` moves to row 1.
Escape / click-outside / picking a row closes it. Focus returns to the button.
Picking a genre seeds **instantly** — two clicks from cold to a full jam
dashboard. No confirmation step: re-rolling is cheaper than confirming.
### 1.3 The seeded indicator — honest provenance
The dashboard must not pretend the roulette loop was *heard*. Until live
detection confirms it, the slim loop strip's loop row swaps its chrome:
- The `♻` glyph becomes `🎲`; the `→ loop` tail becomes an amber provenance
chip: **`rolled · {styleLabel} · {progression.name} · {Σbars} bars — play
it!`** (`text-amber-400 text-xs` — amber is the app's established secondary
accent, the rn colour; no new token). Σbars comes from the KB `bars` array —
this is where "a 4 bar progression" is made visible.
- The loop chips themselves render **identically** to a detected loop (same
chip anatomy, chord + rn) — the chords are real instructions, only the
*provenance* differs.
- The moment the commit layer confirms the seed (§3.4 — first agreeing live
detection), the indicator flips to the normal `♻ … → loop` with no other
visual change: the honest signal that "the band is now playing what was
rolled". If a *different* loop replaces the seed, the indicator vanishes
with the seed (the new loop is detection-owned).
Empty-state note: pre-first-note the history slot still shows "Start
listening…" — correct and honest (nothing has been heard); the key chip shows
the rolled key immediately (it's a real `lockedKey`, rendered with the 🔒 pill
in the controls bar too, mode dropdown and unlock included — the rolled key is
a first-class key lock, not a special display).
### 1.4 Flow summary
Cold start: **🎲 → genre → the dashboard fills** (key chip + locked-key pill,
loop chips with rn, voicing rail with every station's shapes/voicings, licks
strip aimed at station 0, related progressions) → band reads, plays → playhead
lights on the first committed loop chord → detection confirms after ~2 cycles
→ 🎲 indicator becomes ♻ → the jam continues under pure live detection.
Mid-session: 🎲 acts as **New Song + seed** (§3.6) — one gesture, clean slate,
new card.
---
## 2. Randomization rules
All randomness lives in the seed function (plain `Math.random()`; no audio
contact). Inputs: the KB registry only.
### 2.1 Key
- **Root:** uniform over the 12 pitch classes, spelled from **`NOTES` (sharp
spellings)** — mandatory, not stylistic: `matchChordFromChroma` names every
committed chord via `noteName(r)` with `preferFlat=false` (theory.js:112,
445 — the live naming path), so only sharp spellings string-match detection
later (§3.3).
- **Mode:** taken directly from the rolled progression's `mode` field —
verified: **every KB progression encodes `mode`**, vocabulary
`major | minor | dorian | mixolydian` (grep across all 10
`progressions.js`), all four already present in the key-lock mode dropdown
and `SCALES`. No inference, no default needed.
- **Confidence:** `1` (the `applyLock` convention).
- Session memory: don't repeat the previous roll's root (re-draw once).
### 2.2 Progression pool ("interesting" AND seedable)
Per style, from `kb[style].progressions`, each entry realized + collapsed per
§3.2 first. **Pool membership = the hard bounds ∩ the round-trip invariant**
— a progression only rolls if the machine can genuinely confirm it:
- **Hard length bounds: collapsed length must be 28.**
- `< 2` — unrepresentable as a detected loop (`detectRepeatingProgression`
min pattern length 2). Today this excludes **nothing**: even
`funk-one-chord` collapses to **two** names (`X7, Xsus4` — its
`['dom7','dom7','sus4','dom7']` qualities survive collapse because a
quality change on the same root is a different name; wrap-dedupe then
drops the trailing `X7`). The rule stays as future-proofing for a true
single-name vamp, and the code comment must say so honestly.
- `> 8` — the detector's candidate loop only sweeps lengths **28**
(theory.js:627). A longer seed is not merely unconfirmable: as the band
plays it, in-window *fragments* of it become the only detectable
structure and **replace the seed after `REPLACE_VOTES` = 3** — the card
self-destructs into a sub-loop. Excludes today: `jazz-blues` (collapsed
10), `blues-quickchange` (9), `bossa-blue` (10).
- **Round-trip invariant (the real gate) — the protocol is load-bearing:**
*a progression passes iff, with the 32-commit window filled with
repetitions of its seeded canonical form (steady state) and truncated at
**every** partial-cycle offset (0…len1 commits past a cycle boundary),
the real `detectRepeatingProgression` returns exactly that form at **all**
offsets.* Steady-state-plus-all-offsets is the honest protocol because a
jam is sampled mid-cycle, not at cycle boundaries — and a naive "feed 2
clean cycles" protocol gets *both* failure modes wrong: it spuriously
fails all 8 two-name vamps (2 cycles × 2 names = 4 commits, under
theory.js:609's history ≥ 6 gate — a ramp artifact, not a steady-state
failure), and it *passes* `blues-8bar`, whose 7-name form actually fails
at exactly **1 of its 7 phase offsets** (4 cycles + 4 extra commits → the
detector prefers the `[C7, G7]` alternation). Round-trip is *empirical,
not constructional* — the detector's recency×occurrence scoring can prefer
an internal alternation over the full form at some phase. The invariant is
**precomputed over the whole registry** (lazy module-level memo on first
roulette open — key-independent per §3.3.3, so one sweep in C covers all
keys; an 11th style or new progression joins the pool automatically) and
**pinned by the L-60 commit-1 smoke sweep** (same protocol verbatim —
§3.4 flag 2).
- **Honest numbers today (Critic gate ran the real matcher + detector under
the protocol above):** **4/56 fail** — the 3 over-length forms plus
`blues-8bar`'s phase-offset failure — so the **expected pool is 52/56**,
pinned exactly by the smoke sweep. (Pre-fix-(a), 10/56 additionally
returned NO MATCH for their own collapsed form and `country-145` matched a
different progression — §3.3.1; all return to the pool with the fix, since
matching post-fix is constructional, §3.3.4.)
- **Weight = levelW × lenW** (over pool members only):
- `levelW`: `level === 'intermediate'`**2**; foundation/untagged → **1**
(the D-20 rule: untagged counts foundation). "Interesting" = intermediate
leans in, foundations still roll.
- `lenW`: collapsed length **37 → 2** (the "4-bar-ish" sweet spot — note
a collapsed 12-bar blues is 7 names, so the genre's staple stays strong);
**2 and 8 → 1**.
- **No-repeat memory:** `rouletteMemoryRef` (plain `useRef([])` in App —
UI-state ref, never read by audio code) keeps the last **6** rolled
progression ids; they're excluded from the pool. If exclusion leaves the
pool empty (small styles — several have 5 entries), fall back to excluding
only the immediately previous id. The ref survives New Song deliberately
(variety across songs is the point) and dies with the session.
- Weighted draw; push id to memory.
---
## 3. The seed mechanism — spec'd against the real App state
### 3.1 What the seed writes (exhaustive)
`rollJam(styleId)` — a plain function in App.jsx, sibling of
`quickLock`/`newSong`:
```
1. newSong() // §3.6 — the clean-slate rule
2. const info = { root: NOTES[rolledPc], mode: prog.mode, confidence: 1 }
setLockedKey(info)
effectiveKeyRef.current = info // the quickLock precedent —
chordVotesRef.current = [] // detection uses the key NOW
3. const loop = seedableLoop(prog, rolledPc) // §3.2 — realize→collapse→canonicalize
4. setDetectedProgression(loop)
5. progressionVoteRef.current = {
committedKey: loop.join(','), // the committed shape, L-31's own
candidateKey: null,
candidateCount: 0,
seeded: true, // §3.4 — the one flag L-60 adds
}
progressionMissRef.current = 0 // (newSong already did; explicit)
6. setSeedInfo({ styleLabel, name, bars }) // §3.5 — display provenance
7. rouletteMemoryRef bookkeeping (§2.2)
```
Nothing else. **Never touched:** `handleNote` / `handleChroma` / `handleOnset`
/ `handleWaveform`, AudioCapture and its props, `noteHistoryRef`,
`keyVotesRef`, `chromaRingRef`, the loop engine. The seed is display state +
the two progression refs the L-31 effect already owns — exactly the audio
contract boundary the L-60 ledger row grep-gates.
Synergy worth stating: `handleChroma` bails while `effectiveKeyRef.current` is
null — a cold session normally can't commit chords until key detection locks.
The seed provides the key up front, so **the very first chroma frames can
commit chords**, and the diatonic bonus in `matchChordFromChroma` is already
biased toward the rolled key. The roulette makes detection *faster*, not
just decorated.
### 3.2 Realizing the loop — `seedableLoop(progression, keyRootPc)`
The chord names must be **byte-identical** to what detection would commit when
the band plays the progression, or the commit layer treats the seed as a rival
forever. Three steps, each forced by a verified code path:
1. **Realize** (the JamGuide `stationVoicings` formula, JamGuide.jsx:262-273):
per station `rootPc = (keyRootPc + degrees[i]) % 12`,
`name = NOTES[rootPc] + (CHORD_TYPES[qualities[i]]?.suffix ?? '')`.
Sharp spellings only (§2.1).
2. **Collapse consecutive duplicate names**, then if `first === last` drop the
last — mirrors `detectRepeatingProgression`'s collapse of back-to-back
commits (theory.js:611-615) *plus* the cyclic wrap (in the live stream the
loop's tail flows into its head; `setChordHistory` also dedupes
consecutive identical commits, App.jsx:363). E.g. `blues-12bar` degrees
`[0,0,0,0,5,5,0,0,7,5,0,7]` → 7 names `[I,IV,I,V,IV,I,V]` realized;
`funk-one-chord` keeps its quality changes (same root, different suffix ≠
duplicate → `[X7, Xsus4]`). Name-collapse is provably **key-independent**
(§3.3.3) — the collapsed *shape* is a property of the progression, which
is what makes fix (a) (§3.3.2) computable once, key-free.
3. **Canonicalize rotation** with **theory.js's own rule** — lexicographically
smallest rotation compared via `join('\0')` (`canonicalize`,
theory.js:579-586, currently private). `detectRepeatingProgression`
returns *its* canonical rotation; the agreement branch compares exact
`join(',')` strings, so the seed must store the same rotation or
confirmation is unreachable (§3.4 flag 2).
**Where it lives:** `seedableLoop` exported from **`src/lib/match.js`**
(loop-identity is that file's mandate; it already imports theory.js
read-only; L-51 is adding adjacent exports there and L-60 runs after C-50, so
no lock overlap). For step 3 it needs `canonicalize`: **preferred — additive
`export` keyword on theory.js's `canonicalize`** (one-word diff; shared-file
lock, flag to Maestro at L-60 promotion; smoke's `loop-fixtures.mjs` already
byte-checks a replica of this function, so a second in-app replica would
triple the drift surface). Fallback if Maestro won't open theory.js: replica
in match.js with a drift comment + smoke guard, the loop-fixtures precedent.
Display note: the banner shows the seeded loop in this canonical rotation —
**identical to how any live-detected loop displays today**; the JamGuide rail
re-rotates to canonical KB order via `match.rotation` regardless, so the
learning surface always reads in textbook order (ii first in a iiVI).
### 3.3 Matching + round-trip — constructional after fix (a)
#### 3.3.1 The bug fix (a) exists for (Critic gate, real matcher run)
`buildLoopIndex` (match.js:126-141) indexes each progression's **raw,
uncollapsed** `degrees` — but the seeded loop (and the *live* commit stream,
which dedupes back-to-back chords) is the **collapsed** form, a different
sequence length whenever a progression repeats a chord across adjacent slots
or across the wrap. The gate ran the real matcher: **10/56 progressions
return NO MATCH for their own collapsed form** — `jazz-blues`, `blues-12bar`,
`blues-quickchange`, `blues-8bar`, `blues-minor`, `bossa-blue`,
`funk-one-chord`, `country-folk-axis`, `gospel-iv-passing-dim`,
`gospel-tonicized-amen` — and `country-145` is worse: its raw 8-shape matches
a *different* progression. Rolling blues would produce a populated banner and
an **empty JamGuide**. This is also a **pre-existing live-detection bug** the
roulette work surfaces: a band playing a real 12-bar blues today commits the
collapsed stream and gets an empty JamGuide — fix (a) repairs both at once.
#### 3.3.2 Fix (a) — collapsed-form indexing (Maestro-directed, mandatory)
`buildLoopIndex` **additionally** indexes each progression's collapsed form:
- **Collapse rule (key-free):** dedupe adjacent stations whose
`(degree, suffix)` pairs are equal, where
`suffix = CHORD_TYPES[quality]?.suffix ?? ''` (compare *suffixes*, not raw
quality tokens — two out-of-vocab qualities both fall back to `''` and
produce equal names, so a token comparison would under-collapse); then
**wrap-dedupe**: if the last pair equals the first, drop the last (one
check suffices post-collapse — only the boundary pair can merge).
- **What's indexed:** `canonicalDegrees(collapsedDegrees)` → an entry whose
`progression` is the **collapsed projection** of the authored one:
`{ ...progression, degrees, qualities, rn (first-of-run), bars (summed per
run), sourceIndex }` where `sourceIndex[i]` = the first raw station index
of collapsed station `i`. Same `id`/`name`/`level`/`mode`/`songs`/`tip`.
- **Only when it differs:** entries are added only where the collapsed shape
≠ the raw shape — **45/56 index once, 11 twice**. The full census (gate,
raw → collapsed): `jazz-blues` 12→10, `blues-12bar` 12→7,
`blues-quickchange` 12→9, `blues-8bar` 8→7, `blues-minor` 12→5,
`bossa-blue` 16→10, `funk-one-chord` 4→2, `country-145` 8→4,
`country-folk-axis` 8→7, `gospel-iv-passing-dim` 4→3,
`gospel-tonicized-amen` 5→4.
- **The true compatibility invariant (stated exactly):** collapsed entries
are **appended after all raw entries**, so `matchLoopToProgression`'s
strict-`>` disambiguation keeps every previously-matching input's winner
**on ties** — but append order never engages on a strict score win, and
one real case exists: for input shape `[0,5,0,7]` with
`maj/maj/maj/dom7` qualities (e.g. `[C, F, C, G7]`), `country-145`'s
collapsed form scores 4×1004 and **strictly beats** the incumbent
`country-bluegrass-cycle` (3×1004 — its quality set lacks `dom7`).
Gate-verified registry-wide (raw + collapsed × 3 keys): this is the
**only** winner change, and it is an **improvement** — the progression
actually being played now self-attributes (pure-triad `[C,F,C,G]` input
still ties and keeps `bluegrass-cycle`). So: **behaviour-preserving except
where a collapsed entry strictly dominates the disambiguation score,
enumerated: `country-145`, desired direction.** Previously-`NO_MATCH`
collapsed streams now match; that is the point.
- **Rotation:** for a collapsed-form hit, `rotationToCanonicalOrder` runs
against the *collapsed* degrees — equal lengths by construction. (Today's
length-mismatch guard, match.js:208, silently returns 0, which is exactly
what would break the playhead if the raw progression were returned
instead.)
Downstream, JamGuide renders the projection's stations naturally — a 12-bar
renders **7 stations, one per distinct change** (the right glance-rail
answer: duplicate consecutive bars add no voicing information; the strip's
loop chips carry position). The one alignment consumers need: **every
authored-play lookup must remap through `sourceIndex`** — otherwise a
collapsed match reads the first N raw play entries against the wrong
stations. There are **four** raw-indexed lookups, not two:
- **guitar** shape path, JamGuide.jsx:280, and **piano** recipe path, :288 —
both inside the `stationVoicings` memo: `play.chords[prog.sourceIndex?.[i]
?? i]`;
- **bass**, inside `BassGuideRows`: `play?.chords?.[i]?.pattern` (:530) and
`…?.note` (:533). Mechanism chosen: the `stationVoicings` memo attaches a
per-station **`sourceIndex` field** (`stations[i].sourceIndex =
prog.sourceIndex?.[i] ?? i`), and the two bass lines read
`play?.chords?.[st.sourceIndex ?? i]` — BassGuideRows already receives the
stations, so **no new prop**; the heard-live path's synthetic station has
no `sourceIndex` and the `?? i` fallback keeps it exact.
Blues ships guitar, piano *and* bass cells, and its bass pack covers **four
collapse-affected progressions** (`blues-12bar`/`quickchange`/`8bar`/
`minor`), two of them pool members (`blues-12bar` 7, `blues-minor` 5) — so
the bass remap is load-bearing for the roulette itself, not just for live
detection. Four bounded lines + the one field attachment; JamGuide.jsx joins
L-60's lock (§5).
#### 3.3.3 Key-independence proof (why the index can be built key-free)
Realized names are `Nᵢ = NOTES[(k + dᵢ) mod 12] + suffix(qᵢ)` for key root
`k`. Adjacent names are equal ⇔ their roots are equal AND their suffixes are
equal. Roots: `(k + dᵢ) ≡ (k + dⱼ) (mod 12) ⇔ dᵢ ≡ dⱼ (mod 12)``k`
cancels, and KB degrees live in 011, so this is plain `dᵢ = dⱼ`. Suffixes:
the 14 `CHORD_TYPES` suffixes are pairwise distinct (verified by inspection,
theory.js:41-55), so equal suffixes ⇔ the same suffix class — identical
quality for in-vocab tokens, the shared `''` fallback for out-of-vocab ones
(hence §3.3.2 compares suffixes). Therefore **name-collapse ≡
(degree, suffix)-pair collapse in every key**: `buildLoopIndex` computes the
collapsed shape once with no key in hand, and `seedableLoop`'s per-key name
collapse always produces that same shape. The same argument makes the §2.2
**round-trip invariant key-independent**: the detector consumes only the name
stream's *equality structure*, which is key-invariant; the lexicographic
rotation choice may differ per key, but seed and detector canonicalize
identically over identical names, so agreement of the two outputs is
preserved — one sweep in C covers all 12 keys.
#### 3.3.4 What is constructional vs what stays empirical
- **Matching is constructional post-fix-(a):** every rolled loop *is* some
progression's collapsed canonical shape, and fix (a) indexes exactly those
`matchLoopToProgression` cannot miss. (It may attribute to a same-shape
sibling — the §4 quirk, now including within-style cases like
`country-145`-collapsed ≡ `country-bluegrass-cycle`.)
- **Detector round-trip stays empirical** — hence §2.2's precomputed
registry-wide invariant (steady-state window, all partial-cycle offsets)
as the pool gate: today 4/56 fail — 3 over-length + `blues-8bar`'s
1-of-7-offsets self-competition; expected pool **52/56**, pinned by smoke.
Worked example of a passer: rolled `jazz-251-major` in A → seeded
`[Bm7, E7, Amaj7]` (canonical rotation) → band plays it → detection
commits the same sharp names from the same `CHORD_TYPES` suffixes → after
2 cycles (6 commits, clearing the history ≥ 6 gate) the detector returns
the identical canonical form at every subsequent commit, whatever the
phase → agreement branch fires. ✓
#### 3.3.5 Honest limit — qualities detection can't name
`MATCH_CHORD_TYPES` (theory.js:59-61) is a *subset* — KB qualities `dim7` and
`min6` (7 progression slots across the KB, counted) can never be committed by
detection under those exact names (it will hear `dim` / `m7`-ish). For such
rolls the seed displays the authored chord, and once the band plays,
detection consistently returns the *as-heard* loop → the `REPLACE_VOTES`
branch swaps in reality after 3 commits. That is the machine working as
designed — the card yields to what's actually played, and the re-match still
lands on the same KB progression (degree shape unchanged, quality is only a
tie-breaker). Same story if the band plays triads where the KB says sevenths.
Not a bug; documented behaviour.
### 3.4 The L-31 commit-layer interplay — branch by branch
The effect (App.jsx:181-213) runs once per chord commit (`[chordHistory]`
deps — seeding itself triggers exactly one run via `newSong`'s
`setChordHistory([])`, landing in the null branch at miss 1). With a seeded
vote `{committedKey: S, candidateKey: null, candidateCount: 0, seeded: true}`:
| Branch | Seeded behaviour | Verdict |
|---|---|---|
| **Agreement** (`vote.committedKey === key`) | Refreshes the loop, drops rivals — **L-60 adds:** `vote.seeded = false` + `setSeedInfo(null)`. The seed is now a normal committed loop; every subsequent rule applies verbatim | works, 2-line addition |
| **Rival counting** (`candidateKey` bookkeeping) | A transient sub-cycle detection during ramp-up (real: a 7-name collapsed 12-bar contains `[I,IV]` twice before the full form recurs) starts a candidate; `committedKey` survives the rebuild — **but the rebuild literal at line 207 drops `seeded`** | 🚩 **flag 3 below** |
| **Replacement** (`candidateCount ≥ REPLACE_VOTES=3`) | A genuinely different, consistently-detected loop replaces the seed; new vote is detection-owned (no `seeded`) — **L-60 adds** `setSeedInfo(null)` here | correct as-is: rolled cards must yield to a real band playing something else |
| **Null branch / miss counter** (`NULL_CLEAR=6`) | **Kills EVERY seed during ramp-up — no length survives.** L-31's "fills never null" reasoning assumed the loop is *in the history window* — a seeded loop isn't yet. Exact timeline: the seed's own effect run (via `newSong`'s history reset) is **miss 1**; commits 15 take the counter to 6 → **the card is wiped at commit 5**. But the earliest *any* detection can land is **commit 6**`detectRepeatingProgression` hard-gates raw history `< 6` (theory.js:609), so even a 2-name loop cannot confirm before then, and a loop of length *len* needs ~2·len commits besides. **Unguarded, every seed dies exactly one commit before the earliest possible confirmation** — the guard is mandatory for every pool member, not a long-loop nicety | 🚩 **flag 1 — the critical fix** |
**Flags for L-60 (each a 1-line change inside the effect — the one licensed
edit in that block):**
1. **Null-clear guard:** `if (progressionMissRef.current >= NULL_CLEAR &&
!progressionVoteRef.current?.seeded) { …clear… }`. Semantics: *a seeded
card is an instruction, not an observation — it stays until confirmed
(then normal rules resume), replaced by a consistently-detected different
loop, re-rolled, or New Song.* A band that noodles structurelessly under a
seeded card keeps the card — intended: it's what they were asked to play.
2. **Rotation equality is constructional** (§3.2/§3.3) — no branch change,
but if `seedableLoop` skipped canonicalization the agreement branch would
be unreachable and the seed would churn-replace with itself (rotated) at
commit 3. L-60's smoke-visible invariant is §2.2's registry-wide sweep,
**protocol verbatim:** *for each of the 56 progressions, fill the
32-commit window with repetitions of the seeded canonical form (steady
state) and truncate at every partial-cycle offset (0…len1 commits past a
cycle boundary); the progression passes only if
`detectRepeatingProgression` returns exactly the seeded canonical form at
ALL offsets.* Expected: 52 passers pinned; the 4 named failures
(`jazz-blues`, `blues-quickchange`, `bossa-blue`, `blues-8bar`) asserted
as excluded from the pool. (A naive 2-clean-cycles feed is wrong in both
directions — §2.2.)
3. **Preserve `seeded` across candidate rebuilds:** line 207 becomes
`{ committedKey, candidateKey: key, candidateCount: 1,
seeded: vote?.seeded ?? false }` — otherwise one transient ghost
sub-cycle strips the flag and flag 1's guard dies with it, resurrecting
the ramp-up kill through the side door.
Nothing else in the effect treats a seed differently — `COMMIT_VOTES` never
applies (a committed key exists), and `progressionMissRef.current = 0` on any
detection keeps the counter honest once structure appears.
### 3.5 The provenance flag — machine truth vs display echo
Two readers need "seeded, unconfirmed": the effect (guard, flag 1) and the
banner/button (indicator, §1.3). The effect reads `vote.seeded` — its own ref,
already in hand, mutation-safe. The **display** cannot read a ref reactively,
so App gains one small UI-state:
`const [seedInfo, setSeedInfo] = useState(null)` —
`{ styleLabel, name, bars } | null`, passed to ProgressionBanner as a
presentational prop (and read by the roulette button for its active state +
re-roll row). This is **provenance metadata that exists nowhere else** (style
label, progression name, bar count) — not a duplicate of
`detectedProgression`. Invariant, enforced at every transition: `seedInfo !==
null ⇔ progressionVoteRef.current?.seeded === true`. Sync points: set
together in `rollJam`; cleared together in the agreement branch, the
replacement branch, and `newSong` (one added line — `setSeedInfo(null)`).
### 3.6 New Song & mid-session rolls
`newSong()` (App.jsx:216-241) already clears the whole seed surface:
`progressionVoteRef.current = null`, `progressionMissRef.current = 0`,
`setDetectedProgression(null)`, `setLockedKey(null)`,
`setChordHistory([])` — verified line by line; L-60 adds only
`setSeedInfo(null)`. **The seed clears naturally.** ✓
**Mid-session rule: roulette = New Song + seed** (`rollJam` step 1). Without
it, a 32-commit history still containing the *old* loop keeps re-detecting it
and would replace the fresh seed within 3 commits even after the band
switches — the stale window poisons the handoff. `newSong()` is the
already-tested full reset (history, votes, key, BPM); seeding onto that clean
slate makes ramp-up §3.4's only story. The banner history emptying is honest
("new song" is literally what the button did), and the loop-station audio is
untouched (`newSong` never touched it).
---
## 4. What fills in — every consumer, verified
The seed sets `lockedKey` (→ `effectiveKey`) + `detectedProgression` (+ the
vote ref). Consumers and their honest pre-first-note state (`chordHistory`
empty, `currentChord` undefined):
| Surface | Consumes | Seeded behaviour |
|---|---|---|
| Slim loop strip — key chip | `keyInfo` (= effectiveKey) | Rolled key + mode render immediately |
| Slim loop strip — loop chips | `detectedProgression`, `findLoopPosition(chordHistory, loop)` | All chips render (chord + rn via the rolled key). `findLoopPosition` **returns 1 on empty history** (match.js:75 guard) → **no chip highlighted** — correct: nobody is anywhere yet. 🎲 indicator per §1.3 |
| Strip — history row | `chordHistory` | "Start listening…" — honest |
| JamGuide match | `matchLoopToProgression(loop, kbIndex)` | **Matched by construction — after §3.3.2's fix (a)** (mandatory L-60 scope): the seeded loop is the progression's collapsed canonical shape, which fix (a) indexes. *Without* the fix, 10/56 rolls (all of blues among them) would show a populated banner and an **empty JamGuide** — and the same fix repairs today's live-detection miss for real 12-bar streams. Header shows the progression name + "in {key}" |
| Voicing rail (GlanceRail / BassGuideRows) | `stationVoicings` (match + keyRoot), `activeIndex = canonicalPos` | Every station's shapes/voicings render in canonical KB order — for collapse-affected matches, the **collapsed projection's** stations (a 12-bar renders 7, one per distinct change) with plays remapped via `sourceIndex` (§3.3.2). `canonicalPos` guard (JamGuide.jsx:220-225) → **1** → **no "now" row** — the rail shows the whole map unhighlighted |
| Licks strip | `activeStyle` (= match.style), `contextStation` | Populates; `contextStation` **falls back to station 0** when canonicalPos is 1 (JamGuide.jsx:341-344, existing comment says exactly this) — licks aim at the progression's first chord until the playhead exists |
| Related progressions (L-51) | `{ loop, keyInfo, onChordClick }` | Populates for free — it computes its own match from the loop |
| Instrument view | `keyInfo`, `currentChord` | Scale + pentatonic tiers light in the rolled key; **no chord-tone tier until the first commit** (currentChord undefined) — honest |
| ChordDetailModal | tap any chip | Works — chips pass real chord names |
| Chord detection itself | `effectiveKeyRef` | **Enabled immediately** by the seeded key (§3.1 synergy) |
**The pre-first-note playhead, stated plainly:** there is none — no strip chip
glows, no rail row is "now", and that is the design: a playhead claims
knowledge of where the band is, and the app doesn't have it yet. It lights on
the **first committed chord whose name appears in the loop** (`findLoopPosition`
walks back from the last commit; a first chord outside the loop keeps it
unlit). The 🎲 chip carries the "we're starting" affordance until then.
**Style-attribution quirk (documented, accepted):** same-shape progressions
exist across styles (`rock-axis` / `reggae-nwnc` / `pop-axis` all
`[0,7,9,5]`), and fix (a) adds within-style aliases
(`country-145`-collapsed ≡ `country-bluegrass-cycle`).
`matchLoopToProgression` disambiguates by quality overlap then length; ties
fall to entry order (raw before collapsed, §3.3.2 — incumbents keep winning
on ties), and the one strict-win exception is `country-145`'s collapsed form
over `bluegrass-cycle` for dom7-V input — the desired direction (§3.3.2's
true invariant). So rolling *pop* → Axis may render the rail/licks
attributed to **rock**. The chords, key, rn, and voicings are identical;
only the style label and lick flavour differ. **Re-judged against Maestro's belt-and-braces
offer: with fix (a) mandatory, matching is constructional and a seeded
`styleHint` would correct only the label/lick flavour — cosmetic, not
load-bearing. Declined for v1** (it would plumb a new prop through JamGuide
for no structural gain); noted for Maestro as a user-pulled follow-up if
anyone notices.
---
## 5. L-60 scope — exact files, bounded commits
**The audio-contract boundary (grep-gated, restated):** the seed touches
display state (`lockedKey`, `detectedProgression`, `seedInfo`,
`chordHistory` via `newSong`) + the progression refs
(`progressionVoteRef`, `progressionMissRef`) + UI refs
(`rouletteMemoryRef`, `effectiveKeyRef` per the quickLock precedent) —
**never** `handleNote`/`handleChroma`/`handleOnset`/`handleWaveform`, their
ref-sync effects, or any AudioCapture prop.
**Files:**
1. `src/lib/theory.js` — **additive only:** `export` keyword on
`canonicalize` (shared file — flag lock to Maestro at promotion;
Professor+Critic co-review per PROTOCOL §3; fallback per §3.2).
2. `src/lib/match.js` — the sprint's real engineering weight, all additive:
- **`seedableLoop(progression, keyRootPc) → string[] | null`** (realize →
collapse+wrap-dedupe → canonicalize; null for collapsed length < 2);
- **fix (a)** per §3.3.2: `buildLoopIndex` collapsed-form entries
(collapsed projection with `sourceIndex`, appended after raw entries)
+ `matchLoopToProgression` collapsed-hit rotation against collapsed
degrees. Behaviour-preserving except the one enumerated strict win
(§3.3.2 true invariant: `country-145`, desired direction);
previously-`NO_MATCH` collapsed streams now match — this also fixes
the pre-existing live 12-bar miss;
- the **round-trip pool sweep** helper (lazy module-level memo, §2.2).
After C-50, no lock overlap with L-51's exports.
3. `src/App.jsx` — `rollJam(styleId)` + `seedInfo` state +
`rouletteMemoryRef`; the roulette button + popover menu in the controls
bar; the three 1-line commit-layer edits (§3.4 flags 1 & 3 + the two
`setSeedInfo(null)` clears); one line in `newSong`.
4. `src/components/ProgressionBanner.jsx` — presentational `seedInfo` prop:
🎲 glyph + amber provenance chip on the loop row (§1.3).
5. `src/components/JamGuide.jsx` — **four bounded lines + one field**
(§3.3.2): guitar-shape and piano-recipe lookups remap through
`prog.sourceIndex?.[i] ?? i` (JamGuide.jsx:280, :288); `stationVoicings`
attaches `stations[i].sourceIndex`; BassGuideRows' two raw-indexed
lookups (`pattern` :530, `note` :533) read
`play?.chords?.[st.sourceIndex ?? i]` — no new prop, heard-live falls
back via `?? i`. Re-lock at promotion — JamGuide is one-screen-locked
until C-50, which L-60 already depends on.
**Suggested commits (green at each):**
1. theory.js export + match.js (`seedableLoop` + fix (a)) + the JamGuide
`sourceIndex` remaps (all four paths incl. bass) + the smoke sweep: the
§2.2 round-trip invariant over **all 56** progressions under the
steady-state/all-offsets protocol (§3.4 flag 2 verbatim; expected 52
passers pinned; the 4 named failures asserted excluded) **plus** a
live-stream fixture proving a clean 12-bar history now matches (the
pre-existing bug, pinned fixed).
2. App.jsx commit-layer guard lines + `rollJam` + state/refs (mechanism live,
invokable from a temporary plain button if needed).
3. The controls-bar button + menu + banner indicator (the visible feature).
**Out of L-60 scope:** GlanceRail/VoicingBrowser (untouched — they render
whatever stations JamGuide hands them), JamGuide beyond the four remap lines
+ field, KB content, theory beyond the one export, audio, and the
`styleHint` disambiguation (declined, §4).
---
## 6. Rejected alternatives
**Rejected A — fake `chordHistory` injection** (seed by pushing 2 synthetic
cycles into history so the detector "discovers" the roll naturally). Seductive
— zero commit-layer changes — and dishonest at every surface: the banner
history strip shows eight chords **nobody played**; `findLoopPosition`
immediately lights a playhead asserting the band is mid-loop before a note
sounds; the L-31 cadence reasoning (thresholds are *per real chord commit*)
silently breaks; and the first real commits interleave with the fake tail,
producing corrupted-rep flapping (the exact pathology C-30/L-31 spent a sprint
taming). The seed must write conclusions, not forge evidence.
**Rejected B — a separate `seededProgression` state rendered when
`detectedProgression` is null.** Duplicates the loop's identity across two
states with a priority rule; every consumer (strip, JamGuide, RelatedProgressions,
future ones) must learn the fallback or silently miss the seed; and the
detection handoff becomes a hard visual swap between two objects instead of
the vote ref's smooth confirm/replace. The standing principle exists for
exactly this: one loop, one state, one machine.
**Rejected C — display-only overlay ("ghost card") that never enters the
state machine**, cleared on first detection. Honest-looking, but the screen's
surfaces don't populate from a ghost: the rail, licks, and related
progressions all key off `detectedProgression` — an overlay would either
leave them empty (failing "so that everyone can see the chords with different
voicings") or need Rejected B's plumbing anyway. Also loses the §3.1 synergy
(no `lockedKey` → chord detection stays gated on key detection).
**Rejected D — neutralize the ramp-up with a miss-counter credit**
(`progressionMissRef.current = -(2·len + 4)` at seed time) instead of the
`seeded` flag. One line, no flag — but the credit is a magic number that burns
in real time: a band that chats for eight commits' worth of noodling before
starting spends it on nothing and the card still dies mid-ramp-up; and it
leaves no way for the agreement branch to know confirmation happened (the
indicator can't flip). The flag has clean semantics; the credit has arithmetic
luck.
---
## 7. Flags for Maestro
- **theory.js shared-file lock** (additive `export` on `canonicalize`) — L-60
promotion must note it; Professor co-review per PROTOCOL §3.
- **L-60 lock list** per §5 (App.jsx + ProgressionBanner.jsx + match.js +
theory.js + JamGuide.jsx, four remap lines + one station field) —
supersedes the ledger row's "App.jsx (+ per D-62)".
- **Fix (a) repairs a pre-existing LIVE bug** (§3.3.1: real 12-bar/8-bar
streams — 10 progressions match nothing in JamGuide today, and
`country-145` misattributes; 11 collapse-affected total, §3.3.2 census).
Worth a line in the PR body / Herald's changelog: users get it even if
they never touch the roulette.
- **`styleHint` disambiguation** — re-judged and **declined for v1** (§4:
cosmetic post-fix-(a)); user-pulled follow-up only.
- **Smoke round-trip sweep** (§5 commit 1, all 56 progressions + the live
12-bar fixture) — if Critic prefers it C-owned, it slots into C-61's sweep
instead.
- No new tokens, no new colours (amber + accent are established), no
dependencies, no KB/audio changes anywhere in this design.
+193
View File
@@ -0,0 +1,193 @@
# Knowledge Center — design concept (task D-20)
> **Thesis:** JamBuddy's knowledge should live in **one bottom dock with four sections**, grown out of the existing Jam Guide dock — not three (actually five) competing collapsible panels. The live Roadmap stays the flagship landing section; Explore, Voicings, and Licks & Techniques become sibling sections inside the same shell. One shared level filter (foundation/intermediate), one visual language (the Roadmap's, per `jam-guide-concept-c.md`), zero new top-level chrome.
**Decision authority:** per the sprint header (user away 12 h, no user gate), Muse picks the strongest layout and records rationale + rejected alternatives below (§6). Implementation is task **L-22**; this doc is its blueprint.
---
## 0. Honest audit — what actually exists today
Read directly from `src/App.jsx` and the components before designing. The "three disconnected surfaces" from the user directive are real, but the on-disk truth is messier:
| Surface | File | Mounted in App.jsx? | Content |
|---|---|---|---|
| Jam Guide (Roadmap) | `src/components/JamGuide.jsx` | **Yes** — last, bottom dock | Live loop → KB match → RoadmapTrack + voicing strip; instrument + style tabs |
| Explore panel | `src/components/ExplorePanel.jsx` | **No — orphaned** (verified: no import anywhere in `src/`) | Chord picker (root × quality), guitar voicing grid, piano techniques, famous progressions |
| Education panel | `src/components/EducationPanel.jsx` | **No — orphaned** (same verification) | Session snapshot, similar progressions, "play differently" substitutions, progression variations |
| Current Jam panel | `src/components/CurrentJamPanel.jsx` | **Yes** — mid-page collapsible | Voicings / scales / style options / **similar progressions** — heavy overlap with EducationPanel |
| Chord detail modal | `src/components/ChordDetailModal.jsx` | **Yes** — overlay | 6 tabs: Guitar, Piano, Theory, Learn (playbook + ASCII licks), Progressions, Explore |
So the fragmentation the user feels is: JamGuide (bottom) + CurrentJamPanel (middle) + ChordDetailModal (overlay), with two *dead* panels duplicating slices of both. The Knowledge Center consolidates the browse/learn material into the bottom dock, reuses the orphans as parts, and leaves CurrentJamPanel and the modal shell untouched this sprint (flagged for follow-up, §10).
---
## 1. Chosen structure — one dock, four sections
The existing JamGuide dock (collapsed header → ~70vh body) becomes the **Knowledge Center**. Its body gains a section nav; everything else about the dock chrome (collapsed summary bar, live match label, 70vh expand) is preserved.
```
┌─ KNOWLEDGE CENTER ── iiVI in C major · in C major ──────────────────── ▼ ─┐ (collapsed bar,
└──────────────────────────────────────────────────────────────────────────────┘ unchanged behaviour)
┌─ KNOWLEDGE CENTER ── iiVI in C major ──────────────────────────────── ▲ ─┐
│ ┌───────────────┬─────────┬──────────┬────────────────────┐ │
│ │ ▶ Jam Guide ● │ Explore │ Voicings │ Licks & Techniques │ ← section nav │
│ └───────────────┴─────────┴──────────┴────────────────────┘ (● = live) │
│ │
│ [ Jam Guide (live) — the existing Roadmap body, byte-for-byte: │
│ instrument tabs · style tabs · RoadmapTrack · voicing strip ] │
│ │
│ [ Explore — KB progression browser + famous progressions: │
│ style chips · (Foundation)(Intermediate) level chips · │
│ progression cards with level badge, chords-in-key, tip, songs ] │
│ │
│ [ Voicings — chord picker (root × quality, follows the live chord) → │
│ VoicingBrowser: guitar shapes + piano voicings, each with ▶ play ] │
│ │
│ [ Licks & Techniques — style chips · level chips · │
│ LickCard grid (tab SVG + technique glyphs) · glyph legend ] │
└──────────────────────────────────────────────────────────────────────────────┘
```
**Section semantics:**
1. **Jam Guide (live)** — default landing section; answers *"what do I play over this loop right now?"* The current Roadmap body moves in unchanged (RoadmapTrack, playhead, station voicings strip, piano tab from L-11). The `●` live dot on the nav pill pulses only when a loop is matched, so even from another section you see the guide is hot.
2. **Explore** — answers *"what could we play?"* A **KB progression browser** (new, simple: style chips from the `kb/index.js` registry → progression cards showing name, rn pattern, chords rendered in the current key, `tip`, level badge) plus the famous-progressions cards reused from ExplorePanel. Any chord chip → `ChordDetailModal` via `onChordClick`.
3. **Voicings** — answers *"how do I grip/voice this chord — and what does it sound like?"* ExplorePanel's root × quality picker (defaulting to `currentChord` when live) feeding **VoicingBrowser** (D-21): guitar alternatives via `ChordDiagram`, piano alternatives via `MiniPiano voicing`, each variant with a ▶ button through `src/lib/chordAudio.js`.
4. **Licks & Techniques** — answers *"give me a phrase."* Style chips → **LickCard** (D-22) grid of P-21 licks, level chips shared with Explore, technique-glyph legend once per grid (not per card). Styles without authored licks show an honest empty state ("No licks authored for Pop yet — Blues, Jazz and Funk have them").
**Why the dock and not a new page:** the Knowledge Center must be reachable *mid-jam* without losing the detection UI (key chip, fretboard, banner). The bottom dock already established that contract with the Roadmap; sections extend it. Concept-C's visual language (station cards, accent-on-active, dimmed-by-age tiers, amber for secondary/held tones) carries through all four sections.
---
## 2. IA map — reused / new / retired
| Piece | Fate | Where it lands |
|---|---|---|
| `JamGuide.jsx` Roadmap body (RoadmapTrack, voicing strip, instrument/style tabs, L-11 piano tab) | **Reused unchanged** | Section 1 content; JamGuide.jsx becomes the Knowledge Center shell + section 1 |
| `ExplorePanel.jsx` chord picker + quick-pick chips | **Reused** (refactored to named exports) | Section 3 toolbar |
| `ExplorePanel.jsx` `GuitarGrid` / `PianoGrid` | **Reused as interim**, then superseded by VoicingBrowser | Section 3 body until D-21 merges; kept as the no-audio fallback |
| `ExplorePanel.jsx` `ProgressionCards` (famous progressions) | **Reused** | Section 2, below the KB progression browser |
| KB progression browser (style → progressions with level badges) | **New** (small, data straight from `kb/index.js` which JamGuide already imports) | Section 2 hero |
| `VoicingBrowser.jsx` (D-21) | **New** | Section 3 + `ChordDetailModal` + station-enlarge (see §3) |
| `LickCard.jsx` (D-22) | **New** | Section 4 grid |
| Level filter chips | **New** (one shared component + one shared state in the shell) | Sections 2 and 4 toolbars (§4) |
| `EducationPanel.jsx` | **Retired** — stays unmounted; not edited (not in the L-22 lock). Its unique content (substitutions, variations) already lives in CurrentJamPanel + ChordDetailModal Theory tab. File deletion is a future cleanup task for Maestro to file | — |
| `CurrentJamPanel.jsx` | **Untouched this sprint** — overlap with section 2 acknowledged; folding it in is a follow-up (§10) | mid-page, as today |
| `ChordDetailModal.jsx` | **Shell untouched**; L-21 swaps only its Guitar/Piano tab grids for VoicingBrowser | overlay, as today |
Naming: the collapsed bar reads **"Knowledge Center — 〈live match label〉"**; the flagship keeps its name as section 1, "Jam Guide". No behaviour of the collapsed bar changes.
---
## 3. Where VoicingBrowser and LickCard mount
**VoicingBrowser** (`src/components/VoicingBrowser.jsx`, D-21) — three mount points, one component, prop-driven `{rootPc, quality}`:
1. **Knowledge Center → Voicings section** (L-22, via the ExplorePanel.jsx refactor) — the browse-first entry: pick any chord, audition every voicing.
2. **ChordDetailModal → Guitar/Piano tabs** (L-21) — replaces/extends the static `GuitarGrid`/`PianoGrid` so the modal's voicings become playable.
3. **Jam Guide station-enlarge** (L-21) — tapping a Roadmap station's thumbnail currently enlarges one `ChordDiagram`; it becomes the VoicingBrowser for that station's `{rootPc, quality}`, so mid-jam you can audition alternatives for the chord that's coming.
Data sources: guitar shapes from `src/lib/voicings.js` `GUITAR_SHAPES` (already the `ChordDiagram`-compatible `rootStr`/`offsets` format); piano voicings computed by `src/lib/piano.js` `pianoVoicing` (root / shell / rootlessA / rootlessB) rendered by `MiniPiano voicing`. Audio via `src/lib/chordAudio.js` (L-20). **Mic-feedback caveat surfaced in UI:** a one-line `text-gray-500` hint near the ▶ buttons — "played through your speakers — the mic may hear it" — mirroring the L-20 documentation.
**LickCard** (`src/components/LickCard.jsx`, D-22) — one mount point this sprint:
1. **Knowledge Center → Licks & Techniques section** (L-22): responsive grid, one card per P-21 lick, filtered by style chip + level chips. Card shows name, level badge, `chordContext` chip ("over the V7"), the tab SVG with technique glyphs (h, p, slide ⌒, bend ↑ … per the C-20 vocab), and the technique names it uses. The glyph legend renders once below the grid.
*Not* mounted in ChordDetailModal's Learn tab this sprint — that tab's `CHORD_PLAYBOOK` ASCII licks are a different corpus (`education.js`); converging them is future work, noted for Maestro (§10).
---
## 4. Level filter — placement and default
**Form:** two toggle chips, `Foundation` and `Intermediate`, rendered side by side in a section's toolbar. Both **on by default** (= show everything; badges do the signalling). Tapping one off narrows the list; both can't be off (tapping the last active chip is a no-op with a brief tooltip). This is the "easiest possible surface" per the directive: no new panel, no dropdown, one tap to see only intermediate material.
**State:** one `levels` state in the Knowledge Center shell, shared by both consuming sections — filter once, it holds as you move between Explore and Licks.
**Placement (exactly two spots):**
- **Explore section toolbar**, next to the style chips — filters the KB progression browser (every KB progression carries `level` after P-20).
- **Licks & Techniques toolbar** — filters LickCards (`lick.level` from the C-20 schema).
**Chip styling:** inactive = `bg-surface border-border text-gray-400`; active = `bg-accent/20 border-accent text-accent font-semibold` (the established active-tab treatment). Level *badges* on cards: foundation = `border-border text-gray-400`; intermediate = `border-amber/40 text-amber` (amber is already a token — no new colour needed).
**Honesty:** `FAMOUS_PROGRESSIONS` in `src/lib/education.js` carries **no** `level` field and `education.js` is in no task's lock — the famous-progressions cards in Explore show no badge and are **not affected by the filter** (they sit under their own "Famous progressions" subheading so the filter's scope reads clearly). Tagging that corpus is an open question for Maestro (§10).
---
## 5. Narrow-viewport plan
Target checks at implementation: **1280×800** (default Electron window), **~1024×768**, and **≤420px** width (half-snapped window).
- **Section nav:** horizontal chip row, `overflow-x-auto` + `shrink-0` pills (the pattern ChordDetailModal's tab bar and EducationPanel's nav already use) — never wraps into a tall block, never traps vertical scroll.
- **Dock body:** stays ~70vh with internal vertical scrolling; each section is a vertical stack on narrow.
- **Jam Guide section:** keeps its existing verified reflow (voicing strip wraps via `flex-wrap sm:flex-nowrap`, RoadmapTrack scrolls horizontally under the fixed playhead).
- **Explore:** progression cards are full-width stacked (they already are `flex-col`); chord chips inside cards wrap.
- **Voicings:** voicing-variant chips wrap; diagrams grid uses `repeat(auto-fill, minmax(140px, 1fr))` so thumbnails go 2-up at ~360px and never overflow; the enlarged diagram caps at container width (`max-w-full`, SVG scales via viewBox).
- **Licks:** grid `repeat(auto-fill, minmax(240px, 1fr))` → single column below ~520px; the LickCard SVG scales to card width (viewBox + `width:100%`), glyphs sized in SVG units so they scale with the tab.
- **Toolbars** (style chips + level chips): `flex-wrap` — level chips drop to a second row on narrow rather than shrinking below tap-target size (min 32px height).
---
## 6. Rationale + rejected alternatives (no user gate this sprint)
**Chosen: the four-section bottom dock grown from JamGuide.** Reasons:
1. **Minimum migration risk** — JamGuide already owns the dock chrome, the KB registry import, the live-match plumbing, and passed Critic's audio-contract gates repeatedly. Wrapping its body in a section nav is additive; the flagship Roadmap is never rebuilt.
2. **Mid-jam continuity** — knowledge is reachable while the detection UI stays on screen; the collapsed bar keeps broadcasting the live match even when closed.
3. **One home for the level filter** — shared state across Explore and Licks with zero duplication.
4. **App.jsx stays mount-only** — one additive prop (`onChordClick`, §7); no structural change near the audio callbacks.
**Rejected A — full-screen "Knowledge" mode/route** (top-level toggle Jam ⇄ Knowledge). More room per section, but it hides the detection UI while browsing (breaks the "look at it mid-jam" core promise), needs App.jsx restructuring far beyond mount-only, and adds a navigation concept the app doesn't have. Rejected on risk *and* UX grounds.
**Rejected B — keep three separate collapsible panels, restyled and cross-linked.** Cheapest to build, but it *is* the problem the user named: three headers competing in the scroll, three places for the level filter, no shared state, and the orphaned panels would be resurrected as-is (including EducationPanel's overlap with CurrentJamPanel). Rejected as fragmentation with a fresh coat of paint.
**Rejected C — right-side drawer.** Nice on ultrawide, but the Electron window is frequently narrow; a drawer either crushes the fretboard or overlays it (losing the glance-both-at-once value), and it duplicates the dock pattern the Roadmap already established. Rejected for viewport economics.
---
## 7. Migration order for L-22 (app green between every commit)
Precondition: **L-11** (piano in JamGuide) and ideally **L-21** hold locks on `JamGuide.jsx` — Maestro sequences L-22 after those merge. Order within L-22:
1. **Commit 1 — refactor `ExplorePanel.jsx` into parts.** Split into named exports: `ChordPickerToolbar`, `ExploreSection` (progression browser + famous progressions), `VoicingsSection` (picker + grids), `LevelChips`. Keep the default export as a thin composition of the parts. **Zero user-visible risk — the file is unmounted today.** Build + smoke green trivially.
2. **Commit 2 — Knowledge Center shell in `JamGuide.jsx` + App prop.** Add the section nav; move the existing Roadmap body (verbatim) into section 1; mount `ExploreSection` and `VoicingsSection` (with the interim static grids) from ExplorePanel.jsx; `App.jsx` gains exactly one additive prop on the existing JamGuide mount: `onChordClick={setSelectedChord}` (mount-only, nowhere near the audio callbacks/refs). App renders identically until the dock is opened; the Roadmap section is a code *move*, not a change.
3. **Commit 3 — level filter live.** `LevelChips` wired to the shared `levels` state; KB progression browser reads `progression.level` (P-20 must be merged); level badges on cards; licksless filter scope documented in the empty states.
4. **Commit 4 — Licks & Techniques section.** Mount the LickCard grid (needs D-22 component + P-21 data merged); style chips reuse the registry list section 1 already derives; shared level chips apply; empty state for lick-less styles.
5. **Commit 5 (in-sprint upgrade, may fold into L-21's landing) — Voicings section swaps static grids for `VoicingBrowser`** once D-21 merges: a one-line component swap inside `VoicingsSection`, with the static grids kept as the fallback when `chordAudio` is unavailable.
Every commit: `npm run build` + `node scripts/smoke.mjs` green; at no point does the app lose the Roadmap, the modal, or any mounted panel.
---
## 8. Tokens, contrast, keyboard
**Tokens only**`bg-surface` #0f0f0f, `bg-panel` #1a1a1a, `border-border` #2a2a2a, `accent` #a855f7, `amber` #f59e0b (all already in `tailwind.config.js`). **No new colour is required** for the Knowledge Center; level badges reuse amber, active states reuse the accent tints already shipped in JamGuide.
**Measured contrast commitments** (computed, not assumed):
- `accent` #a855f7 on `panel` #1a1a1a**4.4:1** — passes AA for large/bold text and UI components, *borderline for small normal text*. Rule: small accent text sits on `bg-surface` cards (**≈4.8:1**, passes) or is ≥ semibold at ≥14px; body copy is never accent.
- `gray-400` #9ca3af on panel ≈ **6.9:1** — the floor for any *essential* label.
- `gray-500` #6b7280 on panel ≈ **3.6:1** — decoration/microcopy only, never load-bearing text (existing app convention, now explicit).
- `amber` #f59e0b on panel ≈ **8.1:1** — level badges and secondary-tone markers are comfortably AA.
**Keyboard:** every section pill, style chip, level chip, voicing variant, ▶ play button, and LickCard is a real `<button>` in DOM order with `focus-visible:ring-2 ring-accent` (the shipped pattern). Section nav uses `aria-pressed`/`aria-current`; level chips `aria-pressed`; the live dot on the Jam Guide pill is decorative (`aria-hidden`) with the liveness conveyed in the pill's `aria-label`. ▶ buttons get descriptive labels ("Play C maj7 — shell voicing"). The dock's expand/collapse button keeps `aria-expanded`.
---
## 9. What stays untouched (explicitly out of scope)
- **The audio/detection pipeline** — `AudioCapture.jsx`, `handleNote`/`handleChroma`/`handleOnset`, all refs and `useCallback` contracts in `App.jsx`. The only App.jsx change in this whole plan is one additive prop on an existing mount (§7 commit 2). `chordAudio.js` is a separate, lazily-created context (L-20's contract) and never touches the detection contexts.
- **Detection UI** — key chip, `ProgressionBanner`, `ProgressionSuggestions`, main `Fretboard`/`Piano`/`BassFretboard`, the D-03 guide-tone cross-link.
- **Tuner, Loop Station, DebugView, DrumView** — not part of the Knowledge Center; their mounts and order in App.jsx are unchanged.
- **`CurrentJamPanel`** — remains mounted as-is despite overlapping Explore (§10).
- **`ChordDetailModal` shell** and its Theory/Learn/Progressions/Explore tabs — L-21 touches only the Guitar/Piano voicing grids.
- **Libraries** — `theory.js`, `education.js`, `voicings.js`, `match.js`, `piano.js`: read-only from this design.
---
## 10. Open questions for Maestro
1. **`FAMOUS_PROGRESSIONS` level tags** — `education.js` is unlocked and untagged; famous-progression cards are exempt from the level filter (§4). File a small Professor task to tag it, or accept the split scope?
2. **CurrentJamPanel convergence** — its "Similar Progressions"/"Style Options" views largely duplicate Explore. Recommend a follow-up task (post-sprint) to fold its unique bits (per-chord open-voicing strips, scale diagrams) into the Knowledge Center and retire the panel — reduces the main scroll by one header.
3. **EducationPanel.jsx deletion** — confirmed orphaned; retire-in-place this sprint, file a cleanup deletion (Luthier, trivial) later so dead code doesn't confuse future agents.
4. **L-21/L-22 sequencing on `JamGuide.jsx`** — both edit it; this doc assumes L-11 → L-21 → L-22 (or L-22 commits 14 then the §7 commit-5 swap folded into L-21). Maestro to serialize the lock.
5. **Naming check with the user (async, non-blocking):** collapsed bar renamed "Knowledge Center — 〈match〉"; "Jam Guide" lives on as section 1. Cheap to revert if the user prefers the old bar title.
+589
View File
@@ -0,0 +1,589 @@
# One Screen — the jam dashboard (task D-50)
> **Thesis:** the page stops being a tall stack of full-width bands and becomes a
> **viewport-fitting jam dashboard**: a full-width *slim loop strip* (the banner
> minus its big now-playing chord), then LEFT (~744px) the compact instrument
> view, the licks strip, and a new loop-relative *Related progressions* card;
> RIGHT (~500px) the suggested-voicings rail — the design's ONE justified
> internal scroller (§4). The dashboard is a **self-contained unit designed to
> fit 100vh at 1280×900**; a **JAM VIEW toggle** in the controls bar (§1.1)
> locks the page to exactly that unit (and goes browser-fullscreen,
> best-effort) while playing. In normal mode everything that is learning or
> behind-the-scenes (LoopStation, Debug, Drum, Tuner, KnowledgeDock) stays
> below the dashboard on the ordinary page scroll; in jam view it is hidden.
>
> User directive (2026-07-11, verbatim): *"the chord view and the chord loop
> incl the instrument below is too big, it takes up too much space, i want you
> to reconsider the positioning as this main view doesnt really add value:
> seeing the big chord 'now playing' in big is also unnecessary as you already
> see that one in the chords (loop) part. the suggested progressions on the
> right are also almost useless. they are nice but we need to rethink them in
> the form of SUGGESTED VOICINGS and the progressions we add relating to the
> loop. i'd like to have the suggested voicings on the right side of the screen
> (the jam guide). … i wanna see the chords, the loop, the voicings, the
> progressions, the licks all on one screen, everything you need to follow the
> jam correctly"*
>
> Refinement (2026-07-11, verbatim): *"it can still have a scroll down, but the
> main concept needs to be in one screen: potentially we add a fullscreen
> button so we can just show that when we are playing a jam. so that it fits
> the entire screen, everything that is learning and behind the scenes etc you
> can keep below/scrollable but we need one main view for live jams where we
> see everything at once (relating to the jam and the voicings and the licks
> and the chords and the loop)"* — the 100vh fit is a **hard design
> constraint** for the dashboard, not an aspiration; the fullscreen button is
> in scope (L-50 commit 3, §6.1); internal wrap/scroll inside a panel is a
> last resort and every instance below is justified.
**Supersedes** `integrated-glance.md` §1's full-width-band placement (the user
tested it and asked for the right column). That doc's **verified geometry stays
the arithmetic source here**: guitar cell ~93px, piano cells 160/284px, worst
piano gallery ~1,178px of cells, licks thumb card ~165px (in a 220px strip
slot), cell line heights ~140px guitar / ~125130px piano. Standing principles
(user memory): scroll > click; nothing shown twice; ONE global instrument
selector; the playhead highlights, never hides.
**Decision authority:** per the sprint header (no user gate), Muse picks the
strongest option and records rejected alternatives (§9).
---
## 0. What exists today (read from the code)
App.jsx mount order: `ProgressionBanner` (~608) → instrument row (~617629:
`Fretboard`/`BassFretboard`/`Piano` at 70% + `ProgressionSuggestions` at 30%) →
`JamGuide` full-width band (~635: GlanceRail all-expanded rows + LicksStrip) →
`LoopStation` → Debug/Drum/Tuner collapsibles → `KnowledgeDock` last. The band
starts ≈570px down at 1280×900 — voicings never share the screen with the
instrument view, and the licks strip sits another rail-height below that. The
banner burns its right 30% on a text-6xl "Now Playing" chord that duplicates
both the enlarged last history chip and the highlighted loop chip. The
directive kills all of that.
---
## 1. The grid
Assumed usable content box at a 1280×900 window: **~1,256 × ~836px** (Electron
title bar ~32px eats into the 900; App's `p-3` eats 24px each axis — heights
below are estimates, cell geometry is verified).
```
┌──────────────────────────────────────────────────────────────┐ ─┐
│ header (~52) │ │
│ controls bar — instrument · key lock · ⛶ JAM VIEW (~52) │ │
│ SLIM LOOP STRIP — key · history · ♻ loop chips (~76) │ │ the
├───────────────────────────────────────┬──────────────────────┤ │ dashboard
│ LEFT ~744px (flex-1) │ RIGHT 500px, │ │ = 100vh
│ │ own scroll (§4) │ │ in jam
│ compact instrument view (~240) │ │ │ view
│ licks strip (~190) │ SUGGESTED VOICINGS │ │
│ related progressions (~200) │ rail — GlanceRail / │ │
│ │ BassGuideRows rows │ │
├───────────────────────────────────────┴──────────────────────┤ ─┘
│ LoopStation · Behind the Scenes · Rhythm · Tuner · Knowledge │ normal mode
│ (the learning / behind-the-scenes area — page scroll) │ only; hidden
└──────────────────────────────────────────────────────────────┘ in JAM VIEW
```
- The **slim strip stays full width** (not inside the left column): it is the
status line for the whole dashboard — the rail's playhead and the strip's
active loop chip are the same "now", and a full-width one-liner costs only
~76px. (Putting it inside the left column would buy the rail ~88px of
first-paint height; the rail is internally scrollable anyway, and a
~450px-content strip floating in a 744px column looks broken. Not worth it.)
- **Grid:** `flex gap-3 items-start` → left `flex-1 min-w-0`, right
`w-[500px] shrink-0`, active at `xl:` (≥1280); below that the columns stack
(§7). 500px is the top of the licensed 420520 range because piano cells
need it (§4): at 500 the row interior is ~456px, which fits a 284px
two-octave cell **plus** a 160px one-octave cell per line (by ~4px — D-51
hardens the margin, §4); at 420 every two-octave cell rides alone.
- **The rail is height-bounded: `xl:max-h-[calc(100vh-1.5rem)]
xl:overflow-y-auto` — and NOT sticky.** (`sticky top-3` here would be inert:
inside the flex row the rail is the tallest item, so its containing block
equals its own height and there is zero travel to pin against — specifying
it would be a lie in class form.) What the bound actually buys, honestly:
the rail is the one unbounded surface (§4 math — a jazz piano loop is
~3,000px of rows). **(a)** Unbounded, it stretches the *document* to
~3,000px+, pushing the below-grid region (LoopStation, the whole learning
area) thousands of pixels down instead of one flick below the dashboard.
**(b)** The bound is exactly what jam view swaps to `h-full` — an unbounded
rail can never fit `h-screen` (§1.1). The rail's depth scrolls *within* its
column; the left column stays whole; at rest the rail shows ~644px (the
grid height). D-40 Rejected E (internal scroller) was rejected for the
*full-width band*, where it capped visible rows below 4 and nested a
scrollbar inside the page's only axis; in a two-column dashboard, bounding
the one unbounded column is what makes the dashboard a fixed-height unit —
the rejection does not carry over. **No auto-scroll in this sprint** (§4).
Vertical budget, normal mode at rest: 836 52 (header) 52 (controls) 88
(strip + gap) ≈ **644px for the grid**. Left stack ≈ 240 + 190 + ~200 + 24
gaps ≈ **654px** — everything on screen except the last ~1020px of the
related progressions card at exactly 900px window height; a micro-flick shows
it. In normal mode that residue is acceptable (the page scrolls anyway); **in
jam view it is not** — §1.1 makes the fit exact by construction, with the
related card as the left column's flex absorber.
### 1.1 Jam view — the one-screen lock + fullscreen toggle
The refinement's "fullscreen button". **Mechanism chosen: one button, two
layers on one state.**
- **Layer 1 — CSS jam view (the guarantee).** App gains a `jamView` boolean
(pure UI-state — nowhere near the audio callbacks/refs). When true:
- the page root becomes `h-screen overflow-hidden flex flex-col` (normal
mode: today's `min-h-screen` flow);
- **everything below the dashboard is not rendered** — LoopStation, Behind
the Scenes, Rhythm Analyser, Tuner, KnowledgeDock (conditional mount, not
`hidden`, so collapsed-state chrome can't leak height). Header, controls
bar, strip, grid remain — Stop/Start, the instrument selector, and the key
lock are jam-relevant chrome;
- the grid gets `flex-1 min-h-0`; the rail wrapper swaps its normal-mode
`xl:max-h-[calc(100vh-1.5rem)]` bound for `h-full overflow-y-auto` (the
column IS the viewport remainder, so the viewport-calc bound gives way to
the exact column height);
- the left column becomes `flex flex-col min-h-0`: instrument view and
licks strip fixed-height, the related progressions card `flex-1 min-h-0
overflow-y-auto` — the **one flex absorber** that soaks up the ±20px
between window sizes. Internal scroll here is the licensed last resort
and only engages below ~950px-tall windowed viewports (numbers below).
- **Layer 2 — browser fullscreen (the enhancement, best-effort).** The same
toggle calls `document.documentElement.requestFullscreen()` on enter and
`document.exitFullscreen()` on exit. Both return **Promises** — a bare
try/catch does not swallow the rejection; the calls must be
`.catch(() => {})` (or awaited inside try/catch). Electron grants it (plain
renderer, no IPC needed); if a browser build ever refuses, jam view still
works at layer 1. Fullscreen reclaims the ~32px
title bar (and any taskbar), which is exactly what turns "fits minus 20px"
into "fits clean" at 900-high screens.
- **The button** lives at the right end of the controls bar (the global,
always-visible chrome — same reasoning as the instrument selector):
`⛶ Jam view` / `✕ Exit` , `aria-pressed`, min-32px target,
`focus-visible:ring-2 ring-accent`, tokens only.
- **Exit paths, all restoring normal flow:** the button; **Escape** (a
`keydown` listener active only while `jamView` — needed because layer 1 can
exist without layer 2); and the native fullscreen Esc, synced via a
`fullscreenchange` listener (leaving fullscreen by any means switches
`jamView` off — one state, never half-exited). Entering does NOT auto-start
listening; leaving does NOT stop it — the toggle is layout-only.
**Jam-view budget (the hard numbers).** Grid height = viewport p-3 (24)
header 52 controls 52 strip + gap 88:
| Viewport | Grid (= rail height) | Left: fixed 454 (instrument 240 + licks 190 + gaps) → related card gets | Verdict |
|---|---|---|---|
| 1280×900 window (layer 1 only, content ~836) | **644px** | ~190px → heading + ~2.8 of 3 entries | fits; the card's last entry may shave ~20px — its internal scroll absorbs it |
| 1280×900 screen, true fullscreen (content ~876) | **684px** | ~230px → 3 entries fully clear, ~20px spare | **fits clean — the ~20px story is gone** |
| 1280×960+ screen, true fullscreen (content ≥936) | **≥744px** | ≥290px → up to 5 entries | fits with room |
The rail's *depth* still exceeds any of these for piano loops (§4 table — a
4-chord jazz loop is ~2,6003,000px of rows). That is the one place "see
everything at once" and "every voicing, all levels, zero clicks" (D-30)
mathematically collide; the cell strategy compresses first (recommended cell
leads; the 284+160 pair-fit halves mixed-station heights, §4) and the
remainder falls to the rail's contained scroll — the justified internal
scroller. All four *bounded* surfaces (strip, instrument, licks, progressions)
fit whole; guitar and bass rails fit ~2.53 of 4 rows with the "now" row
highlighted wherever it sits.
### 1.2 The slim loop strip — banner inventory
What `ProgressionBanner` renders today, and its disposition:
| Banner element today | Disposition |
|---|---|
| Key chip (root text-2xl accent + mode + confidence %) | **Survives** — leftmost, unchanged |
| Chord history (last 8, age-faded, tap → ChordDetailModal; current chip enlarged text-3xl + amber rn + pop-in animation) | **Survives, capped to last 5** — the enlarged current chip IS the now-playing display now; the pop-in animation moves with it |
| Loop row (♻ + chips, chord + rn, active chip accent-glow via `findLoopPosition`, "→ loop" tail) | **Survives, promoted onto the same row** as key + history (divider between) |
| `hidden lg:block` divider + right 30% column: "NOW PLAYING" label, **text-6xl amber chord**, rn, "tap for voicings" | **GONE.** The user's words: the loop chips already carry it. The tap-for-voicings affordance is not lost — every chip already opens ChordDetailModal, and the rail shows the loop's voicings permanently |
| Empty states ("Detecting key…", "Start listening…", "Play a chord") | First two survive; "Play a chord" dies with its column |
One row: key chip (~90px) + 5 history chips (~230px) + divider + up to 8 loop
chips (~320px) + tail ≈ ~720px — fits 1,256 with room; 12-chord loops (12-bar
blues) wrap the loop chips to a second line (strip ~104px, still fine).
**Strip chrome trim (part of the slimming):** `p-4 → p-2` and drop the history
wrapper's `pb-1` — the enlarged current chip (text-3xl + rn + chip padding) is
~58px tall on its own, so with p-4 the strip lands at ~9296px; the trim is
what makes the **~76px** figure true. Goes in L-50 commit 1 with the column
removal (§6.1).
Duplication audit: the current chord appears twice (last history chip + active
loop chip) — pre-existing, and the user's directive explicitly endorses the
loop chip as the "now"; the big third copy is what dies.
---
## 2. Compact instrument view — the mechanism
**Chosen: a `compact` prop on Fretboard / Piano / BassFretboard = trimmed card
chrome + a natural-width cap on the SVG. No fret reduction, no transform
scaling.**
- **Natural-width cap:** each SVG keeps `width:100%` but gains
`max-width: <its viewBox width>px` (Fretboard 674px, Piano 562px), i.e. it
never renders *above* scale 1.0. In the 744px left column (≈718px card
interior with the compact `p-3`) the fretboard sits at its designed 1.0 scale → SVG height
**186px** (today at 70% of 1,256 it renders at ~1.23 scale ≈ 229px + fat
chrome ≈ 320px card). Piano: 150px SVG.
- **Trimmed chrome:** `p-6 → p-3`, heading `mb-4 → mb-2`, and the legend row
(chord tone / pentatonic / scale dots) merges onto the heading line
(right-aligned) instead of a separate `mt-3` row. Card totals: fretboard
≈ **240px** (was ~320), piano ≈ **205px**.
- **Legibility, honestly:** at scale 1.0 the fretboard is at its *designed*
size — 20px note dots, 9px note labels, 10px string/fret labels, exactly
what ChordDiagram-era eyes were tuned on; nothing shrinks below today's
rendering (today it renders *larger* than designed, which is part of "too
big"). The compact card is smaller because the chrome and the over-scale go,
not because the notes do. Below ~700px column width the SVG scales down with
the column; at 0.9 scale (≈606px) labels are ~8px — the floor I'd defend.
The narrow plan (§7) gives the view the full window width anyway, so the
sub-1.0 zone only exists between ~1280 and ~1140px windows if the grid
breakpoint were lower — hence `xl:` for the grid, not `lg:`.
- Rejected mechanisms: **fewer frets** (07) kills position playing above the
7th fret — soloists live there; **CSS `transform: scale()`** blurs text and
shrinks hit targets — dishonest compactness; **hard height cap with
letterboxing** wastes the saved space as empty gutters.
---
## 3. What's removed / moved (full inventory)
| Surface | Disposition |
|---|---|
| Big "Now Playing" chord (banner right 30% + divider) | **Removed** (§1.2) |
| `ProgressionSuggestions` | **Unmounted; file kept in place** (EducationPanel/RoadmapTrack precedent — joins the retire-then-delete backlog item). Its job splits in two per the directive: "what to play on these chords" → the voicings rail; "where these changes can go" → RelatedProgressions (§5). Its generic genre/mood table and circle-of-fifths padding retire with it |
| The 70/30 instrument row | **Dissolved** — the instrument view becomes the left column's first block; the 30% slot's replacement is the rail column |
| JamGuide band (rail + licks, full width) | **Recomposed** — JamGuide stops rendering a band and renders the grid's jam surfaces: rail into the right column, LicksStrip + a related-progressions slot into the left (§6, component boundary) |
| LicksStrip | **Stays module-local in JamGuide.jsx** — no file move. It renders from JamGuide's match/context memos (`activeStyle`, `contextStation`); extracting it to its own file buys nothing and forces prop plumbing for the token-boundary context sort. It just mounts in the left column now |
| LoopStation | **Below the grid, first — and hidden in jam view.** Recorded call: the user's enumeration of the live-jam view is "the jam and the voicings and the licks and the chords and the loop", where "the loop" is the *chord* loop (the strip's ♻ chips), not the audio looper. LoopStation is a performance tool, but it is not on the list — it goes below with the learning surfaces, first in line because it feeds the detected loop. If the user misses it mid-jam, admitting it into jam view is a one-line conditional — the reversal path is cheap and noted in §9 |
| Behind the Scenes / Rhythm Analyser / Tuner collapsibles | Below LoopStation, unchanged |
| KnowledgeDock | **Last, unchanged** — browse & study stays below the fold |
| ChordDetailModal, AudioCapture, all `src/lib/**` audio/theory | Zero changes |
In **normal mode** everything below the grid remains exactly what the
refinement asks for — the learning / behind-the-scenes area on the ordinary
page scroll ("everything that is learning and behind the scenes etc you can
keep below/scrollable"). In **jam view** this whole region is hidden (§1.1) —
the dashboard is the entire page.
---
## 4. The rail at column width (~500px shell, ~456px row interior)
Row interior arithmetic: 500 rail section `p-3` + border (~26) row `p-2` +
border (~18) ≈ **456px** for header + cells. The inherited 93/160/284 figures
are already **box values** — integrated-glance's own verified sums prove it
(4×284 + gaps + chrome ≈ 1,178 with no extra per-cell padding), so nothing
gets padding added on top below. Cell strategy: **recommended-first, gallery
wrapped below — all cells always rendered, zero clicks** (D-30's "all at once"
directive stands; only the *geometry* adapts).
- **The recommended cell leads and reads as the answer.** The station's own
voicing (guitar: KB play shape badged "play"; piano: the authored/threaded
voicing with its honest label) keeps its accent-bordered figure and is
always the first cell — at column width it is frequently alone on line one,
which makes prominence free. D-51 may add nothing more than a slightly
stronger figure treatment (accent/60 border → accent) — no size difference,
no new colour.
- **Guitar:** cells ~93px (box) → **4 per line** (4×93 + 3×8 gaps = 396 ≤ 456
— fits with ~60px to spare, not borderline; a 5th cell at 497 does not).
Typical station = play cell + 36 placeable shapes = 47 cells → 12 cell
lines (~140px each). Header content (chord + rn + now/next + solo label +
aim dots + transition chip ≈ 540px of inline content) **wraps to 2 lines
≈ 50px** — fine, it already `flex-wrap`s. Row ≈ **206350px**.
- **Piano:** one-octave cells ~160px (box) → 2 per line (328 ≤ 456);
two-octave cells ~284px (box) → alone or, critically, **paired with a
one-octave cell: 284 + 160 + 8 = 452 ≤ 456 — the mixed pair FITS today, by
~4px**. That 4px is real but fragile (a longer label, a scrollbar gutter, a
browser rounding step could break it), so D-51's cell padding/gap shave is
**margin-hardening for an already-passing fit**, not a rescue — the pairing
is the difference between 5 and 3 cell lines on mixed stations. Worst
station (root above D with a true 7th — all five cells two-octave, per the
D-40 corrected math; 2×284 + 8 = 576 > 456 so they never pair with each
other): **5 cell lines ≈ 650 + header ≈ ~700px per row**. Best (roots CD /
triads): 3 lines ≈ ~490px.
- **Bass:** BassGuideRows text rows (~70px) or BassPatternCard rows — narrow
by construction; the column fits them with no adaptation beyond wrap, which
it inherits.
- **Wrap, never horizontal scroll** — unchanged invariant. The only permitted
horizontal scroller stays VoicingBrowser's per-cell guard around MiniPiano
thumbs on sub-320px pathologies.
### The honest vertical budget
| Scenario | Full rail height | Visible: normal rest (~644px) / jam view fullscreen (~684px) |
|---|---|---|
| 4-chord loop, guitar | ≈ 4×~275 avg + chrome ≈ **~1,150px** | ~2.3 / ~2.5 rows |
| 4-chord loop, piano (jazz flagship, mostly worst-case rows) | ≈ **~2,6003,000px** | ~1 / ~1.1 rows |
| 812 chord loop (12-bar) | guitar ~2,300 / piano ~5,000+ | scroll; the strip's loop chips always carry the position |
**What "one screen" honestly means:** all five surfaces are simultaneously
present at 1280×900 (whole, in jam view — §1.1) — but the rail's *depth* is a
scroll, contained in its column: it is the one panel whose content is
unbounded by construction (every voicing of every loop chord, D-30's "all at
once"), so it is the design's justified last-resort internal scroller; the
cell strategy above compresses first. A 4-chord guitar loop is ~1.4
rail-screenfuls; a 4-chord jazz piano loop is ~3.5. The playhead highlight
travels whether or not the row is in the scroller's window; the strip up top
always shows where you are. **No
auto-scroll in D-51** — same reasoning as D-40 §4, plus: contained auto-follow
is now *technically safe* (the scroller is no longer the document, so it can't
yank the page), so I flag it to Maestro as an optional 1-point follow-up
**after** the user has felt the manual version — auto-motion during a jam is
exactly the "it changes while I play" complaint in a new hat, so it must be
user-pulled, not designer-pushed.
Flag (not in scope): a **root-aligned MiniPiano crop** would turn most
two-octave piano cells into one-octave ones (~160px), roughly halving piano
rail heights. It reopens D-24's C-aligned-crop decision and MiniPiano is
frozen this sprint — Maestro may file it as a D-52 candidate.
---
## 5. Related progressions — the spec for L-51
**What it is:** 35 KB progressions genuinely related to the *detected loop*,
replacing ProgressionSuggestions' generic genre table. KB-sourced only
(`kb[style].progressions` — id, name, rn, degrees, qualities, level, songs),
loop-relative by construction.
### Ranking (computable today, no new theory)
Inputs: `detectedProgression` (chord-name strings), the KB registry, and
`matchLoopToProgression`'s result. Reuse `src/lib/match.js` machinery —
`loopToDegrees` and `canonicalDegrees` are currently module-private and must
become **additive exports** (L-51 lock addition; no behaviour change), next to
the already-exported `matchLoopToProgression`/`buildLoopIndex`.
1. `loopDeg = loopToDegrees(loop)`; bail to empty state if null.
`loopCanon = canonicalDegrees(loopDeg)`. `match = matchLoopToProgression(…)`
(the component computes its own — see §6's parallelism note).
2. Build the loop's **transition set** `T(loop)`: for each i (wrap-around),
the triple `(Δ = (deg[i+1]deg[i]) mod 12, q[i], q[i+1])` with qualities
from the chord-name suffixes (unmappable suffix → wildcard: match on Δ
alone). Same for every KB progression from its `degrees`/`qualities`.
**Collapse first — mandatory.** The live `detectedProgression` is a
*collapsed* form (detection never commits the same chord twice in a row),
while KB `degrees` are *raw*, bar-per-bar — blues-12bar is
`[0,0,0,0,5,5,0,0,7,5,0,7]`. Compared raw, the +100 same-canonical-shape
term would NEVER fire for the ~10 collapse-affected KB progressions —
silently killing the flagship "this 12-bar IS their 12-bar" relation (it
degrades, never misfires, which is why it would go unnoticed). So: before
`canonicalDegrees(p.degrees)` AND before building `T(p)`, **collapse
consecutive equal `(degree, quality)` pairs** in `p` (also with the
wrap-around pair). This additionally removes the harmless-but-deflating
`Δ=0` self-transitions from `T(p)`. Alternative once D-62's fix (a) lands
collapsed-form indexing in match.js: consume that shared collapsed form
instead of collapsing locally — coordinate via the §9 match.js
shared-file note.
3. Score every KB progression `p` with `p.id !== match.id`:
- **+100** if `canonicalDegrees(p.degrees) === loopCanon` — the same
changes in another style/length ("this turnaround IS jazz's IviiiV");
- **+40** if `p.style === match.style` (0 when nothing matched — the
ranking still works loop-relative off the raw degrees);
- **+12 per shared transition** (distinct triples in `T(loop) ∩ T(p)`),
capped at 36 — this is what finds "shares the ii→V" honestly;
- **+ up to 16** for rebased degree-set overlap (Jaccard × 16);
- **1 per chord of length difference** (tie-break toward similar-size loops).
4. Floor **24** (at least a shared transition + some overlap, or same-style +
substance) — never pad with junk; fewer honest entries beat five stretches.
Sort desc (stable by style, id), take **max 5; the dashboard budget
guarantees 3 visible** (§1.1) — the card is the left column's flex
absorber, so entries 45 show on tall viewports and scroll within the card
on tight ones.
### Per-entry render (~56px each)
- Line 1: **name** (gray-100 semibold) · style label (gray-500) · **level
chip** (ExplorePanel's `LevelBadge` language — untagged counts foundation) ·
annotation (gray-500, [10px]): `same changes` when the +100 fired, else
`shares {rn_a}→{rn_b}` naming p's rn at the top shared transition, else
`same style`.
- Line 2: the **chord chain realized in the current key** — rootPc =
`(keyRoot + degree) mod 12` + `CHORD_TYPES[quality].suffix` (the
stationVoicings formula), rendered as tappable chips with rn beneath
(banner-chip visual language, smaller); 12-bar chains truncate to the first
8 + "…". **Tap a chord → `onChordClick` → ChordDetailModal** — the existing
per-chord pattern (ExploreSection does exactly this); no new modal, no dock
deep-link API invented for v1.
### Empty states (honest)
- No loop detected → one-liner (~40px, dashed border):
*"Loop a progression — related changes from the songbook land here."*
- Loop but nothing ≥ floor → *"Nothing in the songbook genuinely relates to
this loop yet."* (never pad).
- Loop unmatched but candidates score (shape/transition terms only) → render
normally; the annotation still explains *why* each entry is there.
---
## 6. Component boundary + migration order (green at every commit)
**Boundary call:** `JamGuide` (default export) is promoted from "band" to
**jam-grid owner**: it renders the two-column `flex` region and takes two JSX
slot props from App — `mainView` (the instrument view — App keeps choosing
Fretboard/BassFretboard/Piano; JamGuide never imports them) and `relatedSlot`
(RelatedProgressions, mounted by App). Left column = `mainView` + LicksStrip +
`relatedSlot`; right column = the height-bounded scroller wrapping GlanceRail /
BassGuideRows / the heard-live fallback. Rationale: the match / stationVoicings
/ canonicalPos / focus machinery stays in ONE component with no context and no
logic lifted into App (the 🚨 App.jsx contract); the slots keep App as pure
mounts. **RelatedProgressions computes its own match** (memoized on the loop
key — `matchLoopToProgression` over a module-level index is trivially cheap);
this small duplicate computation is what makes L-51's files disjoint from
D-51's (they can run in parallel) and keeps the component pure/prop-driven:
`{ loop, keyInfo, onChordClick }`.
Sequenced: **L-50 → (D-51 ‖ L-51) → C-50.** Critic gates each.
### 6.1 L-50 (Luthier) — the dashboard restructure
**Files (re-lock at promotion):** `src/App.jsx` (layout/mounts only, 🚨 audio
contract grep-gated), `src/components/ProgressionBanner.jsx`,
`src/components/JamGuide.jsx`, `src/components/Fretboard.jsx`,
`src/components/Piano.jsx`, `src/components/BassFretboard.jsx` (compact prop —
mechanical chrome trim + max-width cap per §2; D-51 polishes visuals if
needed). **Not touched:** ProgressionSuggestions.jsx (unmounted, not edited),
GlanceRail.jsx, VoicingBrowser.jsx, all `src/lib/**`.
1. **Commit 1 — slim strip.** ProgressionBanner: delete the right 30% column +
divider + its `currentRN`/big-chord code path; merge key + history + loop
onto one row; `HISTORY_SHOWN` 8 → 5; chrome trim `p-4 → p-2` + drop the
history wrapper's `pb-1` (what makes the ~76px strip true, §1.2).
Standalone green.
2. **Commit 2 — the grid (atomic).** These land together or the page has a
hole: App replaces the 70/30 row + band with the `xl:` two-column grid;
**ProgressionSuggestions unmounted** (import + mount deleted); JamGuide
gains `mainView`/`relatedSlot` props and renders left/right columns, rail
wrapped in the height-bounded scroller (`xl:max-h-[calc(100vh-1.5rem)]
xl:overflow-y-auto` — no sticky, §1); instrument views gain
`compact` and App passes it; App passes `relatedSlot={null}` (slot renders
nothing until L-51). Green; contract grep clean.
3. **Commit 3 — jam view (§1.1).** App: `jamView` UI-state + the controls-bar
`⛶ Jam view` toggle button; page root `h-screen overflow-hidden flex
flex-col` + grid `flex-1 min-h-0` + left-column flex layout while active;
below-dashboard region conditionally unmounted; JamGuide's rail wrapper
accepts a `fill` (or `jamView`) prop switching the max-h bound → `h-full
overflow-y-auto`; best-effort `requestFullscreen()`/`exitFullscreen()`
**with `.catch(() => {})`** (they return Promises — a bare try/catch does
not swallow the rejection) + `fullscreenchange` sync + Escape keydown
(active only while `jamView`).
🚨 Pure layout/UI-state — zero contact with audio callbacks, refs, or
AudioCapture props; the toggle never starts/stops listening. Standalone
green on top of commit 2.
### 6.2 D-51 (Muse) — rail at column width
**Files:** `src/components/GlanceRail.jsx`, `src/components/VoicingBrowser.jsx`
(dense-path spacing only). Recommended-cell prominence; cell padding/gap shave
as **margin-hardening for the ~4px-tight 284+160 piano pair fit** (§4 — it
passes today; the shave makes it robust to label length / scrollbar gutters /
rounding); header wrap tuning at ~456px; verify wrap-never-scroll, playhead
highlight, AA contrast + focus rings; eyeball 1280×900, 1440×900, ~640px
stacked; recompute §4's table against the built thing. No auto-scroll
introduced.
### 6.3 L-51 (Luthier) — RelatedProgressions
**Files:** `src/components/RelatedProgressions.jsx` (new), `src/lib/match.js`
(**additive exports only**: `loopToDegrees`, `canonicalDegrees` — flag the
shared-file lock to Maestro at promotion), `src/App.jsx` (one-line: pass
`relatedSlot={<RelatedProgressions …/>}`). Ranking per §5, exported from the
component file for smoke coverage; honest empty states; build + smoke green.
Disjoint from D-51 (App.jsx/match.js vs GlanceRail/VoicingBrowser) → may run
in parallel after L-50.
---
## 7. Narrow plan (< xl, and the ~640px check)
Columns stack in the jam-following order: **loop strip → instrument view →
voicings rail → licks strip → related progressions** — i.e. the right column
tucks between mainView and LicksStrip, matching the user's list order.
Implementation: the rail block is simply the second child inside the stacked
flow below `xl` (JamGuide reorders its own children with responsive classes or
conditional order — no duplicate mounts). The rail **unbounds** below `xl`
(the max-h/overflow classes are `xl:`-prefixed) and lays out at natural height
in page flow — a nested scroller inside a scrolling page is a trap on touch.
Cell wrap at ~576px interior: guitar 5/line, piano cells **pair** (a 284px
two-octave + a 160px one-octave = 452, or two two-octaves at the 576 boundary) —
the same margin-hardened pairing D-51 verified for the bounded column (§4),
with more room here, not the "cells ride alone" of the narrower bounded width. The instrument
selector never moves: it lives in the controls bar, global, above everything
at every width.
**Jam view below `xl`:** the toggle still works — below-dashboard surfaces
hide and fullscreen still fires — but the stacked dashboard is taller than any
narrow viewport, so the page keeps scrolling (`h-screen overflow-hidden`
applies only at `xl:`+ alongside the grid). One-screen is a two-column
promise; jam view narrows honestly to "distraction-free" rather than
pretending the geometry works.
---
## 8. Rejected alternatives
**Rejected A — keep the rail as the full-width band and put licks +
progressions in the right column instead.** The rail is the surface the
directive names for the right side ("i'd like to have the suggested voicings
on the right side of the screen (the jam guide)") — and the math agrees: full
width doesn't make the rail *shorter* in any useful way (rows are height-bound
by cell-line count, and at 1,240px most piano galleries fit one line, but the
band still starts below the instrument view and pushes licks/progressions off
screen — today's exact failure). Licks and progressions are short; they fit
under the instrument view; the tall thing is what needs the dedicated column.
**Rejected B — one-screen by truncation: show only the recommended voicing per
station, gallery behind a tap.** Fits 4 stations in ~640px with zero scroll —
and violates three standing calls at once: scroll > click, D-30's "all at once"
gallery directive, and the learning value the user praised ("potentially learn
new ways to play it while you are playing"). The gallery stays; its depth
becomes a contained scroll, not a click.
**Rejected C — rail in the LEFT column, detection surfaces right.** Reading
order puts the primary, continuously-tracked surfaces (strip, instrument view)
top-left where Western eyes rest; the rail is a reference you glance at. Also
geometric: the instrument view wants the wide column (674px natural fretboard
width > 500px rail), and swapped columns would force the fretboard to ~0.68
scale — sub-legible labels.
**Rejected D — compact the instrument view via CSS `transform: scale()` or a
reduced fret range.** Covered in §2: transform blurs text and shrinks targets;
frets 07 amputates upper-position play. The natural-width cap + chrome trim
achieves the same ~80px saving honestly.
**Rejected E — page-flow rail (no height bound, no contained scroll).** The
"pure" reading of the no-nested-scrollbar taste rule — and it structurally
fails the refinement: an unbounded rail stretches the *document* to the rail's
full height (a jazz piano loop ≈ ~3,000px+), so the below-grid region —
LoopStation and the whole learning area — lands thousands of pixels down
instead of one flick below the dashboard; and in jam view an unbounded rail
can never fit `h-screen`, so the 100vh hard constraint is unmeetable without
the bound anyway. (The left column's five surfaces sit at the top either way —
the cost is the document's length and the jam-view fit, not their
co-presence.) Below `xl` this rejection inverts — §7 — because stacked
layouts have no second column to preserve.
---
## 9. Out of scope / flags for Maestro
- **Contained auto-follow** inside the rail scroller — now technically safe,
deliberately deferred; user-pulled follow-up only (§4).
- **LoopStation in jam view** — excluded per the user's own enumeration (§3
recorded call); if missed mid-jam, admitting it is a one-line conditional.
User-pulled follow-up only.
- **Root-aligned MiniPiano crop** (halves piano rail height) — reopens D-24;
D-52 candidate (§4).
- **`src/lib/match.js` additive exports** in L-51 — shared-file lock note at
promotion (§6.3). Same coordination point covers D-62: if its fix (a) lands
collapsed-form indexing in match.js first, L-51's ranking consumes that
shared collapsed form instead of collapsing locally (§5).
- **Retire-then-delete backlog** grows by ProgressionSuggestions.jsx
(unmounted L-50) alongside RoadmapTrack/CurrentJamPanel/EducationPanel.
- KnowledgeDock deep-link ("open Explore at style X") — not invented for v1;
RelatedProgressions taps go per-chord to ChordDetailModal (§5).
- No new tokens, no new colours, no dependencies, no KB/theory/audio changes
anywhere in this design. Geometry figures verified per integrated-glance.md;
module heights are estimates and D-51/C-50 re-measure the built thing.
+156
View File
@@ -0,0 +1,156 @@
# Related-area space layout — Try-this side-by-side + Related 2×2 (task D-75)
**Sprint:** `sprint-dashboard-polish` · **Owner:** Muse · **Impl tasks:** L-75 (TryThis.jsx + App mount) · L-76 (RelatedProgressions.jsx). Concept doc only — no code here.
**User ask (2026-07-13, verbatim, after running the working dashboard — happy with it):**
> "for the TRY THIS can we also add the little piano/fretboard next to it? now it also has a 1/2 option, but please put them next to each other, we have enough space in that area. also for the suggested progressions underneath there is space to have it cut in half to make it 2x2 in a similar fashion so we use the space and we fit everything in one big screen."
The user is pointing at the **LEFT column** of the jam dashboard (`flex-1`**744px** per `one-screen.md` §1 — far wider than the 500px rail) and asking us to **use its horizontal width**: (A) Try-this stops rotating one-at-a-time and shows **all** the current chord's substitutions **side by side**, each with a **mini instrument diagram** of that chord; (B) RelatedProgressions goes from a vertical list to a **2×2 grid**. Both to compress the vertical footprint so more fits on one screen.
---
## 0. The honest reversal (say it plainly)
L-74 shipped a **rotating one-at-a-time** Try-this card (`pickSub` / `advanceOnWrap` / `cycle`), because the same-day directive was *"more surprising, more jam-like, keeps offering new ideas."* The user has now **seen** that rotation and prefers **all-visible side-by-side** ("put them next to each other, we have enough space"). This doc **reverses** the rotation decision. That is not churn for its own sake — it is the user refining after seeing it live, exactly the loop the ensemble is built for. The **engine (`suggestSubstitutions`, L-73) and its rules do not change**; only the UI shape does.
What survives from L-74's `TryThis.jsx`:
- `parseChordName(name)` — pure, keep.
- `subsForChord(name, pos, loopArr, keyInfo)` — pure, keep.
- `pickSubject(loopArr, keyInfo, currentChord)` — pure, keep. This is what keeps the card **live**: it picks (a) the live `currentChord` if it parses and yields ≥1 sub, else (b) the first loop station that yields subs, else (c) `null` (honest empty). The card still follows the playhead — as you play, the subject chord and its ≤4 subs update.
What is **deleted**:
- `useState(cycle)` + the rotation `useEffect`, `advanceOnWrap`, `pickSub`, the `lastPosRef` / `lastNameRef`, the "N of M" indicator, the dot rail. Smoke coupling: **none**`scripts/smoke.mjs` has zero references to `advanceOnWrap` / `pickSub` / `parseChordName` (grep-confirmed; its "rotation" hits are all progression-match tests). So L-75 can drop the helpers without touching smoke; its lock stays `TryThis.jsx` + `App.jsx`.
Honest empties preserved: no key / no loop / atonal → `pickSubject` returns null → render nothing (unchanged). A chord with fewer than 4 valid subs simply shows fewer cards (the engine already `.slice(0,4)`; often 13 fire).
---
## 1. Try-this — side by side, one card per sub, each with an instrument diagram
### 1.1 The layout
Keep the outer section shell (`rounded-2xl border border-border bg-panel p-3`, the micro-header "Try this instead of {chord} · in {key} {mode}"). Below it, replace the single-card body with a **flex-wrap row of sub-cards**, one per `subject.subs` entry (≤4):
```
<div className="flex flex-wrap gap-2">
{subject.subs.map(sub => <SubCard … />)}
</div>
```
- **Container adapts to the instrument's cell width** (§3 proves the footprints — the across-count is NOT a fixed 4):
- **guitar / bass** — `flex flex-wrap gap-2`, each card `basis-[168px] grow min-w-[152px]`: the small cells (guitar 75px, bass none) let **4 fit one row** in the 720px interior; with 13 subs the cards `grow` to fill.
- **piano** — a **`grid grid-cols-2 gap-2`** (2×2): the mini keyboard's real footprint is up to **199px** (§3), so 4 piano cards cannot share one 720px row; a clean 2×2 mirrors the rail's own piano idiom (`VoicingBrowser` dense = `grid grid-cols-2`) and avoids the unbalanced 3+1 that a plain `flex-wrap` would produce.
- On a narrow/stacked viewport both collapse to **1-per-row** (`grid-cols-1` / `flex-wrap`) — the DoD reflow, for free.
Each **SubCard** is a vertical stack (`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-border/30 p-2`):
1. **Chord chip** (top) — the tappable control, reusing L-74's chip idiom exactly:
`button``onChordClick?.(sub.label)`, classes `rounded-lg border border-border bg-border px-2 py-1 text-sm font-bold text-gray-100 hover:border-accent/50 hover:text-accent focus-visible:ring-2 focus-visible:ring-accent`. `aria-label={`${sub.label} — ${sub.why}`}`. Tap → `ChordDetailModal` (App's `setSelectedChord`), where the **full** why + all voicings live.
2. **Mini instrument diagram** (middle) — of `{sub.rootPc, sub.quality}`, following the **global instrument** (§2). This is the "little piano/fretboard next to it" the user asked for.
3. **Category tag** — the L-74 language: `relative` / `borrowed` / `colour` / `V7`, with the `↻` accent glyph **only** for `relative` + `secondary_dominant` (circle categories — unchanged rule, `text-accent`).
4. **Why** (bottom) — `sub.why`, `text-[11px] leading-snug text-gray-400`, **`line-clamp-3`** with the full text on the chip's `aria-label` + tap→modal. At ~152168px card width, clamp-3 keeps whys up to ~75 chars whole; longer ones truncate visibly and the full sentence is one tap away. This is the honest trade of side-by-side: 4 whys visible at a glance costs each one its full width — the user chose see-all over the single full-width why.
### 1.2 Across-count is a function of the diagram footprint, not a fixed "4"
The user said *"put them next to each other … we have enough space"* and — resolving the piano case directly — *"for the piano's u can take more space in case there is indeed a bigger piano needed"* (2026-07-13). So: spend the **horizontal** budget as far as each instrument's diagram allows, and let piano take the **vertical** room it needs rather than cramming it. Guitar/bass cells are small (75px / none) → 4 subs sit **one row across**. Piano cells are large (up to 199px, §3) → 4 subs form a **2×2** — still "next to each other," still using the width, just a taller block (which the user explicitly OK'd). The count follows the footprint; the layout adapts (§1.1) instead of forcing a uniform grid that would clip the piano or waste the guitar row. **No MiniPiano change** — the keyboard renders at its honest size.
---
## 2. The instrument prop — threading + which resolver draws each diagram
`TryThis` needs the global `instrument` (`'guitar' | 'piano' | 'bass'`), which lives in `App.jsx` and is already handed to `JamGuide` (line 849). **Prop path:** add `instrument={instrument}` to the `<TryThis … />` mount in the `relatedSlot` (App.jsx ~line 859) and add `instrument` to the component signature: `TryThis({ loop, keyInfo, currentChord, onChordClick, instrument })`. One-line App change, grep-clean (no audio/callback contract touched) — this is the App half of L-75.
Per-instrument diagram resolver (mirror the established rail idiom in `VoicingBrowser.jsx:288`/`:327`):
| instrument | diagram | resolver → render |
|---|---|---|
| `guitar` | `ChordDiagram size="thumb"` (~75px) | `const shape = getGuitarVoicings(sub.label)[0]``<ChordDiagram shape={shape} rootPc={sub.rootPc} size="thumb" />`. `getGuitarVoicings` (voicings.js) resolves the first (barre/open) shape to **absolute** low-E-first frets; ChordDiagram's open-shape path windows them (draws a `5fr` label when up-neck). **Omit** ChordDiagram's own `label` prop — the chip above already names the chord (saves ~13px). If `getGuitarVoicings(sub.label)` is empty (rare), render **no** diagram — just chip + why (honest, no crash). |
| `piano` | `MiniPiano size="mini"` (107199px, §3) | `<MiniPiano voicing={{ ...pianoVoicing({ rootPc: sub.rootPc, quality: sub.quality }), rootPc: sub.rootPc }} size="mini" />`. **Spread `rootPc` back in**`pianoVoicing()` output carries none, and `VoicingPiano` needs it to badge "R" correctly (the VoicingBrowser:317-319 caveat). `size="mini"` = the dashboard-density scale already used in the rail's 2×2. |
| `bass` | **no diagram — honest** | Bass players read a chord symbol + root, not a chord grip; there is no compact bass-chord renderer, and reusing the guitar/piano diagram under a BASS selector would misrepresent the instrument (same honesty call the licks strip makes for bass). SubCard shows the chip + a small caption `root · {NOTES[sub.rootPc]}` (`text-[10px] text-gray-500`) + the why. Compact, correct, no faked shape. |
All diagrams use the established note-colour tiers already baked into `ChordDiagram`/`MiniPiano` (accent-purple root, light-purple/gray other tones, amber bass ring) — no new colour, no token change.
---
## 3. Space math — the LEFT column (~744px), honest
- Left column `flex-1 min-w-0`**744px** (one-screen.md §1). The `relatedSlot` is `flex flex-col gap-3` **directly** in it, so the Try-this `section` spans the full 744px. Section `p-3` (12px each side) → **interior ≈ 720px**.
- Per-card diagram footprints (recomputed from source geometry):
- **Guitar** `ChordDiagram size="thumb"`: `padL 14 + gridW 55 + padR 6 = 75px` wide; `padT 11 + gridH 55 + padB 6 = 72px` tall (label omitted). Root-independent.
- **Piano** `MiniPiano size="mini"` — the window is **C-octave-boundary anchored, NOT span-anchored** (MiniPiano.jsx:200-207): `octStart = ⌊minNote/12⌋`, `OCTAVES = max(1, ⌈(maxNote octStart·12)/12⌉)`, `SVG_W = (22·(7·OCTAVES + 1) + 2)·0.60`. A voicing whose *interval span* is under an octave STILL renders **2 octaves** whenever its notes straddle a C boundary — so "span ≤ 1 octave" does **not** imply "renders 1 octave." Worked: F♯ major triad `pianoVoicing({rootPc:6})` → notes `[6,10,13]` (span 7) → `octStart 0`, `maxNote 13``OCTAVES = ⌈13/12⌉ = 2``SVG_W = (22·15 + 2)·0.60 = 332·0.60 = **199.2px**`. This fires for **every triad quality at roots pc ≥ 6 (F♯–B)** (maxNote = root + top-interval > 12) and for shells at most roots (the +12 lift pushes the 7th over the next C) — i.e. roughly **half** of all sub roots, and sub roots routinely land upper-half (any G♯/A♯/B relative / borrowed / secondary-dominant candidate). One octave (107px) is the *best* case (triad roots pc 05); **199.2px is the planning footprint.** MiniPiano.jsx:29-31's own header documents this "2-octave mini cell (213.2px)". `SVG_H = (60 + 4)·0.60 = **38.4px** — octave-INDEPENDENT`: the window widens, height never does.
- **Across-count per instrument** (interior 720px, `gap-2` = 8px; an SVG's hard `width` attr floors the flex item's min-content at ≈ its px, so `basis-[168px]` cannot shrink a piano cell below its keyboard):
- **Guitar** — cell 75px, card ~152px min (diagram + `p-2` + chip width) → `4·152 + 3·8 = 632 ≤ 720`**4-across, one row.**
- **Bass** — no diagram, card ~152px → **4-across, one row.**
- **Piano** — worst-case cell 199.2px, card ~215px (+ `p-2` 16) → `3·215 + 2·8 = 661 ≤ 720` but `4·215 + 3·8 = 884 > 720`. So **at most 3 share a row**, and 4 can't. Laid out as a **2×2 grid** (§1.1, per user's "take more space"): 2 cells/row, `2·215 + 8 = 438 ≤ 720` (roomy, each keyboard gets its full width) → **2 across × up to 2 rows.**
- **Row / block heights** (`SVG_H` is octave-independent, so piano height is driven purely by sub-count, not cell width):
- **Guitar** card: chip ~22 + diagram 72 + why (clamp-3 @11px/1.35 ≈ 45) + tag ~12 + `p-2` 16 + inner gaps ~10 ≈ **~177px** → block (1 row + header 20 + `p-3` 24) ≈ **~221px.**
- **Piano** card: chip ~22 + diagram 38 + why ~45 + tag ~12 + `p-2` 16 + gaps ~12 ≈ **~145px**. 4 subs → 2×2 = `2·145 + 8 ≈ 298` → block (+ 44 chrome) ≈ **~342px**. ≤3 subs → one row → block ≈ **~189px.**
- **Bass** card ≈ chip 22 + root caption 14 + why 45 + tag 12 + `p-2` 16 + gaps 12 ≈ **~121px** → block ≈ **~165px.**
- **Headline:** guitar & bass show all ≤4 subs **4-across in one row** (~165221px block). Piano shows them as a **2×2** taking the full room each 199px keyboard needs — **~189px** block for ≤3 subs, **~342px when all 4 fire** (two rows). Only piano's across-count/row-count vary; height is width-independent (38.4px SVG). This taller piano block is the honest, user-sanctioned cost of "the little piano next to it."
---
## 4. RelatedProgressions → 2×2 grid (L-76, layout only)
### 4.1 The change
Today the populated list is `<ul className="flex flex-col gap-2.5">` of up to `RELATED_MAX_ENTRIES` (5) entries, each = name + meta row (style/level/annotation-or-role) + `ChordChain` chips. **Swap the container** to a 2-column grid:
```
<ul className="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
```
Each `<li>` (its inner markup — name row, `LevelBadge`, role/annotation, `ChordChain`) is **untouched**. `grid-cols-1` on narrow (the stacked reflow), `sm:grid-cols-2` at width. No ranking, scoring, `collapseChanges`, `siblingRole`, or annotation logic changes — L-76 is **presentation only**.
### 4.2 The cap: 5 → display **4** (no ranker change)
A clean 2×2 wants **4** cells; 5 leaves an orphan in a lonely third row that reads as broken. **Decision:** the ranker keeps `RELATED_MAX_ENTRIES = 5` (untouched — no smoke re-pin, no exported-constant edit); the **component renders `primary.slice(0, 4)`** into the grid. Entries are score-sorted, so this drops only the **lowest-scoring** 5th sibling — honest ("top 4"), and a future "show all" affordance could reveal it. This keeps L-76 strictly layout-scoped.
### 4.3 Which sections grid
Per L-72's finding-A, `secondary` (cross-style) is **currently always `[]`**: when a style is locked the panel is same-style-only; when unlocked, everything lands in `primary`. So **only `primary` is ever populated** → only it needs the grid. The optional cross-style section stays dormant; **if** a future change repopulates `secondary`, it gets its own `grid grid-cols-2` block below its own subheading (spec'd, not built). The **idle** dashed card and the two **empty-state sentences** ("You're on the only {style} loop…", "Nothing in the songbook genuinely relates…") stay single-column — they are prose, not a grid.
### 4.4 Space + height
- 2-col cell width ≈ `(720 10 gap) / 2 ≈ 355px`. A `ChordChain` of up to 8 chips (~40px each) wraps to ~2 rows inside 355px — fine, same chips, just narrower flow.
- Cell height ≈ name 18 + meta 16 + chain (2 chip-rows ~30 each) 60 ≈ **~95100px**. Block = header ~20 + subheader ("Try these in {style}") ~18 + (2 rows × 100 + 10 gap) 210 + `p-3` 24 ≈ **~272px**.
- The old vertical **5**-list block ≈ header 20 + subheader 18 + 5 × ~90 + 4 × 10 + 24 ≈ **~552px**. **2×2(4) ≈ 272px → saves ~280px** — the compression the user is after ("cut in half"), almost exactly halved.
---
## 5. The whole left column on one screen (honest)
Usable content box at 1280×900 ≈ **836px** tall (one-screen.md §4). Left stack in jam-view = instrument view + licks strip + `relatedSlot` (`flex-1 min-h-0 overflow-y-auto` absorber = TryThis + RelatedProgressions). Heights are **section-inclusive** (own header + `p-3`); gaps = 3 × `gap-3` = 36px.
| build / instrument | instrument | licks | try-this | related | +gaps | **total** | vs 836 box |
|---|---|---|---|---|---|---|---|
| **current L-74** (guitar) | 240 | 190 | ~154 (rotating, 1 card) | ~552 (5-list) | 36 | **~1172** | overflow **~336px** |
| **D-75 new — guitar** | 240 | 190 | ~221 (4-across, 1 row) | ~272 (2×2) | 36 | **~959** | overflow **~123px** |
| **D-75 new — bass** | 240 | 190 | ~165 (4-across, 1 row) | ~272 | 36 | **~903** | overflow **~67px** |
| **D-75 new — piano, ≤3 subs** | 240 | 190 | ~189 (one row) | ~272 | 36 | **~927** | overflow **~91px** |
| **D-75 new — piano, 4 subs** | 240 | 190 | ~342 (2×2, 2 rows) | ~272 | 36 | **~1080** | overflow **~244px** |
**Honest headline:** the RelatedProgressions 2×2 halves that block in every case (**~552 → ~272, 280px**) — the compression the user asked for. Guitar and bass compress hard: the fold shrinks from the current build's ~336px to **~67123px** (a micro-flick). Piano is the honest exception the user pre-approved: because MiniPiano's C-anchored window makes each keyboard up to 199px, four piano subs form a **2×2 (two rows, ~342px)**, so the piano-with-4-subs fold is **~244px** — still ~90px better than the current build, and only in the corner case where all four sub-rules fire *and* the diagram is piano (many chords yield 23 subs → piano one row → ~91px fold). The residue is absorbed only by the related area's `overflow-y-auto` (instrument + licks never move); a fold-flick is within the standing scroll license, and the user explicitly OK'd more vertical space for the piano. At **1280×960+** guitar/bass/piano-≤3 clear; piano-4-subs still wants a short flick for the related bottom row.
(The `flex-1 min-h-0 overflow-y-auto` absorber already exists — jam-view fit is exact by construction; only the related area, never the instrument/licks, absorbs the residue.)
> **Future option (out of D-75 scope):** the only lever to shrink the piano block further is a **span-anchored** MiniPiano `mini` window (crop to the voicing's actual keys instead of C-boundary octaves) — a MiniPiano code change, option (b), deliberately deferred. Flag for a follow-up task if the piano fold proves annoying in play.
---
## 6. Bounded scopes (disjoint)
- **L-75** — `src/components/TryThis.jsx` (rewrite: drop the rotation state/effect + `pickSub`/`advanceOnWrap` + indicator; keep `parseChordName`/`subsForChord`/`pickSubject`; render `subject.subs` as a `flex-wrap` row of SubCards, each with the instrument-following diagram per §2) **+** `src/App.jsx` (add `instrument={instrument}` to the TryThis mount — one line, grep-clean). No smoke coupling (§0). Disjoint from L-76.
- **L-76** — `src/components/RelatedProgressions.jsx` **only** (`ul` container `flex flex-col``grid grid-cols-1 sm:grid-cols-2`; `primary.slice(0, 4)` for display; idle/empty states untouched; **no** ranking/scoring/constant change). Disjoint from L-75.
Serialise or worktree — the two locks share no file. No `tailwind.config.js` change (no new colour); no `theory.js` / `piano.js` / `voicings.js` change (resolvers consumed as-is).
---
## 7. Rejected alternatives (≥2)
1. **Keep the rotation AND add a diagram to the single card.** Rejected: the user has seen rotation and explicitly asked for side-by-side ("put them next to each other, we have enough space") — a single card leaves the 744px width the user pointed at mostly empty, and re-litigates a decision the user has already moved past.
2. **One big shared diagram for all subs** (e.g. mark all subs on a single fretboard/piano, or a circle-of-fifths mini). Rejected: the subs differ in root, quality, **and** the right instrument grip; a per-sub diagram is exactly what teaches "play *this* shape instead," and it preserves the tap→modal-per-chord affordance. A merged diagram is unreadable and loses per-chord tapping.
3. **A uniform 2×2 for try-this across all instruments.** Rejected as the *default*: for guitar/bass (75px / no diagram) a 2×2 wastes half the row and is taller than 4-across for no benefit. Piano adopts a 2×2 only because its ~199px keyboards genuinely can't fit 4-across (§3) and the user OK'd more space for it — an instrument-driven adaptation, not a uniform choice.
4. **Cram/shrink the piano keyboards to force 4-across.** Rejected (and the user directly vetoed it, 2026-07-13): the `mini` SVG carries a hard width attr that floors the flex item, so "shrinking" would clip the keyboard; the honest fix is to let piano take a 2×2 and more vertical space. (A genuine width fix = span-anchored MiniPiano window = §5's deferred option b.)
4. **Change `RELATED_MAX_ENTRIES` 5→4 in the ranker for the 2×2.** Rejected: that edits an exported constant + forces a smoke re-pin, pulling L-76 out of "layout only." A component-side `slice(0, 4)` gets the clean grid with zero engine/scoring/test churn.
+196
View File
@@ -0,0 +1,196 @@
# Related-area v2 — always-multi-chord voicings rail + stable 3×3 Try-this (task D-76)
**Sprint:** `sprint-dashboard-polish` · **Owner:** Muse · **Impl tasks:** L-77 (voicings rail: GlanceRail.jsx + JamGuide.jsx) · L-78 (TryThis.jsx). Concept doc only — no code here. Supersedes the relevant parts of `related-area-layout.md` (D-75) that this refines.
**User ask (2026-07-13, verbatim — "one last change then we push everything"):**
> "for the right part 'different voicings' there is currently only one chord visible, we said to show all chords in the loop with the most recent first. at all times we wanna see all different voicings of the different chords. also for the TRY THIS part please always keep the layout the same if it's 2 or 3 chords i want it to stay in place its annoying when the layout changes then u dont know where to look. max it on 3 TRY THIS suggestions, PLUS please add at least 3 ways to play it. i think we have enough space for 3x3 guitar. for piano it can be just one thats okay."
Two independent surfaces:
- **(A) The voicings RAIL** (right column, `JamGuide` `railContent`) must show **multiple chords, most recent first, at all times** — the "only one chord visible" is the no-loop heard-live fallback.
- **(B) TRY THIS** (left column) caps at **3** suggestions, holds a **stable fixed layout** (2-vs-3 subs never shifts position), and gives each suggestion **≥3 ways to play it** — a **3×3** guitar grid, **1** piano keyboard, bass root caption.
---
## 0. Where "only one chord" actually comes from (say it plainly)
`JamGuide` `railContent` (JamGuide.jsx:373-435) has **three** states:
1. `match.matched``<GlanceRail stations={stationVoicings} …/>`**already** shows every loop chord as a vertical row (canonical KB order, playhead highlight, full per-row gallery). This is NOT the bug.
2. `liveChord` (no KB match but a chord is committing, JamGuide.jsx:252) → a **single** `<VoicingBrowser rootPc quality show dense/>` inside a "Heard live · {chord} — every voicing" section (JamGuide.jsx:411-425). **This is the "only one chord."**
3. else → the slim idle line.
So the fix is scoped to state 2 (and the idle-with-history case): replace the single-chord fallback with a **multi-chord, most-recent-first history rail**. State 1 (the loop) already satisfies "all chords of the loop" — the open question is only whether to physically reorder it most-recent-first (§1.3: no, and why).
---
## 1. The voicings rail — always multiple chords, most recent first
### 1.1 Decision: keep GlanceRail-for-loop + a new history fallback — do NOT fully unify
**Recommendation: keep the two paths, replace only the single-chord fallback.**
- **Loop matched** → `GlanceRail` as today (canonical order, playhead, per-row gallery, the D-40 voice-leading education). Untouched.
- **No loop** → a **new `HistoryRail`** driven by the recent DISTINCT `chordHistory`, most-recent-first, each rendered as a GlanceRail-style voicing row.
**Why not unify** (always drive the rail from recent-distinct-history, loop adds highlighting): the loop rail's education is *canonical-order-dependent*. `GlanceRail` computes `voiceLeadingPairs` between **canonically adjacent** stations (GlanceRail.jsx:234-241) and renders per-row `TransitionChip`s ("next F→E · ½ step down") plus the wrap chip ("loop") — a voice-leading **wheel**. Reordering those rows most-recent-first would make every "next …" chip point at the wrong neighbour, and the wrap chip lie. Unifying therefore *destroys* the loop education to satisfy a directive the loop already meets another way (§1.3). So: two paths, one shared row idiom, no loss.
This is also the **minimal, lowest-regression** change: `StationRow` (loop) stays byte-identical; the new `HistoryRow`/`HistoryRail` is additive.
### 1.2 The no-loop history rail — data source & most-recent-first
`chordHistory` is already a `JamGuide` prop (JamGuide.jsx:186; App passes it at App.jsx:846) — **no App change needed.** Build the rail entirely from it:
```
recentDistinct(chordHistory, cap = 6):
seen = new Set(); out = []
for name from END of chordHistory backwards: // newest first
parsed = parseChord(name) // voicings.js — same parser JamGuide already imports (line 12)
if (!parsed) continue // unparseable → skip, no crash
if (seen.has(name)) continue // DISTINCT by chord name (subsumes consecutive-dedup)
seen.add(name); out.push({ ...parsed, label: name })
if (out.length === cap) break
return out // out[0] = the chord sounding now
```
**"Most recent first" mapping:** walk `chordHistory` from the tail (the newest commit is `chordHistory[len-1]` = `currentChord`, App.jsx:572). `out[0]` is therefore the current chord, `out[1]` the previous distinct chord, etc. **Distinct-by-name** (not merely consecutive-dedup) so "F Am F Am F" yields `[F, Am]` — the user wants the *different chords*, each once, not a ping-pong; the most-recent occurrence fixes each chord's slot. Cap **6** rows.
Each entry parses to `{ rootPc, type, label }` (voicings.js `parseChord` returns `{ rootPc, type }`). Feed each as a row.
**Honest edges:**
- **1 chord ever played** → 1 row. Unavoidable (there is genuinely one chord) — but it is now a *row in the rail idiom*, not a bespoke single-chord section. Strictly better than today, which also showed one.
- **20 chords** → the 6 most-recent distinct, newest first. Older ones roll off (the rail is a live window, not a log — the KnowledgeDock Voicings section is the browse-everything surface).
- **All same chord** (F F F F) → 1 row.
- **Unparseable name** → skipped; if *nothing* parses → fall through to the existing slim idle line (state 3), unchanged.
### 1.3 What "most recent first" means for the LOOP (honest)
For the loop, `GlanceRail` stays **canonical KB order** and the **playhead** (accent ring + "now" badge + `aria-current`, GlanceRail.jsx:184-188) marks the chord you're on. That IS "most recent, unmistakable" — it is exactly the active-chord-at-a-glance the DoD demands — without reordering. Physically reordering the loop rows most-recent-first is **rejected** (§6.1) because it breaks the voice-leading wheel. If the user, after seeing this, still wants the loop *physically* re-sequenced, that is a follow-up that must first rework/retire the `TransitionChip` education — flag to Maestro, don't silently do it.
### 1.4 The HistoryRail row anatomy (reuse, minus loop chrome)
A new `HistoryRow` (sibling of `StationRow` in GlanceRail.jsx — keep `StationRow` untouched for the loop). Per row, most-recent-first:
- **Header line:** `st.label` (plain bold text — no focus-toggle button; history chords aren't stations, so no fretboard-focus wiring → simpler, and the main Fretboard already follows `currentChord`). `SoloLabel` + `AimDots` **kept** (GlanceRail.jsx exported atoms) — those are *per-chord* guide-tone education, correct for any chord, and give the history rail visual parity with the loop rail. **No** `TransitionChip` (no canonical adjacency), **no** "next" tag.
- **"now" marker on row 0** (the most-recent chord): the same `border-accent bg-accent/10 ring-2 ring-accent` + "now" badge `StationRow` uses for the playhead — so the active chord is unmistakable (DoD). Rows 1-5 recede to the `opacity: 0.85` floor, exactly as inactive loop rows.
- **Gallery — as-is:** `<VoicingBrowser rootPc={st.rootPc} quality={st.type} show={instrument} dense max={4} />`. Guitar ≤4 recommended-first shapes on one line, piano 2×2 mini, **no ▶** — the identical per-row gallery the loop rail uses. `recommended` is **null** (an arbitrary heard chord has no authored KB play), which `VoicingBrowser` already handles (order untouched, no badge).
`HistoryRail` header (the section h4): `Recent chords · newest first — every voicing`, with the one-line microcopy `Following what you play — the newest chord is up top; no repeating loop yet.` (tokens: `bg-panel`, `border-border`, `text-gray-500`).
### 1.5 Bass, no loop
The no-loop bass path today renders `BassGuideRows` with a **single** live station (JamGuide.jsx:404-410). Extend it to the **same recent-distinct stations, most-recent-first**: pass the `recentDistinct` array to `BassGuideRows` with approach suppressed (history is not a loop → no "approach into the next chord" line; reuse the existing `live` gate, which already turns `next` off at BassGuideRows.jsx:557, or add a `history` flag if the "· heard live" header wording should change to "· recent"). Root + fifth per row; row 0 marked "now". This keeps all three instruments honest and multi-chord.
### 1.6 Rail fit (unchanged geometry)
The rail column is 500px with the D-51 margin-hardened interior (~451px worst-case; GlanceRail.jsx:5-13). `HistoryRow` reuses the exact `VoicingBrowser dense max={4}` cell math, so guitar 4-across (374 ≤ 451) and the piano 2×2 pair (442 ≤ 451) fits are **byte-for-byte the loop rail's** — no new fit risk. Up to 6 rows stack vertically inside the column's existing `overflow-y-auto` scroller (JamGuide.jsx:493-497); the user owns the scrollbar (no auto-scroll — GlanceRail.jsx:46-49's law holds).
---
## 2. Try this — max 3, stable 3-slot layout, ≥3 ways to play each
### 2.1 The reshape: from cards-across to rows-of-shapes
Today `TryThis` (TryThis.jsx:171-189) lays subs **side by side** (columns = subs), each `SubCard` carrying **one** diagram. D-76 turns this **90°**: **rows = subs, columns = shapes.** Each sub becomes a **horizontal row**: an identity block (chord chip + tag + why) on the left, and its **≥3 ways to play it** on the right. Three sub-rows stacked = the "3×3" the user pictured (3 subs × 3 guitar shapes).
Cap: `subject.subs.slice(0, 3)` (was up to 4 — TryThis.jsx:160 `subs`). The engine (`suggestSubstitutions`, L-73) and `pickSubject`/`subsForChord`/`parseChordName` are **unchanged** — reactivity preserved: subject still follows `currentChord`, subs recompute per chord (TryThis.jsx:79-90, 152-160). Only the render and the cap change.
### 2.2 The STABLE fixed 3-slot layout (the anti-jump)
**Always render exactly 3 slots**, in order:
```
<div className="flex flex-col gap-2">
{[0,1,2].map(i => subs[i] ? <SubRow sub={subs[i]} …/> : <EmptySlot key={i}/>)}
</div>
```
- A present sub → `SubRow`. An absent one → `EmptySlot`: a **subtle placeholder** that holds the **exact SubRow height** for the current instrument — `rounded-lg border border-dashed border-border/50 bg-transparent` at low opacity, a centred muted `—` (`text-gray-600 text-[11px]`), `aria-hidden`. It reads as "an intentionally empty slot," not as broken, and — critically — the first two rows **never move** whether the chord yields 2 or 3 subs. This is the exact complaint the user raised ("annoying when the layout changes then u dont know where to look"): with fixed slots, sub #1 and sub #2 are always in the same pixel band.
- **Uniform row height per instrument** (not across instruments — the global `instrument` is fixed at any moment, so all 3 slots share one instrument's row height): guitar `min-h-[100px]`, piano `min-h-[72px]`, bass `min-h-[64px]` (§3 math). `EmptySlot` inherits the same `min-h-*`.
Why 3 slots and not "as many as fire": stability is worth a little reserved whitespace. The user explicitly chose predictable position over density here.
### 2.3 SubRow — guitar (the 3×3), piano (1), bass (caption)
Outer row: `flex items-center gap-3 rounded-lg border border-border bg-border/30 p-2 min-h-[…]` (reuses the SubCard token palette — TryThis.jsx:126).
**Left identity block** (`flex flex-col gap-1 shrink-0 w-[180px]`), all instruments:
1. **Chord chip** — the tappable control, reused verbatim from TryThis.jsx:127-134: `button → onChordClick?.(sub.label)`, `rounded-lg border border-border bg-border px-2 py-1 text-sm font-bold text-gray-100 hover:border-accent/50 hover:text-accent focus-visible:ring-2 focus-visible:ring-accent`, `aria-label={`${sub.label} — ${sub.why}`}`. Tap → `ChordDetailModal`. Inline beside it: the **category tag** (`relative`/`borrowed`/`colour`/`V7`) + the `↻` accent glyph for circle categories only (`CIRCLE_CATEGORIES`, TryThis.jsx:48-55 — unchanged rule).
2. **Why**`sub.why`, `text-[11px] leading-snug text-gray-400`, `line-clamp-2` (the identity block is ~180px wide; 2 lines ≈ 50 chars; full text stays on the chip `aria-label` + tap→modal). Wider than the old 152px card, so whys clip less.
**Right "ways to play" block**, by instrument:
| instrument | right block |
|---|---|
| **guitar** | `flex gap-2` of **up to 3** `ChordDiagram size="thumb"` (~75px), from `getGuitarVoicings(sub.label).slice(0, 3)`. Each thumb captioned underneath with its shape name (`text-[9px] text-gray-500` — e.g. "E Barre", "A Barre / 5fr") so the three read as **three genuinely different grips**, not a repeat. **Omit** ChordDiagram's own `label` (the chip names the chord). Fewer than 3 shapes exist (dim/aug, §2.4) → show what exists; the row does not pad with blanks (the shapes left-align, the row height is fixed by `min-h`). |
| **piano** | **one** `MiniPiano size="mini"` (per the user: "for piano it can be just one thats okay"): `<MiniPiano voicing={{ ...pianoVoicing({ rootPc: sub.rootPc, quality: sub.quality }), rootPc: sub.rootPc }} size="mini" />`. Spread `rootPc` back in (the VoicingBrowser.jsx:317-319 caveat) so "R" badges correctly. |
| **bass** | no diagram — `root · {NOTES[sub.rootPc]}` caption (`text-[10px] text-gray-500`), the same honesty call TryThis/BassGuideRows already make (there is no compact bass-chord renderer). |
All diagrams use the established tiers baked into `ChordDiagram`/`MiniPiano` (accent-purple root, gray/light-purple other tones) — **no new colour, no token change.**
### 2.4 Honest empties
- **Fewer than 3 subs** for the chord → the missing slot(s) render `EmptySlot` (§2.2). Position of the present subs is unchanged.
- **A guitar sub with fewer than 3 shapes**: `getGuitarVoicings` returns all placeable shapes — barre forms are always placeable (any root ≤ fret 15). The engine only ever emits **{min, maj, dom7, maj7, add9, maj6, min7, sus4}** (every `mk()` call in theory.js:801-917 — dim/aug are **never** substitution candidates, so they can't appear here). Of those, **maj/min/dom7/maj7/min7/sus4/maj6** carry ≥3 barre shapes → the full 3×3 (voicings.js:10-53, 76-105). The genuine 2-shape case is **add9**: `getGuitarVoicings` returns only 2 barre shapes (E Barre, A Shape) for **9 of 12 roots**, and 3 only for **C/G/D** (which add an open Cadd9/Gadd9/Dadd9, voicings.js:116-121) → that sub-row honestly shows **2** thumbs, `slice(0,3)` simply yielding two. And add9 is **routinely** emitted — Rule C picks add9 for a major-family chord whose maj7 added tone is non-diatonic (e.g. in D major, the V chord A → **Aadd9**), which is common on major-family V-type chords. So a 2-thumb guitar row is a **regular, honest occurrence**, not a rarity; it never crashes and never pads with fakes.
- **No subject** (no key / no loop / atonal) → `pickSubject` returns null → render nothing (TryThis.jsx:157, unchanged).
### 2.5 Reactivity preserved
`pickSubject(loopArr, keyInfo, currentChord)` still chooses the live chord first, then the first loop station that yields subs (TryThis.jsx:79-90). As the progression evolves the subject and its (now ≤3) subs recompute every commit — the user confirmed they want it to evolve with the playing. The only behavioural deltas: **cap 3** and **3 shapes each**.
---
## 3. Space math — honest
**Left column** `flex-1 min-w-0`**744px**, section `p-3` → interior **≈ 720px** (one-screen.md §1; carried from D-75 §3). Footprints from source geometry: `ChordDiagram size="thumb"` = **75×72px** (padL 14 + gridW 55 + padR 6; padT 11 + gridH 55 + padB 6). `MiniPiano size="mini"` = up to **199×38px** (C-anchored window, D-75 §3 — width varies with root, **height is octave-independent 38.4px**).
**Guitar SubRow.** Right block: 3 thumbs = `3·75 + 2·8 = 241px` (+ 9px shape captions → ~84px tall). Left identity 180px + gaps ≈ `180 + 12 + 241 = 433 ≤ 720` — comfortable, ~287px to spare. Row height = max(thumb 72 + caption 12 = 84, chip 22 + why-2-lines 30 = 52) + `p-2` 16 ≈ **~100px** → `min-h-[100px]`. **3 slots** = `3·100 + 2·8 = 316`; block (+ header 20 + `p-3` 24) ≈ **~360px** — fixed, 2 subs or 3.
**Piano SubRow.** Right block: one `mini` keyboard ≤199px wide, 38px tall. `180 + 12 + 199 = 391 ≤ 720`. Row = max(38, 52) + 16 ≈ **~72px** → `min-h-[72px]`. **3 slots** = `3·72 + 16` ≈ 232; block ≈ **~276px**.
**Bass SubRow.** No diagram. Row = 52 + 16 ≈ **~64px** → `min-h-[64px]`. 3 slots ≈ 208; block ≈ **~250px**.
Note the 3×3 guitar block (~360px) is **taller** than D-75's 4-across single row (~221px) — the honest cost of "at least 3 ways to play each," which the user asked for directly.
### One-screen budget @ 1280×900 (usable box ≈ 836px, one-screen.md §4)
Left jam-view stack = instrument view + licks strip + `relatedSlot` (`flex-1 min-h-0 overflow-y-auto` absorber = **new** Try-this + RelatedProgressions 2×2 from L-76); gaps = 3·`gap-3` = 36px.
| instrument | instrument | licks | try-this (new) | related 2×2 | +gaps | **total** | vs 836 |
|---|---|---|---|---|---|---|---|
| **guitar** | 240 | 190 | ~360 (3×3, 3 slots) | ~272 | 36 | **~1098** | overflow **~262px** |
| **piano** | 240 | 190 | ~276 (1 kbd, 3 slots) | ~272 | 36 | **~1014** | overflow **~178px** |
| **bass** | 240 | 190 | ~250 (caption, 3 slots) | ~272 | 36 | **~988** | overflow **~152px** |
**Scroll story (honest):** the instrument view and licks strip stay **pinned** (they are `xl:shrink-0`, JamGuide.jsx:476-481); only the `relatedSlot` — the `flex-1 min-h-0 overflow-y-auto` absorber (JamGuide.jsx:485-489) — scrolls. So the taller 3×3 try-this deepens the fold in the *related area only*: guitar wants a ~262px flick to reach the bottom of the RelatedProgressions grid, piano ~178px, bass ~152px. This is ~139px more than D-75's guitar fold (~123px) — the direct, user-requested trade for 3 grips per sub. Instrument + licks never move; the active chord and the Try-this subjects are always above the fold. At **1280×1080+** guitar clears; piano/bass clear at ~1100. The `overflow-y-auto` absorber makes the fit exact by construction — the residue lands only in the related area, never on the instrument/licks the player watches.
*(The right rail is independent: `HistoryRail`'s ≤6 rows live in the 500px column's own `overflow-y-auto` scroller — they do not affect the left-column budget.)*
---
## 4. Bounded scopes (file-disjoint → parallelisable)
- **L-77 — the voicings rail.** Files: **`src/components/GlanceRail.jsx`** (add `HistoryRow` + exported `HistoryRail`, reusing the `VoicingBrowser dense max={4}` gallery + `SoloLabel`/`AimDots`; `StationRow`/`GlanceRail` for the loop stay byte-identical) **+ `src/components/JamGuide.jsx`** (a `recentDistinct(chordHistory)` memo; the no-loop `railContent` branch → `HistoryRail` for guitar/piano and `BassGuideRows` fed the recent-distinct stations with approach suppressed for bass; the single-`VoicingBrowser` fallback is retired). **No App change** (`chordHistory` already flows in, JamGuide.jsx:186 / App.jsx:846). No `theory.js`/`voicings.js`/`piano.js`/`tailwind.config.js` change (resolvers/tokens consumed as-is).
- **L-78 — Try this.** File: **`src/components/TryThis.jsx` only.** Cap `subs.slice(0,3)`; replace the cards-across body with the 3-slot rows-of-shapes (§2); keep `parseChordName`/`subsForChord`/`pickSubject`. **No App change** (`instrument` already threaded by L-75, App.jsx:864). No engine change (§2.5).
**Disjoint:** L-77 = {GlanceRail.jsx, JamGuide.jsx}; L-78 = {TryThis.jsx}. **Zero file overlap** → they can run in parallel (worktree) or serial, in any order. Neither touches `theory.js`, `voicings.js`, `piano.js`, `App.jsx`, or `tailwind.config.js`. C-70's `VoicingBrowser.jsx` aria fold is disjoint from both.
*(If a future revision wants the history rail and the loop rail to share one component body, that unification is out of D-76 scope — it would re-touch `StationRow` and risk the loop path; keep it a separate task.)*
---
## 5. What does NOT change
- The engine `suggestSubstitutions` and its rules/why-copy (L-73) — untouched; only the display cap (4→3) and per-sub shape count change.
- The loop rail (`GlanceRail`/`StationRow`): canonical order, playhead, voice-leading wheel, focus→fretboard — all byte-identical.
- `VoicingBrowser`, `ChordDiagram`, `MiniPiano`, `pianoVoicing`, `getGuitarVoicings` — consumed as-is.
- Tokens: `bg-panel`, `bg-surface`, `border-border`, `text-accent`/`bg-accent`, the accent ring, the established note-colour tiers. **No new colour, no `tailwind.config.js` edit.**
---
## 6. Rejected alternatives (≥2)
1. **Reorder the LOOP rail most-recent-first (physically re-sequence the rows).** Rejected: `GlanceRail` builds `voiceLeadingPairs` between *canonically adjacent* stations and shows per-row "next F→E · ½ step down" + a "loop" wrap chip (GlanceRail.jsx:118-132, 234-241). Reordering makes every transition chip point at the wrong neighbour and the wrap chip lie — it trades away the loop's whole voice-leading education for a re-sort the playhead highlight already conveys. The current chord is unmistakable *in place* via the "now" ring.
2. **Fully unify: always drive the rail from recent-distinct-history, loop merely overlays highlighting.** Rejected: same casualty — the transition/wrap education is canonical-order-only, and a history-ordered rail can't carry it. Unifying is a larger refactor that *reduces* the loop's teaching value. Two paths sharing one row idiom is smaller and loses nothing.
3. **Keep Try-this side-by-side (columns = subs) and just add 2 more diagrams per card.** Rejected: 3 subs × 3 guitar thumbs across = `3·(3·75) ≈ 675px` of diagrams fighting for a 720px row with no room for chips/whys, and it re-introduces the 2-vs-3 horizontal jump the user hates (cards grow/reflow). Rows = subs, columns = shapes, fixed 3 slots is the stable-position answer.
4. **Let the number of Try-this slots follow the sub count (render 2 rows when 2 subs).** Rejected: that is exactly the "layout changes, you don't know where to look" jump the user called out. Reserving 3 slots with a subtle placeholder costs a little whitespace and buys constant position — the user's explicit priority.
5. **Shrink guitar thumbs to force less height / cram the 3×3.** Rejected: 75px is the established `ChordDiagram thumb` size used everywhere (rail, KC, modal); shrinking it below the shared size fragments the visual language and hurts readability mid-jam. The honest cost of 3 grips per sub is ~140px more fold in the *related area only* (§3) — pinned instrument/licks are unaffected, and the user asked for the 3 grips knowing it takes room.
+219
View File
@@ -0,0 +1,219 @@
# Related progressions — same-style-first (D-72)
Concept doc for **L-72**. Design-only; no code here. Scope is one bounded edit to
`src/components/RelatedProgressions.jsx` (match.js untouched — see §6).
## The user's ask (2026-07-13, verbatim intent)
> "for the related progressions this is good also, but i would also want
> bridge/chorus/modifications in the same style … say i select jam roulette with
> blues, then i want for that progression other options and not necessarily go
> into other styles."
**Chosen scope:** reuse the KB's *existing* same-style progressions. No computed
modifications, no new authored content, no new KB fields. When a style is active
(rolled via Jam Roulette **or** live-detected), the panel leads with the OTHER
progressions of that same style, reframed as variations/sections to try — instead
of jumping to other styles.
The component today already computes a match, ranks every *other* KB progression
by musical proximity, and prints a flat cross-style list. This doc changes only
**how the list is partitioned, floored, ordered, and labelled** once a style is
known. When no style is known, behaviour is unchanged.
---
## 1. How the active style is known — reuse the component's own match
`rankRelatedProgressions(loop)` already calls
`matchLoopToProgression(loop, index)`, whose result is
`{ matched, id, style, rotation, progression }`. **`match.style` IS the active
style** — for both entry points:
- **Jam Roulette:** `rollJam` seeds `detectedProgression = seedableLoop(prog, key)`
(the collapsed canonical form). The L-60 collapsed-form index makes the
component re-match that loop back to the rolled progression → `match.style ==
the rolled style`, `match.id == the rolled progression's id`. That id is already
excluded from `entries` (the `prog.id === match.id` guard), so the surviving
same-style progressions are exactly "other options for the style I rolled."
- **Live detection:** the detected repeating loop is what App passes as
`loop={detectedProgression}`; the same match resolves the live style/id.
**Recommendation — use the internally-computed `match.style`; do NOT add a prop.**
Naming it explicitly: inside `rankRelatedProgressions`, after the existing
`const match = matchLoopToProgression(...)`, take
```
const activeStyle = match.matched ? match.style : null
```
Rejected: threading a `matchedStyle` prop down from App (roulette knows it via
`lastRolledStyleRef`; live detection could expose its own match). It duplicates
state that the component already derives identically from the same `loop`, and
introduces a divergence risk (App's match vs the component's match drifting).
The single source of truth is the loop → its match. Keep it in one place.
**No-match fallback.** When `match.matched === false` (the loop matches no KB
progression — an off-book jam), `activeStyle` is `null`; the panel renders exactly
today's cross-style list (flat, floor `RELATED_SCORE_FLOOR`, existing
annotations). Nothing about the current behaviour changes when no style is locked.
---
## 2. Same-style-first presentation — two sections
When `activeStyle != null`, partition the scored candidates by
`entry.style === activeStyle`:
**Primary — "Try these in {styleLabel}"** (same-style siblings).
All same-style progressions except the one being played, in scorer order (§4),
capped at `RELATED_MAX_ENTRIES` (5). The score floor is **relaxed to 0 for this
section** — a sibling of your own style is never "junk"; it is exactly the "other
options" the user asked for. Styles hold ≤7 progressions, so this shows all of
them (blues → 4 siblings).
**Secondary — "Same changes, other styles"** (cross-style), demoted, small.
Only progressions whose canonical changes are *identical* to the loop
(`sameChanges === true`), capped at **2**, floor kept. This preserves a genuinely
valuable, rare relative — "this exact turnaround also lives in jazz and gospel" —
without "going into other styles" for merely-similar material. If none qualify,
the section is omitted entirely.
**Recommendation: ship both sections (option b).** It honours "not necessarily go
into other styles" (same-style leads and dominates the panel) while not hiding an
exact-match cousin elsewhere. Dropping the secondary later is a one-line change
(don't render it) if the user wants pure same-style — noted as the toggle.
Rejected: a hard same-style-only filter that *never* shows cross-style. It throws
away the exact-match cousin (musically the most useful cross-style pointer we
have) and would also have to special-case the no-match path. Kept only as the
one-line fallback if the user insists on zero cross-style.
---
## 3. The reframe — "bridge/chorus/modifications" with NO new content
Same-style siblings must read as *sections/variations to try*, not a flat list.
We label each with a short **role phrase** derived only from data already in the
KB — comparing the sibling to the active (matched) progression. Fields used:
`mode`, `bars` (summed = the form length), `qualities` (the colour set),
`name`, `level`. No new fields.
`siblingRole(sibling, active)` → a short phrase or `null`, first rule that fires:
1. **mode differs**`"{mode} version"` — minor→`"minor version"`,
major→`"major version"`, else the mode name (`"dorian version"`, …).
2. **same mode, fewer total bars**`"shorter form"`.
3. **same mode, more total bars**`"extended form"`.
4. **same mode & length, a quality the active lacks**`"reharmonized"`.
5. **otherwise**`null` (honest: just the name + level badge, no role line).
The active progression's `mode`/`bars` come from looking the raw KB entry up by
`match.id` in `kbRegistry[activeStyle].progressions` (avoids any collapsed-
projection subtlety; the raw entry is authoritative).
### Concrete — active = blues **Standard 12-bar** (major, 12 bars)
| sibling | mode | bars | role phrase | reads as |
|---|---|---|---|---|
| Quick-change 12-bar | major | 12 | `null` | name + `foundation` (name already says "quick-change") |
| 8-bar blues | major | 8 | **shorter form** | "the compact take" |
| Minor blues | minor | 12 | **minor version** | "the minor cousin" |
| Turnaround cycle | major | 4 | **shorter form** | name already says "Turnaround cycle" |
Every phrase is honest and re-derivable from `mode`/`bars`/`qualities`. Where no
character is derivable (Quick-change: same mode, same length, same all-dom7 colour
set) we print **nothing** beyond the name and level badge — the name carries it.
The two "shorter form"s are fine: their *names* (`8-bar blues`, `Turnaround
cycle`) already distinguish them, and the scorer orders them by proximity (§4).
This is where the "bridge/chorus/modification" feel comes from: the KB already
holds the minor version, the short form, the turnaround, the quick-change — we are
just *reframing existing siblings* with a one-line role, not synthesising sections.
---
## 4. Ranking within same-style — keep the scorer order
The existing scorer still runs over every candidate. Within the same-style group
the `+40 SCORE_SAME_STYLE` term is constant, so it cancels — ordering is driven by
`same changes (+100)``shared transitions``Jaccard`` length`, i.e.
**musical proximity to the loop you're playing.** That is more useful mid-jam than
alphabetical, so:
**Recommendation: keep the scorer sort within same-style. Do NOT re-sort by
level/name.** The closest variation to what your hands are already doing surfaces
first. The only change is relaxing the floor to 0 for this section (§2) so no
sibling is silently dropped for being "only" a distant relative — the user
explicitly wants *all* the style's options.
---
## 5. Edge / empty states
- **Style with only 1 progression** (0 same-style siblings after excluding the
played one). No current style hits this (all have ≥5), but handle it: render an
honest primary line — *"You're on the only {styleLabel} loop in the songbook."*
then fall through to the cross-style secondary (kept at floor). Never pad.
- **Secondary empty** (no exact cross-style cousin) → omit the secondary section
silently; the primary stands alone.
- **No match at all** (`activeStyle == null`) → today's single flat list, unchanged.
- **Instrument-agnostic — confirmed.** `RelatedProgressions` reads only
`progressions` (`degrees`/`qualities`/`rn`/`level`/`name`/`mode`/`bars`), never
the `instruments` cells. It behaves identically under guitar / piano / bass; the
global instrument selector does not touch it.
---
## 6. L-72 change list (RelatedProgressions.jsx only)
`match.js` needs **no change**`matchLoopToProgression` already returns
`{ style, id, progression }`. Reuse it.
In `rankRelatedProgressions`:
1. After computing `match`, derive `const activeStyle = match.matched ? match.style
: null` and look up the raw active progression (`kbRegistry[activeStyle]
?.progressions.find(p => p.id === match.id)`) for its `mode` + summed `bars`.
2. Keep the existing scoring loop. Change the floor test: skip the
`score < RELATED_SCORE_FLOOR → continue` **only when** `style === activeStyle`
(same-style siblings bypass the floor); cross-style keeps the floor.
3. Add a `siblingRole(sibling, active)` helper (§3) and attach `role` to each
same-style entry; leave cross-style entries' existing `annotation` intact.
4. Partition the sorted entries into `primary` (`style === activeStyle`, cap 5)
and `secondary` (`style !== activeStyle && sameChanges`, cap 2). Return
`{ match, activeStyle, activeStyleLabel, primary, secondary }`. Keep
`entries` (= `primary.concat(secondary)`) on the return so any existing
`entries[0]` / `entries.length` reads still resolve during the transition.
When `activeStyle == null`, return today's shape (`primary = entries`,
`secondary = []`) so the render path collapses to the current flat list.
In the render:
5. Two `<section>`-internal blocks: primary headed *"Try these in
{activeStyleLabel}"*, secondary headed *"Same changes, elsewhere"* (rendered
only when non-empty). Same-style rows swap the `annotation` line for the `role`
phrase (omit the line when `role == null`). Reuse the existing `LevelBadge` /
`ChordChain` — no new tokens, no new colours (all within `bg-panel` /
`border-border` / `text-gray-*` / `text-amber`, already in use).
**Smoke pins (C-50, `scripts/smoke.mjs` §8) will shift — re-derive, coordinate
with C-70:**
- Pin (a) collapsed 12-bar in A: top stays **blues/blues-8bar, score 92**
(blues is now the active style; 8-bar is a same-style sibling; the +40 is still
in its score, order unchanged). Its **annotation label changes** from
`'shares I7→V7'` to the role `'shorter form'` — the assertion must be re-pinned.
- Pin (b) iiVI in C: top stays **jazz/jazz-251-minor, score 156** (same-style,
same changes). Its label changes from `'same changes'` to the role
`'minor version'` (mode differs) — re-pin.
- Scores and top ids are stable; only the annotation strings and the return shape
move. Add coverage for the primary/secondary split and the no-match fallback.
### Rejected alternatives (recap)
- **Computed modifications** (synthesise a bridge/chorus by transposing or
reharmonising) — rejected per the user's explicit choice to reuse existing KB
content; also risks inventing non-idiomatic changes we can't vouch for.
- **Hard same-style-only, no cross-style ever** — rejected: loses the exact-match
cousin in another style and complicates the no-match path. Retained only as the
one-line "drop the secondary" toggle if the user later wants zero cross-style.
- **An explicit `matchedStyle` prop from App** — rejected as redundant (§1): the
component derives the same style from the same loop; a prop only adds a
divergence surface.
+170
View File
@@ -0,0 +1,170 @@
# "Try this" — chord-substitution nudge (task D-73)
**Sprint:** `sprint-dashboard-polish` · **Owner:** Muse · **Impl tasks:** L-73 (engine, `theory.js`) + L-74 (UI, new `TryThis.jsx`)
**User ask (2026-07-13, verbatim):** *"imagine we play a simple Am C F then i'd like to have an alternative to that F that would be in the similar style … potentially based on the circle of fifths? i'd like an option that says: 'try this' … i want musicians to learn how they can make the jam more interesting."* Plus the guard-rail: *"we dont have to create something too difficult."*
So this is a **small, curated, learnable nudge** — not a reharmonisation engine. For the chord under the playhead, in the detected key, show 34 alternative chords, each with one plain sentence that *teaches why it works*. Tap a suggestion → the existing `ChordDetailModal` to study it.
> **Not** the existing `getChordSubstitutions` (education.js). That returns **context-free, same-root colour swaps** (`maj → maj7, add9, maj6…`) and never looks at the key. The new engine is **key-aware** and, crucially, **changes the root** (relative sub, secondary dominant) with a *why* framed against the live key. They coexist; the modal keeps its colour-swap grid, the dashboard gets the new nudge.
---
## 1. The reading model — which key/mode the engine trusts
**Recommendation: take the app's `effectiveKey` (`lockedKey ?? keyInfo`) as the single reading. Do not compute both readings at once.**
- `effectiveKey` is `{ root, mode, confidence }`. The **mode disambiguates the i-vs-vi ambiguity** that makes `Am C F` read two ways: if the app committed **A minor**, `F` is `♭VI`; if **C major**, `F` is `IV`. The engine frames the *why* against whichever one is live, and gates the moves that need a specific reading (borrowed `iv` needs a major reading — see Rule B).
- The user can already flip the mode in the key dropdown (the app's intended workflow, per project memory — e.g. A minor → A Dorian). When they do, the *why* copy and the applicable moves change with it. That is the honest way to "see the other framing" — one reading on screen at a time, driven by the user's own mode choice.
- **Edge — no key / atonal / low confidence:** `suggestSubstitutions` returns `[]` when `!keyInfo?.root`. `TryThis` then renders a quiet idle line ("Lock a key to see substitutions") — never a fabricated suggestion. This mirrors `RelatedProgressions`/`CircleOfFifths` idle states.
The worked examples in §4 show **both** readings only so the gate can verify the arithmetic under each; at runtime exactly one is shown.
---
## 2. The curated set — 4 categories, ranked softest → boldest
All rules operate on `{ rootPc, quality }` (a pitch class 011 + a `CHORD_TYPES` key) — the same shape the KB/JamGuide stations already use — and read `keyInfo {root, mode}`. `keyRootPc = noteIndex(keyInfo.root)` (theory.js's own in-module note-name→pc helper, line 133 — **not** match.js's `chordRootPC`, which would make theory.js import from a module that imports it back = circular). Candidates are returned as `{ rootPc, quality, label, why, category }` where `label = NOTES[rootPc] + CHORD_TYPES[quality].suffix`. **Cap the output at 4**, in the order below (softest first, so the glance reads top-down by boldness).
Notation: pc arithmetic is mod 12. `NOTES = [C,C#,D,D#,E,F,F#,G,G#,A,A#,B]` (C=0 … B=11).
### A. Relative / diatonic-third sub — *the softest, most universal*
Swap a chord for the diatonic chord a third away that **shares two of three tones**.
- **major-family chord** (`maj, maj7, maj6, add9`): candidate = `{ (rootPc + 9) % 12, 'min' }` — the **relative minor** (a minor 3rd below). *Shared tones:* the original root and 3rd become the relative's 3rd and 5th.
- **minor-family chord** (`min, min7, min6`): candidate = `{ (rootPc + 3) % 12, 'maj' }` — the **relative major** (a minor 3rd above).
- **Gate:** emit only if the candidate is **diatonic in `keyInfo`** (`getChordsInKey(root,mode)` contains it). This keeps the swap "safe/soft" and never forces an out-of-key relative. (Non-diatonic relatives are out of MVP scope.)
- **Circle tie-in: yes** — the relative minor/major is the circle's *inner ring* (see `CircleOfFifths.jsx`). The *why* may say so.
- **Why template:** `"{cand} is {orig}'s relative {minor|major} — shares {t1} & {t2}. In this key it's the {rn(cand)}: {softer|brighter} pull, same family."`
### B. Borrowed minor colour — *the "blue"/"Creep" move* (conditional)
Major `IV → iv` (same root, major → minor) — lowers the 6th of the key to the ♭6.
- **Gate (strict, honest):** emit **only** when `keyInfo.mode` is **major-ish** AND the chord is the **IV** (`rootPc === (keyRootPc + 5) % 12`) AND quality is major-family. Under a **minor reading it is suppressed** (in A minor, `F` is a diatonic major `♭VI`; `Fm` would be a chromatic `♭vi` with no honest function — we do not fake it).
- Candidate = `{ rootPc, 'min' }`.
- **Circle tie-in: no** — this is a modal borrowing, not a circle step. The *why* must not claim the circle.
- **Why template:** `"Borrow {cand} (the iv) from the parallel minor — {n6}→{nb6} adds that wistful pull home. The 'Creep' move."` where `nb6 = noteName((keyRootPc + 8) % 12, /*preferFlat*/true)` (the ♭6). **Spell it flat** — this is a flatward modal borrow (A→A♭), never the sharp `NOTES[8]='G#'`. (The *ascending* leading tone in Rule D stays sharp — see §3.)
### C. Extension / colour — *same function, more colour*
Keep the root and function; add one diatonically-honest colour tone.
- Pick the extension whose **added tone is diatonic** in `keyInfo` (prefer, in order): major-family → `maj7` if `(rootPc+11)` diatonic, else `add9` if `(rootPc+2)` diatonic, else `maj6`; minor-family → `min7` if `(rootPc+10)` diatonic, else `add9`; `dom7``sus4` (the 9sus-ish suspension). Same root, so `label` = `NOTES[rootPc] + suffix`.
- **Gate:** the chosen added tone must be in `getScale(root,mode)`; if none qualifies, omit category C rather than add a clashing tone.
- **Circle tie-in: no** — vertical colour, not a circle step.
- **Why template:** `"Add the {intervalName} ({addedNote}) — same {rn}, lusher. {addedNote} is the key's own {degreeWord}, so it stays in the family."`
### D. Secondary dominant of the next chord — *the circle move*, boldest (conditional)
Approach the **next loop chord** by its own `V7` — the circle-of-fifths, dominant-direction pull.
- **Gate:** requires `opts.nextRootPc` (the next station's root pc). Candidate = `{ (nextRootPc + 7) % 12, 'dom7' }`. Emit only when a loop/next chord is known and the candidate root ≠ current root.
- **Circle tie-in: yes** — the candidate root is **one wedge clockwise from the next chord** on the circle (its dominant). Its 3rd is the **leading tone** into the next root.
- **Why template:** `"Swap for {cand}, the V7 of {next} — its 3rd ({leadingTone}) leans a half-step into {next}, pulling the loop around. One step clockwise on the circle."`
> **Honest circle summary:** A and D **are** circle relationships (inner ring; dominant step) — name the circle in their copy. B and C are **not** — never claim the circle for them. We do **not** require the D-61 circle widget on the dashboard; the *why* copy carries the lesson.
---
## 3. Worked examples — `Am C F`, both readings (gate: recompute me)
Loop wraps `Am → C → F → Am`. Target = **F** = `{ rootPc: 5, quality: 'maj' }`, tones `{F=5, A=9, C=0}`. Next chord after F = **Am** (`nextRootPc = 9`).
### Reading (i) — **A minor** (`i · III · ♭VI`) → 3 subs (borrowed iv suppressed)
`A-minor scale = {9,11,0,2,4,5,7}` = A B C D E F G. `getChordsInKey(A,minor) = [Am, B°, C, Dm, Em, F, G]`.
| # | Cat | Candidate (pc) | label | Diatonic check | WHY copy |
|---|-----|----------------|-------|----------------|----------|
| A | relative | (5+9)=**2**, min | **Dm** | Dm ∈ A-min = `iv` ✓ | "Dm is F's relative minor — shares **F & A**. In A minor it's the **iv**: a darker, more grounded step than the bright ♭VI. (Circle: F's inner-ring relative.)" |
| B | borrowed | — | — | mode = minor → **suppressed** | *(not shown — F is ♭VI here, not IV; Fm would be chromatic. Honest omission.)* |
| C | extension | 5, add 11→**E(4)** | **Fmaj7** | E ∈ A-min (the 5th) ✓ | "Add the major 7th (**E**) — ♭VI becomes Fmaj7, dreamy and floating. E is A minor's own 5th, so it stays in the family." |
| D | 2nd-dom | (9+7)=**4**, dom7 | **E7** | leads to Am | "Swap for **E7**, the V7 of Am — its 3rd (**G♯**) leans a half-step into A, pulling the loop back around. One step clockwise on the circle." |
*Arithmetic:* Dm={2,5,9}∩F{5,9,0}={5,9}=F,A ✓. Fmaj7={5,9,0,4}, all ∈ A-min ✓. E7={4,8,11,2}; G♯=8→A=9 ✓; E is a fifth above A (9+7=4) ✓.
### Reading (ii) — **C major** (`vi · I · IV`) → 4 subs (cap)
`C-major scale = {0,2,4,5,7,9,11}` = C D E F G A B. `getChordsInKey(C,major) = [C, Dm, Em, F, G, Am, B°]`.
| # | Cat | Candidate (pc) | label | Diatonic check | WHY copy |
|---|-----|----------------|-------|----------------|----------|
| A | relative | (5+9)=**2**, min | **Dm** | Dm ∈ C-maj = `ii` ✓ | "Dm is F's relative minor — shares **F & A**. In C it's the **ii**: trades IV's brightness for a softer, more forward pull. (Circle: F's inner-ring relative.)" |
| B | borrowed | 5, **min** | **Fm** | mode major **and** F = IV (0+5=5) ✓ | "Borrow **Fm** (the iv) from C minor — lowering A to **A♭** adds that wistful 'Creep' pull home. The classic blue move." |
| C | extension | 5, add 11→**E(4)** | **Fmaj7** | E ∈ C-maj (the 3rd) ✓ | "Add the major 7th (**E**) — same IV, lusher and static. E is C's own 3rd (the mediant), so it glues the chord to the key." |
| D | 2nd-dom | (9+7)=**4**, dom7 | **E7** | leads to Am | "Swap for **E7**, the V7 of Am — its 3rd (**G♯**) leans into A, pulling the loop around. One step clockwise on the circle." |
*Arithmetic:* Fm={5,8,0}; A(9)→A♭(8) ✓; A♭=8=(0+8)=♭6 of C ✓. Everything else as above.
**Payoff:** the *same* candidate chord (Dm, Fmaj7, E7) is right under both readings — only its role-name and *why* change with the mode. Borrowed `Fm` appears **only** under the major reading. That is the honesty the feature promises.
**Bonus — the same rules over the whole loop** (feeds the smoke truth-table): current **Am**→next C ⇒ D = **G7** (V7/C, B→C); current **C**→next F ⇒ D = **C7** (V7/F, E→F — the classic bluesy `I7→IV`). Both musically gold, both from the one rule.
---
## 4. Which chord gets suggestions — the playhead chord
**Decision: one `TryThis` card that follows the playhead — subs for the *currently sounding* chord, updated as the loop turns.**
- Rejected: one static sub for the whole loop (misses the point — the user asked specifically about *F*), and a per-station sub grid across the rail (too dense, collides with the rail — see §6).
- Target selection: `currentChord` when present → fall back to the committed loop's active/first station when silent → else idle. `opts.nextRootPc` = the following loop station's root (so Rule D can fire); when there is no loop, D is simply omitted.
- Keep it tiny: **≤4 chips, one row.** It is a nudge, not a panel.
- *(Optional nicety, not required):* the UI may drop a candidate that is already a loop chord (e.g. relative of Am = C, which is already in `Am C F`) to avoid a redundant suggestion. Engine stays pure; dedup lives in `TryThis`.
---
## 5. The UI surface — new `TryThis.jsx`, left column
A compact card, visually a sibling of `RelatedProgressions`/`CircleOfFifths` (same micro-header + chip language):
```
Try this instead of F · in A minor ← text-[10px] uppercase tracking-widest text-gray-500
[ Dm ] relative minor — softer, same family ← chip + one-line why, per row
[ Fmaj7 ] add the maj7 (E) — dreamy, in-key
[ E7 ] V7 of Am — pulls the loop around ↻
```
- **Chip = tappable** → `onChordClick(label)` = App's `setSelectedChord``ChordDetailModal` (the established tap target; reuse verbatim). Each chip is a `<button>`, keyboard-reachable, `focus-visible:ring-2 focus-visible:ring-accent`.
- **Layout:** chip on the left (bold, `text-gray-100`), *why* to the right (`text-[11px] text-gray-400`), category label optional as a faint tag. `Category D` gets a small `↻` glyph hinting the circle (no widget dependency).
- **Tokens only** (`tailwind.config.js`): `bg-panel`, `border-border`, `text-accent`, `text-gray-100/400/500`, `hover:border-accent/50 hover:text-accent`. **No new colour** — nothing to flag to Maestro. Accent-on-panel meets AA (same usage cleared in D-61).
- **Mount — App.jsx only (file-disjoint from the rail/licks/related chains):** compose `TryThis` **above** `RelatedProgressions` inside App's existing `relatedSlot` prop:
```jsx
relatedSlot={
<div className="flex flex-col gap-3">
<TryThis
chord={currentChord} {/* App parses to {rootPc,quality} */}
nextRootPc={/* next station root of the committed loop, or undefined */}
keyInfo={effectiveKey}
onChordClick={setSelectedChord}
/>
<RelatedProgressions loop={detectedProgression} keyInfo={effectiveKey} onChordClick={setSelectedChord} />
</div>
}
```
This edits **App.jsx only** (mount) + the new file — it does **not** touch `JamGuide.jsx` (locked by L-71), `GlanceRail/VoicingBrowser/index.css` (L-70), or `RelatedProgressions.jsx` (L-72). The left column already reflows to one-per-row narrow (JamGuide `order-4` wrapper); `TryThis` inherits that. Glanceable in the ≤4-chip footprint at 1280×900 and stacks cleanly narrow.
---
## 6. Circle-of-fifths tie-in — honest
- **Rule A (relative)** and **Rule D (secondary dominant)** ARE circle relationships — the inner ring and the clockwise/dominant step respectively (both visible in `CircleOfFifths.jsx`). Their *why* copy names the circle.
- **Rule B (borrowed iv)** and **Rule C (extension)** are **not** circle-adjacent — modal/vertical colour. Their copy must **never** invoke the circle.
- We **do not** require the D-61 circle widget on the dashboard (it lives in the Knowledge Center). The lesson travels entirely in the one-line *why*. Optional future polish: a tiny `` affordance on circle-derived chips.
---
## 7. Impl scopes (bounded)
### L-73 — engine (`src/lib/theory.js`, additive; `scripts/smoke.mjs`)
- Add `export function suggestSubstitutions({ rootPc, quality }, keyInfo, opts = {})` → `[{ rootPc, quality, label, why, category }]`, categories in order `relative, borrowed, extension, secondary_dominant`, capped at 4, `[]` when `!keyInfo?.root`. Reuse `NOTES`, `NOTES_FLAT`, `noteName`, `noteIndex`, `CHORD_TYPES`, `getChordsInKey`, `getScale`, `getChordTones`, `intervalName`, `toRomanNumeral` — all **in-module** to theory.js (do **not** import `chordRootPC` from match.js — circular). **Never re-derive** intervals or diatonic sets. `opts.nextRootPc` gates Rule D.
- **Smoke truth-table** in `smoke.mjs` (sabotage-proven, like the `resolveDegree` guard): pin the §3 tables — `F/maj` in **A minor** → `[Dm, Fmaj7, E7]` (no Fm); in **C major** → `[Dm, Fm, Fmaj7, E7]`; plus `Am/min`→next C ⇒ D=`G7`, `C/maj`→next F ⇒ D=`C7`; and a no-key case → `[]`. Flip one rule constant → smoke must go red.
- **⚠ Sequencing flag for Maestro:** L-73 and **L-72 both lock `scripts/smoke.mjs`** — they cannot be claimed concurrently. Serialize them (L-73 appends a new smoke section to minimise merge friction). `theory.js` is the shared Professor+Luthier file → single-task lock + Critic + non-owning-domain review, per PROTOCOL §3.
### L-74 — UI (`src/components/TryThis.jsx` new; `src/App.jsx` mount)
- Pure/presentational component consuming `suggestSubstitutions`; props `{ chord, nextRootPc?, keyInfo, onChordClick }`; renders header + ≤4 chip/why rows; tap → `onChordClick`. Idle line when the engine returns `[]`.
- Mount per §5 (App composes it into `relatedSlot` above `RelatedProgressions`). **Files disjoint** from L-70/L-71/L-72; App.jsx is unlocked by all three. Audio contract untouched (mount/UI-state only — the App.jsx grep gate applies).
---
## 8. Rejected alternatives (≥2)
1. **Full reharmonisation engine** (chord-scale subs, iiV insertion, Coltrane changes, tritone-on-everything). **Rejected** per the user's explicit *"we dont have to create something too difficult"* + "not a reharm engine." Un-glanceable mid-jam and un-learnable. The curated 4-move set is the whole point.
2. **Blanket tritone sub** (`root+6` dom7 on every chord). **Rejected as a general rule:** the tritone sub is only functionally honest on a *dominant resolving down a fifth*; on a static major IV like `F` it yields `B7` — jarring, no diatonic footing, no *why* that teaches. The **secondary-dominant** move (Rule D) captures the same circle-of-fifths energy but is functionally grounded in the *actual next chord*. (Tritone could return later as a dom7-only opt-in.)
3. **Per-station subs plastered across the voicings rail.** **Rejected:** clutters the glance-critical rail (owned by L-70), 34 chips × N stations is too dense, and it competes with the voicings the user is reading to *play*. One playhead-following card is the nudge.
4. **Show both key readings at once.** **Rejected:** doubles the surface, contradicts "keep it small," and the app already commits to one `effectiveKey` (the mode disambiguates). The user flips the mode dropdown to see the other framing — one reading on screen at a time.
</content>
</invoke>
+21 -15
View File
@@ -2,6 +2,10 @@
The queue for the `/kb-expand` loop. One cell per session, top-to-bottom. Protocol and schema: [`docs/kb-plan.md`](kb-plan.md). Statuses: `todo``in-progress``done (YYYY-MM-DD, coverage)`.
> Ground truth (verified 2026-07-10): `node scripts/validate-kb.mjs` → ✓ KB valid — **10 style(s), 56 progressions, 164 plays, 23 licks**. Registered cells in `src/data/kb/index.js`: all 10 guitar; piano for jazz, blues, gospel, rnb.
>
> **Next cells:** piano column continues (pop, rock, funk, country, reggae, bossa remain) · **bass column is now active** — blues bass is next (ledger task P-41, pending the C-41 bass play schema), order blues → jazz → funk per plan.
## Phase 0 — Foundation (must be first)
| # | Cell | Status |
@@ -12,27 +16,29 @@ The queue for the `/kb-expand` loop. One cell per session, top-to-bottom. Protoc
| # | Style | Status |
|---|---|---|
| 1 | Jazz (part of bootstrap) | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 1 | Jazz (part of bootstrap) | done (2026-06-12, 5 progressions × 2 plays; +2 intermediate progressions 2026-07-08 → 7 × 2, validator ✓) |
| 2 | Blues | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 3 | Rock | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 4 | Bossa Nova | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 5 | Funk | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 6 | Reggae | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 7 | Country / Folk | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 8 | R&B / Neo-soul | done (2026-06-12, 5 progressions × 2 plays, validator ✓) |
| 9 | Gospel | todo |
| 10 | Pop | todo |
| 8 | R&B / Neo-soul | done (2026-06-12, 5 progressions × 2 plays; +2 intermediate progressions 2026-07-08 → 7 × 2, validator ✓) |
| 9 | Gospel | done (2026-06-15, 5 progressions × 2 plays; +2 intermediate progressions 2026-07-08 → 7 × 2, validator ✓) |
| 10 | Pop | done (2026-06-15, 5 progressions × 2 plays, validator ✓) |
> Guitar licks (not tracked as cells above; C-20 lick schema, 2026-07-08): 23 licks live in 6 guitar cells — blues 4, jazz 4, funk 4 (pack #1, 2026-07-08) + rock 4, country 4, reggae 3 (pack #2, 2026-07-08/09).
## Piano
| # | Style | Status |
|---|---|---|
| 11 | Jazz | todo |
| 12 | Blues | todo |
| 11 | Jazz | done (2026-07-08, 7 progressions × 2 plays, validator ✓) |
| 12 | Blues | done (2026-07-10, 5 progressions × 2 plays, validator ✓) |
| 13 | Bossa Nova | todo |
| 14 | Gospel | todo |
| 15 | R&B / Neo-soul | todo |
| 16 | Pop | todo |
| 14 | Gospel | done (2026-07-09, 7 progressions × 2 plays, validator ✓) |
| 15 | R&B / Neo-soul | done (2026-07-10, 7 progressions × 2 plays, validator ✓) |
| 16 | Pop | todo**next piano cell** |
| 17 | Rock | todo |
| 18 | Funk | todo |
| 19 | Country / Folk | todo |
@@ -42,7 +48,7 @@ The queue for the `/kb-expand` loop. One cell per session, top-to-bottom. Protoc
| # | Style | Status |
|---|---|---|
| 21 | Blues | todo |
| 21 | Blues | todo**next bass cell** (ledger task P-41; blocked on the C-41 bass play schema) |
| 22 | Jazz | todo |
| 23 | Funk | todo |
| 24 | Reggae | todo |
@@ -57,9 +63,9 @@ The queue for the `/kb-expand` loop. One cell per session, top-to-bottom. Protoc
| Milestone | Depends on | Status |
|---|---|---|
| Jam Guide MVP (panel, matching, `ChordDiagram.jsx`, live sync) | cell 0 | todo |
| `MiniPiano.jsx` + recipe resolver | cell 11 | todo |
| Bass pattern renderer | cell 21 | todo |
| Improv layer (licks/tabs display) | a few guitar cells | todo |
| Jam Guide MVP (panel, matching, `ChordDiagram.jsx`, live sync) | cell 0 | done (2026-06-15, sprint-jam-guide, PR #2) |
| `MiniPiano.jsx` + recipe resolver | cell 11 | done (2026-06-16 resolver + MiniPiano voicing prop; authored packs render at stations 2026-07-09) |
| Bass pattern renderer | cell 21 | todo — activated in sprint-integrated-glance (ledger task L-42, after C-41 + P-41) |
| Improv layer (licks/tabs display) | a few guitar cells | done (2026-07-08, `LickCard.jsx` + licks section; 23 licks across 6 styles) |
> Notes for sessions: piano style order front-loads the styles where piano voicings differ most (jazz/gospel/neo-soul); bass order front-loads line-driven styles (blues/jazz/funk). Adjust freely — order is a default, not a rule.
> Notes for sessions: piano style order front-loaded the styles where piano voicings differ most (jazz/gospel/neo-soul — all shipped, plus blues); bass order front-loads line-driven styles (blues/jazz/funk). Adjust freely — order is a default, not a rule. Bass cells need the C-41 play schema in `SCHEMA.md` before authoring.
+1 -1
View File
@@ -34,7 +34,7 @@ function createWindow() {
})
if (isDev) {
win.loadURL('http://localhost:5173')
win.loadURL('http://127.0.0.1:5173')
win.webContents.openDevTools()
} else {
win.loadFile(path.join(__dirname, '../dist/index.html'))
+1 -1
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src 'self' http://localhost:5173 ws://localhost:5173; style-src 'self' 'unsafe-inline'; img-src 'self' data:;">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-eval'; connect-src 'self' http://localhost:5173 ws://localhost:5173 http://127.0.0.1:5173 ws://127.0.0.1:5173; style-src 'self' 'unsafe-inline'; img-src 'self' data:;">
<title>WhatTheFlat ♭? - JamBuddy</title>
</head>
<body>
+1 -1
View File
@@ -9,7 +9,7 @@
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"electron:dev": "concurrently -k \"vite\" \"wait-on http://localhost:5173 && electron .\"",
"electron:dev": "concurrently -k \"vite\" \"wait-on http://127.0.0.1:5173 && electron .\"",
"electron:build": "vite build && electron-builder",
"electron:build:win": "vite build && electron-builder --win --publish never",
"electron:build:mac": "vite build && electron-builder --mac --publish never",
+185
View File
@@ -0,0 +1,185 @@
// Loop-detection truth fixtures (task C-30) — the contract L-30 must satisfy.
//
// Each fixture is a realistic `chordHistory` as App.jsx commits it (plain chord
// name strings from matchChordFromChroma — "C", "Am", "G7", "Cmaj7"…; the commit
// layer at App.jsx:363-365 suppresses ADJACENT duplicates, so histories here are
// adjacent-dup-free except the one fixture that deliberately tests dups) plus the
// loop a musician would say they are playing (`expect`, or null for "no loop").
//
// Consumed by scripts/smoke.mjs:
// · fixture without expectedFail that fails → smoke exits non-zero (regression)
// · fixture with expectedFail that fails → annotated expected-fail (printed)
// · fixture with expectedFail that PASSES → smoke FAILS: stale marker, flip it
// L-30's definition of done = every expectedFail marker removed, all green.
//
// ─── FAILURE MAP OF THE PRE-L-30 ALGORITHM (historical — all fixed by L-30) ──
// (theory.js `detectRepeatingProgression` as of C-30, every fixture RUN against
// it 2026-07-10; L-30 redesigned the function and removed every expectedFail
// marker — all 17 fixtures now pass as plain regression guards)
//
// The pre-L-30 matcher: window = last 32 commits; candidate lengths 26; EXACT
// contiguous occurrence counting (scan advances by len on match, by 1 on miss);
// requires reps ≥ 2; score = reps × len²; returns the canonical (lexicographically
// smallest) rotation of the best candidate.
//
// 1. len²-weighting artifact — self-overlaps of a short vamp beat the vamp:
// a 2-chord vamp ×4 reports the 3-chord [Am,G,Am] (2 reps × 3² = 18 beats the
// true pair's 4 × 2² = 16); a SUSTAINED 2-chord vamp (full 32 window) reports
// the bogus 5-chord [Am,Am,G,Am,G] (fixtures: vamp-2x4, vamp-2-sustained).
// 2. One SUBSTITUTED misdetection inside one rep of a 3-loop flips the winner to
// a wrong 4-pattern: [F,C,Am,F] straddling the noise scores 2 × 4² = 32 and
// beats the real [C,Am,F] at 3 × 3² = 27 (fixture: spurious-substitution).
// NOTE: one INSERTED extra chord is survivable today — the miss-by-1 scan
// realigns after it (fixture spurious-insert-once stays green).
// 3. Insertions in 2 of 4 reps → the same wrong-4-pattern failure (spurious-2of4).
// 4. Consecutive duplicate commits of one chord create a wrong 4-pattern
// [C,Am,F,C] (2 × 16 > 3 × 9) instead of collapsing to the 3-loop
// (fixture: dup-commit). Unreachable from TODAY'S commit layer (App.jsx
// dedupes adjacent commits) — the fixture makes the detector safe standalone,
// per L-30's "collapse consecutive duplicates" requirement.
// 5. Loop lengths 78 are structurally impossible (len caps at 6): a 7- or
// 8-chord loop ×2 returns a truncated 6-chord slice of itself, not the loop
// (fixtures: seven-x2, eight-x2). This is the likely reading of the user's
// "5 and then 2 others": a 5+2 = 7-chord FORM can never be detected.
// 6. No recency weighting: after a section change (loop A ×3 → loop B ×3) the
// OLD 4-chord loop A still outscores the current 3-chord loop B
// (3 × 4² = 48 > 3 × 3² = 27), so the display is stuck on the previous
// section (fixture: section-change).
//
// What already WORKS at the pure-function level (regression guards — L-30 must
// keep these green): clean 2×3 / 3×2 / 3×3 / 4×3 / 6×2 loops; one inserted
// spurious chord; a 5-chord loop + 2-chord tag/turnaround, both with and without
// the loop resuming (the occurrence scan skips foreign chords). So if the user
// sees the 5+tag case fail live, the loss is in the App.jsx commit layer
// (miss-4-then-clear / 2-consecutive-identical vote) — that is L-31's territory,
// not this function's.
// ─────────────────────────────────────────────────────────────────────────────
/**
* Rotation-minimal normalization — a LOCAL REPLICA of theory.js's private
* `canonicalize` (it is not exported, and theory.js is locked to L-30, so we
* must not touch it to export it). Same semantics byte-for-byte: pick the
* lexicographically smallest rotation via '\0'-joined comparison, so [C,Am,F],
* [Am,F,C] and [F,C,Am] all compare equal as loops.
*/
export function canonicalLoop(pattern) {
let best = pattern
for (let i = 1; i < pattern.length; i++) {
const rot = [...pattern.slice(i), ...pattern.slice(0, i)]
if (rot.join('\0') < best.join('\0')) best = rot
}
return best
}
// repeat a loop n times into one flat history
const reps = (loop, n) => Array.from({ length: n }, () => loop).flat()
export const LOOP_FIXTURES = [
// ── Regression guards: what works today MUST keep working ──────────────────
{
id: 'clean-2x3',
description: 'clean 2-chord vamp played 3× — the minimal detectable loop',
history: reps(['Am', 'G'], 3),
expect: ['Am', 'G'],
},
{
id: 'clean-3x2',
description: 'clean 3-chord loop played exactly 2× (6 commits, the minimum history)',
history: reps(['C', 'Am', 'F'], 2),
expect: ['C', 'Am', 'F'],
},
{
id: 'clean-3x3',
description: 'clean 3-chord loop played 3× — the plain "3 chords return" case',
history: reps(['C', 'Am', 'F'], 3),
expect: ['C', 'Am', 'F'],
},
{
id: 'clean-4x3',
description: 'clean 4-chord axis loop played 3×',
history: reps(['C', 'G', 'Am', 'F'], 3),
expect: ['C', 'G', 'Am', 'F'],
},
{
id: 'clean-6x2',
description: 'clean 6-chord loop played 2× — the top of the current length range',
history: reps(['C', 'Am', 'Dm', 'G', 'Em', 'F'], 2),
expect: ['C', 'Am', 'Dm', 'G', 'Em', 'F'],
},
{
id: 'spurious-insert-once',
description: '3-chord loop with ONE spurious chord INSERTED mid-rep (C Am F | C Am E7 F | C Am F) — the scan realigns after an insertion',
history: ['C', 'Am', 'F', 'C', 'Am', 'E7', 'F', 'C', 'Am', 'F'],
expect: ['C', 'Am', 'F'],
},
{
id: 'five-plus-tag-resumes',
description: '5-chord loop ×2, a 2-chord turnaround tag (Dm E7), then the loop resumes — loop must survive the tag',
history: [...reps(['Am', 'F', 'C', 'G', 'Em'], 2), 'Dm', 'E7', 'Am', 'F', 'C', 'G', 'Em'],
expect: ['Am', 'F', 'C', 'G', 'Em'],
},
{
id: 'five-plus-tag-at-end',
description: '5-chord loop ×2 then 2 foreign chords with the history ending there — the just-played loop must still be reported',
history: [...reps(['Am', 'F', 'C', 'G', 'Em'], 2), 'Dm', 'E7'],
expect: ['Am', 'F', 'C', 'G', 'Em'],
},
{
id: 'chromatic-null',
description: 'non-repeating chromatic walk — no loop exists, must report null',
history: ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G'],
expect: null,
},
// ── Failure modes of the pre-L-30 algorithm — fixed by L-30 ────────────────
{
id: 'vamp-2x4',
description: 'clean 2-chord vamp played 4× — must still report the pair, not a self-overlap',
history: reps(['Am', 'G'], 4),
expect: ['Am', 'G'],
},
{
id: 'vamp-2-sustained',
description: 'sustained 2-chord vamp filling the whole window (×16) — the everyday two-chord jam',
history: reps(['Am', 'G'], 16),
expect: ['Am', 'G'],
},
{
id: 'spurious-substitution',
description: '3-chord loop ×4 with ONE substituted misdetection (Am read as E7 in the third rep) — must still report the 3-loop',
history: ['C', 'Am', 'F', 'C', 'Am', 'F', 'C', 'E7', 'F', 'C', 'Am', 'F'],
expect: ['C', 'Am', 'F'],
},
{
id: 'spurious-2of4',
description: '3-chord loop ×4 with an inserted misdetection in two different reps (E7, then Dm7) — realistic sustained noise',
history: ['C', 'Am', 'F', 'C', 'Am', 'E7', 'F', 'C', 'Am', 'F', 'C', 'Dm7', 'Am', 'F'],
expect: ['C', 'Am', 'F'],
},
{
id: 'dup-commit',
description: 'consecutive duplicate commit of the same chord inside an otherwise clean 3-loop (C Am F C C Am F …) — dups must collapse',
history: ['C', 'Am', 'F', 'C', 'C', 'Am', 'F', 'C', 'Am', 'F'],
expect: ['C', 'Am', 'F'],
},
{
id: 'seven-x2',
description: '7-chord loop played 2× — beyond the pre-L-30 length-6 cap',
history: reps(['Em', 'G', 'D', 'A', 'Em', 'C', 'B7'], 2),
expect: ['Em', 'G', 'D', 'A', 'Em', 'C', 'B7'],
},
{
id: 'eight-x2',
description: '8-chord loop (extended andalusian form) played 2× — beyond the pre-L-30 cap',
history: reps(['Am', 'G', 'F', 'E7', 'Am', 'C', 'Dm', 'E7'], 2),
expect: ['Am', 'G', 'F', 'E7', 'Am', 'C', 'Dm', 'E7'],
},
{
id: 'section-change',
description: 'section change: 4-chord loop A ×3, then 3-chord loop B ×3 — must report B, the loop being played NOW',
history: [...reps(['C', 'G', 'Am', 'F'], 3), ...reps(['Dm7', 'G7', 'Cmaj7'], 3)],
expect: ['Dm7', 'G7', 'Cmaj7'],
},
]
export default LOOP_FIXTURES
+1348 -2
View File
File diff suppressed because it is too large Load Diff
+368 -21
View File
@@ -1,5 +1,13 @@
// KB quality gate — validates src/data/kb/ against the contract in src/data/kb/SCHEMA.md.
// Run: node scripts/validate-kb.mjs (exit 1 on any error)
//
// Lib mode: scripts/smoke.mjs imports this file with KB_VALIDATE_AS_LIB=1 set to
// reuse the exported pure checks (checkLick, checkPianoRecipe, checkBassPlay,
// checkPianoLick, LEVELS, LICK_TECHNIQUES, PIANO_LICK_TECHNIQUES,
// PIANO_LICK_APPROACHES, PIANO_LICK_MAX_OFFSET, MAX_HAND_SPAN, MIN_PLAYS_BASS,
// BASS_APPROACHES, BASS_MAX_OFFSET) against in-memory fixtures — same logic,
// no copy. When the env var is absent the script runs the full KB validation
// as before.
import { readdirSync, existsSync } from 'node:fs'
import { fileURLToPath, pathToFileURL } from 'node:url'
import { dirname, join } from 'node:path'
@@ -11,11 +19,23 @@ const KB = join(ROOT, 'src', 'data', 'kb')
const MODES = ['major', 'minor', 'dorian', 'phrygian', 'lydian', 'mixolydian']
const OPEN_PC = [4, 9, 2, 7, 11, 4] // EADGBe low-E first
const PERFECT_FIFTH = 7
const BASS_TOKENS = ['R', 'b3', '3', '5', '6', 'b7', '7', '9', 'O', 'chrom>', 'chrom<', '5>', 'x', '-']
const MIN_PROGRESSIONS = 4
const MIN_PLAYS = 2
// Bass floor is 1, not 2 (SCHEMA.md "Bass play"): the band wants one bassline
// at a time, and rule 4's "idiomatically different" bar invites filler at 2.
export const MIN_PLAYS_BASS = 1
const MAX_SPAN = 4
// Optional progression/lick difficulty tags (SCHEMA.md — absent = 'foundation').
export const LEVELS = ['foundation', 'intermediate']
// Fixed technique vocabulary for licks — both the techniques[] summary and each
// tab note's optional technique must come from this list (SCHEMA.md).
export const LICK_TECHNIQUES = [
'hammer-on', 'pull-off', 'slide', 'bend',
'double-stop', 'ghost-note', 'chromatic-approach', 'vibrato',
]
const LICK_MAX_FRET = 15
const errors = []
const err = (where, msg) => errors.push(`${where}: ${msg}`)
@@ -80,35 +100,309 @@ function checkGuitarShape(where, chordStep, quality) {
if (!sounded.has(pc)) return err(where, `defining tone pc ${pc} of ${quality} missing from shape`)
}
function checkPianoRecipe(where, chordStep, quality) {
// Piano hand-span rule (SCHEMA.md rule 3: "one hand per recipe stays within a
// 10th"). Enforced as ≤ 15 semitones — a minor 10th, the widest reading of
// "a 10th" — so the hand-verified 14-semitone ø11 rootless voicing in
// jazz/piano.js (P-22) stays legal while anything wider fails. Task C-22.
export const MAX_HAND_SPAN = 15
// Resolve one hand's degree list to stacked absolute semitone offsets per the
// documented convention (src/data/kb/jazz/piano.js header, ~line 14): order
// inside a hand = voicing order low→high, each note placed in the nearest
// position strictly above the previous (a repeated pitch class = octave up).
// Returns null if any degree is unresolvable (reported separately by caller).
function stackHand(degs, quality) {
const notes = []
for (const d of degs) {
const pc = resolveDegree(d, quality)
if (pc === null) return null
if (!notes.length) { notes.push(pc); continue }
const prev = notes[notes.length - 1]
const step = (pc - (prev % 12) + 12) % 12
notes.push(prev + (step === 0 ? 12 : step))
}
return notes
}
// Pure piano-recipe validation. Returns an array of where-prefixed error
// strings (empty = valid). Exported for reuse by scripts/smoke.mjs (lib mode).
export function checkPianoRecipe(where, chordStep, quality) {
const out = []
const e = (msg) => out.push(`${where}: ${msg}`)
if (!CHORD_TYPES[quality]) { e(`unknown quality '${quality}'`); return out }
const { recipe } = chordStep
if (!recipe) return err(where, 'missing recipe')
if (!recipe) { e('missing recipe'); return out }
for (const hand of ['LH', 'RH']) {
const degs = recipe[hand]
if (degs === undefined) continue
if (!Array.isArray(degs) || !degs.length) return err(where, `${hand} must be a non-empty array`)
if (degs.length > 5) return err(where, `${hand} has ${degs.length} notes — one hand, max 5`)
if (!Array.isArray(degs) || !degs.length) { e(`${hand} must be a non-empty array`); continue }
if (degs.length > 5) e(`${hand} has ${degs.length} notes — one hand, max 5`)
for (const d of degs)
if (resolveDegree(d, quality) === null) err(where, `unresolvable degree '${d}' for ${quality}`)
if (resolveDegree(d, quality) === null) e(`unresolvable degree '${d}' for ${quality}`)
const stacked = stackHand(degs, quality)
if (stacked === null) continue // unresolvable degree already reported
const span = stacked[stacked.length - 1] - stacked[0]
if (span > MAX_HAND_SPAN)
e(`${hand} [${degs.join(' ')}] spans ${span} semitones stacked low→high — max ${MAX_HAND_SPAN} (a minor 10th; SCHEMA rule 3, one hand within a 10th)`)
}
if (recipe.LH === undefined && recipe.RH === undefined) err(where, 'recipe needs LH and/or RH')
if (recipe.LH === undefined && recipe.RH === undefined) e('recipe needs LH and/or RH')
return out
}
function checkBassPlay(where, play, prog) {
const totalBars = prog.bars.reduce((a, b) => a + b, 0)
if (!Array.isArray(play.bars) || play.bars.length !== totalBars)
return err(where, `bars length ${play.bars?.length} ≠ progression total ${totalBars}`)
play.bars.forEach((bar, i) => {
if (!Array.isArray(bar.beats) || !bar.beats.length) return err(`${where} bar ${i}`, 'missing beats')
for (const b of bar.beats)
if (!BASS_TOKENS.includes(b)) err(`${where} bar ${i}`, `unknown beat token '${b}'`)
// ── Bass plays (SCHEMA.md "Bass play") ────────────────────────────────────────
// Degree-based per-station patterns: one chords[] entry per progression step,
// each a non-empty ORDERED pattern of {deg,…} chord/color tones (resolved
// through the step's quality — a degree can't misspell a pitch class) and
// typed {approach,…} notes whose pitch is DERIVED from the next station's
// root, so the validator can allow the non-chord tone without blessing
// arbitrary chromatics. Data never encodes strings/frets (key-agnostic,
// hard rule 1); the renderer places patterns on EADG, frets 015.
export const BASS_APPROACHES = ['chrom-below', 'chrom-above', 'fifth-of-next']
// Widest legal offset above the root: an octave + a fifth keeps every pattern
// placeable on EADG within frets 015 in one position.
export const BASS_MAX_OFFSET = 19
const BASS_BEATS_PER_BAR = 4 // patterns are notated in 4 — 12/8 is `feel`
const BASS_MAX_NOTES_PER_BAR = 8 // straight-8ths density cap (rule 3)
// Pure bass-play validation. Returns an array of where-prefixed error strings
// (empty = valid). Exported for reuse by scripts/smoke.mjs (lib mode).
export function checkBassPlay(where, play, prog) {
const out = []
const e = (msg) => out.push(`${where}: ${msg}`)
if (typeof play.feel !== 'string' || !play.feel)
e("feel required — the groove in one line (e.g. 'swung 8ths, locked with the kick')")
if (play.level !== undefined && !LEVELS.includes(play.level))
e(`level must be one of ${LEVELS.join(' | ')}, got '${play.level}'`)
if (!Array.isArray(play.chords) || play.chords.length !== prog.degrees.length) {
e(`chords length ${play.chords?.length} ≠ progression length ${prog.degrees.length}`)
return out
}
play.chords.forEach((step, ci) => {
const cw = `chord[${ci}] (${prog.rn?.[ci] ?? ci})`
const quality = prog.qualities[ci]
if (!CHORD_TYPES[quality]) return e(`${cw}: unknown quality '${quality}'`)
const bars = prog.bars?.[ci] ?? 1
const pat = step?.pattern
if (!Array.isArray(pat) || !pat.length)
return e(`${cw}: pattern must be a non-empty ordered array of notes`)
if (pat.length > BASS_MAX_NOTES_PER_BAR * bars)
e(`${cw}: ${pat.length} notes > ${BASS_MAX_NOTES_PER_BAR * bars} (8ths density cap over ${bars} bar(s)) — not intermediate-friendly`)
let approachSeen = false
let rootSeen = false
let lastBeat = -Infinity
pat.forEach((n, ni) => {
const nw = `${cw} pattern[${ni}]`
if (!n || typeof n !== 'object') return e(`${nw}: note must be an object ({deg,…} or {approach,…})`)
const isDeg = n.deg !== undefined
const isApproach = n.approach !== undefined
if (isDeg === isApproach) return e(`${nw}: exactly one of deg | approach per note`)
if (isApproach) {
approachSeen = true
if (!BASS_APPROACHES.includes(n.approach))
e(`${nw}: unknown approach '${n.approach}' — allowed: ${BASS_APPROACHES.join(', ')}`)
if (n.octave !== undefined)
e(`${nw}: octave applies to deg notes only (the renderer places approaches beside the next root)`)
} else {
if (approachSeen)
e(`${nw}: deg note after an approach — approach notes must close the pattern (they lead into the next chord)`)
if (typeof n.deg !== 'string') {
e(`${nw}: deg must be a degree STRING ('1', 'b7', …), got ${JSON.stringify(n.deg)}`)
} else {
const pc = resolveDegree(n.deg, quality)
if (pc === null) e(`${nw}: unresolvable degree '${n.deg}' for ${quality}`)
if (n.deg === '1') rootSeen = true
if (n.octave !== undefined && n.octave !== 0 && n.octave !== 1)
e(`${nw}: octave, when present, must be 0 or 1 — got ${JSON.stringify(n.octave)}`)
else if (pc !== null && pc + 12 * (n.octave === 1 ? 1 : 0) > BASS_MAX_OFFSET)
e(`${nw}: '${n.deg}' octave ${n.octave} sits ${pc + 12} semitones above the root — max ${BASS_MAX_OFFSET} (an octave + a fifth; keeps the pattern in one position on EADG)`)
}
}
if (n.technique !== undefined && !LICK_TECHNIQUES.includes(n.technique))
e(`${nw}: unknown technique '${n.technique}' — allowed: ${LICK_TECHNIQUES.join(', ')}`)
if (n.beat !== undefined) {
const maxBeat = BASS_BEATS_PER_BAR * bars
if (typeof n.beat !== 'number' || !(n.beat >= 1 && n.beat < maxBeat + 1))
e(`${nw}: beat must be a number in [1, ${maxBeat + 1}) for a ${bars}-bar step, got ${JSON.stringify(n.beat)}`)
else if (n.beat < lastBeat)
e(`${nw}: beat ${n.beat} < previous beat ${lastBeat} — beats must be non-decreasing in pattern order`)
else lastBeat = n.beat
}
})
if (!rootSeen)
e(`${cw}: pattern never states the root ('1') — a bassline grounds the chord (SCHEMA "Bass play" root rule)`)
})
return out
}
// Pure lick validation (SCHEMA.md "Licks" section). Returns an array of error
// strings (already where-prefixed); mutates seenIds by adding the lick's id so
// ids stay globally unique across ALL progressions and licks (same rule as
// progression ids). Exported for reuse by scripts/smoke.mjs.
export function checkLick(where, lick, style, seenIds) {
const out = []
const e = (msg) => out.push(`${where}: ${msg}`)
if (!lick || typeof lick !== 'object') { e('lick must be an object'); return out }
if (typeof lick.id !== 'string' || !lick.id.startsWith(`${style}-`))
e(`id must be a string starting with '${style}-'`)
else if (seenIds.has(lick.id)) e(`duplicate id '${lick.id}' (ids are global across progressions AND licks)`)
else seenIds.add(lick.id)
if (!lick.name) e('name missing')
if (!LEVELS.includes(lick.level)) e(`level must be one of ${LEVELS.join(' | ')}, got '${lick.level}'`)
if (typeof lick.chordContext !== 'string' || !lick.chordContext)
e("chordContext missing (which chord/station the lick fits, e.g. 'dom7' or 'over the I7')")
const summary = new Set()
if (!Array.isArray(lick.techniques)) e('techniques must be an array (may be empty for a plain-picked lick)')
else for (const t of lick.techniques) {
if (!LICK_TECHNIQUES.includes(t)) e(`unknown technique '${t}' — allowed: ${LICK_TECHNIQUES.join(', ')}`)
summary.add(t)
}
if (!Array.isArray(lick.tab) || !lick.tab.length) { e('tab must be a non-empty ordered array of notes'); return out }
lick.tab.forEach((note, i) => {
const nw = `tab[${i}]`
if (!note || typeof note !== 'object') return e(`${nw} must be an object {string, fret, technique?}`)
if (!Number.isInteger(note.string) || note.string < 1 || note.string > 6)
e(`${nw} string must be an integer 16 (1 = high e, 6 = low E), got ${JSON.stringify(note.string)}`)
if (!Number.isInteger(note.fret) || note.fret < 0 || note.fret > LICK_MAX_FRET)
e(`${nw} fret must be an integer 0${LICK_MAX_FRET}, got ${JSON.stringify(note.fret)}`)
if (note.technique !== undefined) {
if (!LICK_TECHNIQUES.includes(note.technique))
e(`${nw} unknown technique '${note.technique}' — allowed: ${LICK_TECHNIQUES.join(', ')}`)
else if (!summary.has(note.technique))
e(`${nw} technique '${note.technique}' must also appear in the lick's techniques[] summary`)
}
})
return out
}
// ── Piano licks (SCHEMA.md "Piano licks") ────────────────────────────────────
// Degree-based melodic phrases over ONE explicit quality (guitar tab is
// instrument-truth and needs no quality; degrees need a context to resolve
// through — chordContext stays the human sentence, `quality` is the machine
// truth). Approaches are typed and DERIVED: each targets the next deg note in
// the lick (there is no "next station" inside a self-contained lick), so the
// validator can allow the non-chord tone without blessing arbitrary
// chromatics — and an approach can never close a lick (nothing to target).
//
// Piano technique vocabulary — deliberately NOT LICK_TECHNIQUES: keys don't
// bend, hammer, pull off, or sustain vibrato; chromatic-approach is redundant
// (approaches are typed notes here). The three shared words keep their
// guitar-lick meanings; grace-note (the crushed blues/gospel ornament) is
// piano-specific. smoke.mjs guards both lists' consistency.
export const PIANO_LICK_TECHNIQUES = ['slide', 'double-stop', 'ghost-note', 'grace-note']
export const PIANO_LICK_APPROACHES = ['chrom-below', 'chrom-above']
// Range cap on every RESOLVED offset (deg: pc + 12·octave; approach: derived):
// [0, 25] semitones above the root. Proof against MiniPiano's render window
// (absolute notes [0, 36], 0 = low C): place the root at its pitch class in
// the bottom octave (011); the highest possible note is then 11 + 25 = 36 —
// exactly the window's top key — so every legal lick fits in all 12 keys.
export const PIANO_LICK_MAX_OFFSET = 25
const PIANO_LICK_MAX_NOTES = 16 // 8ths over the 2-bar beat window (rule 3)
const PIANO_LICK_MAX_BEAT = 9 // exclusive: 1 ≤ beat < 9 (two 4/4 bars)
// Pure piano-lick validation. Returns an array of where-prefixed error strings
// (empty = valid); mutates seenIds like checkLick (shared global id
// namespace). Exported for reuse by scripts/smoke.mjs (lib mode).
export function checkPianoLick(where, lick, style, seenIds) {
const out = []
const e = (msg) => out.push(`${where}: ${msg}`)
if (!lick || typeof lick !== 'object') { e('lick must be an object'); return out }
if (typeof lick.id !== 'string' || !lick.id.startsWith(`${style}-`))
e(`id must be a string starting with '${style}-'`)
else if (seenIds.has(lick.id)) e(`duplicate id '${lick.id}' (ids are global across progressions AND licks)`)
else seenIds.add(lick.id)
if (!lick.name) e('name missing')
if (!LEVELS.includes(lick.level)) e(`level must be one of ${LEVELS.join(' | ')}, got '${lick.level}'`)
if (typeof lick.chordContext !== 'string' || !lick.chordContext)
e("chordContext missing (which chord/station the lick fits, e.g. 'over the ii7')")
const quality = lick.quality
if (!CHORD_TYPES[quality]) {
e(`quality must be a CHORD_TYPES key (the context every deg resolves through), got '${quality}'`)
return out // nothing below is checkable without a quality
}
const summary = new Set()
if (!Array.isArray(lick.techniques)) e('techniques must be an array (may be empty for a plain lick)')
else for (const t of lick.techniques) {
if (!PIANO_LICK_TECHNIQUES.includes(t))
e(`unknown piano technique '${t}' — allowed: ${PIANO_LICK_TECHNIQUES.join(', ')}`)
summary.add(t)
}
const notes = lick.notes
if (!Array.isArray(notes) || !notes.length) { e('notes must be a non-empty ordered array'); return out }
if (notes.length > PIANO_LICK_MAX_NOTES)
e(`${notes.length} notes > ${PIANO_LICK_MAX_NOTES} (8ths over two bars) — not intermediate-friendly`)
// Pass 1: resolved offset of every deg note (null = unresolvable/malformed),
// so approaches can look up their target (the NEXT deg note in order).
const degOffsets = notes.map((n) => {
if (!n || typeof n !== 'object' || n.deg === undefined || typeof n.deg !== 'string') return null
const pc = resolveDegree(n.deg, quality)
if (pc === null) return null
const oct = n.octave === undefined ? 0 : n.octave
return oct === 0 || oct === 1 || oct === 2 ? pc + 12 * oct : null
})
let lastBeat = -Infinity
let prevApproach = null // type of the immediately preceding approach note
notes.forEach((n, ni) => {
const nw = `notes[${ni}]`
if (!n || typeof n !== 'object') return e(`${nw}: note must be an object ({deg,…} or {approach,…})`)
const isDeg = n.deg !== undefined
const isApproach = n.approach !== undefined
if (isDeg === isApproach) return e(`${nw}: exactly one of deg | approach per note`)
if (isApproach) {
if (!PIANO_LICK_APPROACHES.includes(n.approach))
e(`${nw}: unknown approach '${n.approach}' — allowed: ${PIANO_LICK_APPROACHES.join(', ')} (piano licks have no next station; 'fifth-of-next' is bass-only)`)
if (n.octave !== undefined)
e(`${nw}: octave applies to deg notes only (approach pitch is derived from its target)`)
if (prevApproach === n.approach)
e(`${nw}: two consecutive '${n.approach}' approaches derive the identical pitch — write the note you mean as a deg, or alternate types (the enclosure)`)
// Target = the NEXT deg note in order (scan past intervening approaches).
const ti = notes.findIndex((m, i) => i > ni && m?.deg !== undefined)
if (ti === -1) {
e(`${nw}: approach cannot close a piano lick — it targets the NEXT deg note (the final note must be a deg)`)
} else if (degOffsets[ti] !== null) {
const derived = degOffsets[ti] + (n.approach === 'chrom-below' ? -1 : 1)
if (derived < 0)
e(`${nw}: chrom-below of a root-position target derives 1 — below the render window; raise the target an octave`)
else if (derived > PIANO_LICK_MAX_OFFSET)
e(`${nw}: derived pitch sits ${derived} semitones above the root — max ${PIANO_LICK_MAX_OFFSET} (fits MiniPiano's 37-key window for all 12 roots)`)
} // target exists but is itself malformed → its own error already reports it
prevApproach = n.approach
} else {
prevApproach = null
if (typeof n.deg !== 'string') {
e(`${nw}: deg must be a degree STRING ('1', 'b7', …), got ${JSON.stringify(n.deg)}`)
} else {
const pc = resolveDegree(n.deg, quality)
if (pc === null) e(`${nw}: unresolvable degree '${n.deg}' for ${quality}`)
if (n.octave !== undefined && n.octave !== 0 && n.octave !== 1 && n.octave !== 2)
e(`${nw}: octave, when present, must be 0, 1 or 2 — got ${JSON.stringify(n.octave)}`)
else if (pc !== null && degOffsets[ni] !== null && degOffsets[ni] > PIANO_LICK_MAX_OFFSET)
e(`${nw}: '${n.deg}' octave ${n.octave} sits ${degOffsets[ni]} semitones above the root — max ${PIANO_LICK_MAX_OFFSET} (fits MiniPiano's 37-key window for all 12 roots)`)
}
}
if (n.technique !== undefined) {
if (!PIANO_LICK_TECHNIQUES.includes(n.technique))
e(`${nw}: unknown piano technique '${n.technique}' — allowed: ${PIANO_LICK_TECHNIQUES.join(', ')}`)
else if (!summary.has(n.technique))
e(`${nw}: technique '${n.technique}' must also appear in the lick's techniques[] summary`)
}
if (n.beat !== undefined) {
if (typeof n.beat !== 'number' || !(n.beat >= 1 && n.beat < PIANO_LICK_MAX_BEAT))
e(`${nw}: beat must be a number in [1, ${PIANO_LICK_MAX_BEAT}) — a lick spans at most two 4/4 bars, got ${JSON.stringify(n.beat)}`)
else if (n.beat < lastBeat)
e(`${nw}: beat ${n.beat} < previous beat ${lastBeat} — beats must be non-decreasing in note order`)
else lastBeat = n.beat
}
})
return out
}
async function loadModule(path) {
return (await import(pathToFileURL(path).href)).default
}
async function main() {
const styleDirs = readdirSync(KB, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => d.name)
if (!styleDirs.length) { console.error('No style folders in src/data/kb/'); process.exit(1) }
@@ -116,7 +410,7 @@ const registry = existsSync(join(KB, 'index.js')) ? await loadModule(join(KB, 'i
if (!registry) err('kb/index.js', 'registry missing')
const allIds = new Set()
let totals = { styles: 0, progressions: 0, plays: 0 }
let totals = { styles: 0, progressions: 0, plays: 0, licks: 0 }
for (const style of styleDirs) {
const dir = join(KB, style)
@@ -147,6 +441,9 @@ for (const style of styleDirs) {
if (!MODES.includes(p.mode)) err(pw, `unknown mode '${p.mode}'`)
if (!Array.isArray(p.songs) || !p.songs.length) err(pw, 'songs missing')
if (!p.tip) err(pw, 'tip missing')
// Optional difficulty tag — absent means 'foundation' (consumer default).
if (p.level !== undefined && !LEVELS.includes(p.level))
err(pw, `level, when present, must be one of ${LEVELS.join(' | ')} — got '${p.level}'`)
}
totals.styles++; totals.progressions += progs.length
@@ -160,9 +457,10 @@ for (const style of styleDirs) {
if (inst !== 'bass' && (!pack.improv?.scales?.length || !pack.improv?.targetNotes))
err(iw, 'improv.scales / improv.targetNotes required')
const minPlays = inst === 'bass' ? MIN_PLAYS_BASS : MIN_PLAYS
for (const p of progs)
if ((pack.plays?.[p.id]?.length ?? 0) < MIN_PLAYS)
err(iw, `progression '${p.id}' has < ${MIN_PLAYS} plays`)
if ((pack.plays?.[p.id]?.length ?? 0) < minPlays)
err(iw, `progression '${p.id}' has < ${minPlays} play(s)`)
for (const [pid, plays] of Object.entries(pack.plays ?? {})) {
const prog = progById[pid]
@@ -171,16 +469,58 @@ for (const style of styleDirs) {
const lw = `${iw} ${pid} play[${pi}] "${play.label ?? '?'}"`
if (!play.label || !play.level || !play.tips) err(lw, 'label/level/tips required')
totals.plays++
if (inst === 'bass') return checkBassPlay(lw, play, prog)
if (inst === 'bass') { for (const m of checkBassPlay(lw, play, prog)) errors.push(m); return }
if (!Array.isArray(play.chords) || play.chords.length !== prog.degrees.length)
return err(lw, `chords length ≠ progression length ${prog.degrees.length}`)
play.chords.forEach((step, ci) => {
const cw = `${lw} chord[${ci}] (${prog.rn[ci]})`
if (inst === 'guitar') checkGuitarShape(cw, step, prog.qualities[ci])
else checkPianoRecipe(cw, step, prog.qualities[ci])
else for (const m of checkPianoRecipe(cw, step, prog.qualities[ci])) errors.push(m)
})
})
}
// Optional structured licks (SCHEMA.md "Licks" / "Piano licks") — a
// top-level `licks` key on the instrument pack. Absent is fine; when
// present it must validate. Routed by instrument: piano licks are
// degree-based (checkPianoLick); guitar licks are tab-based (checkLick).
if (pack.licks !== undefined) {
if (!Array.isArray(pack.licks) || !pack.licks.length) {
err(iw, 'licks, when present, must be a non-empty array')
} else {
const checkInstLick = inst === 'piano' ? checkPianoLick : checkLick
pack.licks.forEach((lick, li) => {
const lkw = `${iw} licks[${li}] "${lick?.id ?? '?'}"`
for (const m of checkInstLick(lkw, lick, style, allIds)) errors.push(m)
})
totals.licks += pack.licks.length
}
}
}
}
// ── Global progression-id uniqueness over the REGISTRY (task C-50) ────────────
// RelatedProgressions' ranking excludes the matched progression by ID ALONE
// (rankRelatedProgressions: `prog.id !== match.id` — no style comparison, task
// L-51), so a progression id repeated anywhere in the registry would silently
// drop an unrelated style's entry from the related list. The per-style loop
// above walks the FILES (kb/*/progressions.js) into `allIds`; this asserts the
// same invariant over kb/index.js — the object the components actually
// consume — so a registry wiring mistake the file walk never sees (a style
// registered against another style's progressions module, a shared/duplicated
// array) cannot reintroduce a duplicate.
if (registry) {
const seenRegIds = new Map() // id → style it first appeared under
for (const style of Object.keys(registry)) {
const progs = registry[style]?.progressions
if (!Array.isArray(progs)) continue
for (const p of progs) {
const rw = `kb/index.js [${style}]`
if (typeof p?.id !== 'string' || !p.id) { err(rw, 'registry progression with missing/non-string id'); continue }
if (seenRegIds.has(p.id))
err(rw, `progression id '${p.id}' already registered under style '${seenRegIds.get(p.id)}' — ids must be globally unique across the registry (RelatedProgressions excludes the matched progression by id alone)`)
else seenRegIds.set(p.id, style)
}
}
}
@@ -189,4 +529,11 @@ if (errors.length) {
for (const e of errors) console.error(' ' + e)
process.exit(1)
}
console.log(`✓ KB valid — ${totals.styles} style(s), ${totals.progressions} progressions, ${totals.plays} plays`)
const lickNote = totals.licks ? `, ${totals.licks} licks` : ''
console.log(`✓ KB valid — ${totals.styles} style(s), ${totals.progressions} progressions, ${totals.plays} plays${lickNote}`)
}
// Run the full validation unless imported as a library (see header comment).
// Safe-by-default: an unset env var always means "run" — the gate can't be
// skipped by a path-comparison quirk.
if (!process.env.KB_VALIDATE_AS_LIB) await main()
+319 -36
View File
@@ -1,7 +1,6 @@
import { useState, useCallback, useRef, useEffect } from 'react'
import AudioCapture from './components/AudioCapture'
import ProgressionBanner from './components/ProgressionBanner'
import ProgressionSuggestions from './components/ProgressionSuggestions'
import Fretboard from './components/Fretboard'
import BassFretboard from './components/BassFretboard'
import Tuner from './components/Tuner'
@@ -11,10 +10,13 @@ import DebugView from './components/DebugView'
import DrumView from './components/DrumView'
import { NOTES, detectKey, detectTopKeys, matchChordFromChroma, detectRepeatingProgression, getChordTones, getChordCandidates, getNoteHistoryAnalysis } from './lib/theory'
import ChordDetailModal from './components/ChordDetailModal'
import CurrentJamPanel from './components/CurrentJamPanel'
import RelatedProgressions from './components/RelatedProgressions'
import TryThis from './components/TryThis'
import LoopStation from './components/LoopStation'
import JamGuide from './components/JamGuide'
import JamGuide, { KnowledgeDock } from './components/JamGuide'
import { useLoopEngine } from './services/loopEngine'
import kb from './data/kb/index.js'
import { seedableLoop, buildRoulettePool } from './lib/match'
import settingIcon from './assets/setting-icon.png'
const DEFAULTS = {
@@ -61,6 +63,36 @@ export default function App() {
const [showDrumView, setShowDrumView] = useState(false)
const [monoColor, setMonoColor] = useState(() => loadStored('wtf_monoColor', false))
// ── Jam view (task L-50, one-screen.md §1.1) — pure UI/layout state ──────────
// Layer 1: CSS lock — at xl the page root becomes h-screen overflow-hidden and
// everything below the dashboard is unmounted. Layer 2: best-effort browser
// fullscreen (Promise-caught — a refusal leaves layer 1 fully working). The
// toggle never starts/stops listening and never touches audio state.
const [jamView, setJamView] = useState(false)
function enterJamView() {
setJamView(true)
document.documentElement.requestFullscreen?.()?.catch(() => {})
}
function exitJamView() {
setJamView(false)
if (document.fullscreenElement) document.exitFullscreen?.()?.catch(() => {})
}
// Escape and the native fullscreen exit (any means) both restore normal flow —
// one state, never half-exited. Listeners active only while jamView.
useEffect(() => {
if (!jamView) return
const onKey = (e) => { if (e.key === 'Escape') exitJamView() }
const onFsChange = () => { if (!document.fullscreenElement) setJamView(false) }
window.addEventListener('keydown', onKey)
document.addEventListener('fullscreenchange', onFsChange)
return () => {
window.removeEventListener('keydown', onKey)
document.removeEventListener('fullscreenchange', onFsChange)
}
}, [jamView]) // eslint-disable-line react-hooks/exhaustive-deps
// ── Jam Guide → Fretboard cross-link (D-03) ──────────────────────────────────
// When a Roadmap station is tapped, JamGuide reports its {rootPc, quality}
// here and the main Fretboard highlights that chord's guide tones (3rd/7th).
@@ -123,6 +155,13 @@ export default function App() {
const [detectedProgression, setDetectedProgression] = useState(null)
const [selectedChord, setSelectedChord] = useState(null)
// ── Jam Roulette (task L-60, jam-roulette.md) — pure UI/display state ─────────
// seedInfo: provenance of an unconfirmed rolled loop { styleLabel, name, bars }
// (null once live detection confirms or replaces it). Invariant (§3.5):
// seedInfo !== null ⇔ progressionVoteRef.current?.seeded === true.
const [seedInfo, setSeedInfo] = useState(null)
const [rouletteMenuOpen, setRouletteMenuOpen] = useState(false)
// ── Top key candidates (shown as quick-lock chips) ────────────────────────────
const [topKeyCandidates, setTopKeyCandidates] = useState([])
@@ -138,6 +177,13 @@ export default function App() {
const progressionVoteRef = useRef(null)
const progressionMissRef = useRef(0)
const pendingKeyRef = useRef(null)
// Roulette session memory (UI-state refs, never read by audio code): the last
// 6 rolled progression ids (no-repeat), the last rolled root pc (§2), and the
// last resolved style id (for the "Re-roll — {style}" row).
const rouletteMemoryRef = useRef([])
const prevRootPcRef = useRef(null)
const lastRolledStyleRef = useRef(null)
const rouletteRef = useRef(null)
// Keep refs in sync
useEffect(() => { effectiveKeyRef.current = effectiveKey }, [effectiveKey])
@@ -151,24 +197,78 @@ export default function App() {
chromaIdxRef.current = 0
}, [config.chromaSmooth])
// ── Detect progression — require 2 consecutive identical results to commit ────
// ── Progression commit layer (task L-31) ─────────────────────────────────────
// Runs once per chord commit. progressionVoteRef holds
// { committedKey, candidateKey, candidateCount } — null until first evidence.
//
// Thresholds are in chord-commits (one detector run each):
// · COMMIT_VOTES = 2 — first commit needs 2 consecutive identical detections
// (≈ one bar). Post-L-30 detection is stable on clean loops so this lands
// immediately; a noisy 2-rep history flaps through data-faithful sub-cycles
// that never repeat twice in a row, so noise can't commit early.
// · REPLACE_VOTES = 3 — replacing a committed loop needs 3 consecutive
// detections of the SAME new loop: one transient detection (or an
// alternating flap) must never displace the loop the musician is still in;
// a genuine section change is detected consistently and just lands one
// commit later than a first commit would.
// · NULL_CLEAR = 6 — the detector only returns null once the loop has
// aged out of its 32-commit window (it needs 2 exact in-window
// occurrences): traced, that is ~28 commits of foreign material after
// the loop last played. Fills, turnarounds and window-boundary resumes
// yield non-null sub-cycle detections rather than nulls (traced), so
// they can NEVER clear a committed loop — a new established loop
// replaces via REPLACE_VOTES instead. A null run therefore means the
// jam truly left loop-land ~30 commits ago; 6 more (≈ two bars of
// structureless playing) confirms it wasn't a flicker before the
// display goes dark. (The old value 4 was sized as if nulls happened
// during fills — post-L-30 they don't.)
const COMMIT_VOTES = 2
const REPLACE_VOTES = 3
const NULL_CLEAR = 6
useEffect(() => {
const detected = detectRepeatingProgression(chordHistory)
const vote = progressionVoteRef.current
if (!detected) {
progressionMissRef.current++
// Clear stale loop after 4 chord changes with no pattern found
if (progressionMissRef.current >= 4) {
// L-60 flag 1 (§3.4): a SEEDED card is an instruction, not an observation —
// ramp-up nulls (every seed's own effect run is miss 1, and no detection can
// land before commit 6) must NOT wipe it. It stays until confirmed, replaced
// by a consistently-detected different loop, re-rolled, or New Song.
if (progressionMissRef.current >= NULL_CLEAR && !vote?.seeded) {
setDetectedProgression(null)
progressionVoteRef.current = null
}
return
}
progressionMissRef.current = 0
progressionMissRef.current = 0 // any detected structure keeps the committed loop alive
const key = detected.join(',')
if (progressionVoteRef.current === key) {
if (vote && vote.committedKey === key) {
// Agreement with the committed loop — refresh it, drop any pending rival.
setDetectedProgression(detected)
vote.candidateKey = null
vote.candidateCount = 0
// L-60 (§3.4): the seed is now a normal committed loop — the first agreeing
// live detection confirms it; drop the provenance flag + chip.
if (vote.seeded) { vote.seeded = false; setSeedInfo(null) }
return
}
const committedKey = vote ? vote.committedKey : null
if (vote && vote.candidateKey === key) {
vote.candidateCount++
} else {
progressionVoteRef.current = key
// L-60 flag 3 (§3.4): preserve `seeded` across candidate rebuilds — a
// transient ghost sub-cycle must not strip the flag and resurrect flag 1's
// ramp-up kill through the side door.
progressionVoteRef.current = { committedKey, candidateKey: key, candidateCount: 1, seeded: vote?.seeded ?? false }
}
if (progressionVoteRef.current.candidateCount >= (committedKey ? REPLACE_VOTES : COMMIT_VOTES)) {
setDetectedProgression(detected)
progressionVoteRef.current = { committedKey: key, candidateKey: null, candidateCount: 0 }
// L-60 (§3.4/§3.5): a genuinely different loop replaced the seed — the new
// vote is detection-owned; end the seed provenance.
setSeedInfo(null)
}
}, [chordHistory])
@@ -191,6 +291,7 @@ export default function App() {
effectiveKeyRef.current = null
setChordHistory([])
setDetectedProgression(null)
setSeedInfo(null) // L-60 (§3.6): the seed clears with the full reset
setTopKeyCandidates([])
setBpm(null)
setMicError(null)
@@ -220,6 +321,94 @@ export default function App() {
effectiveKeyRef.current = keyInfo
}
// ── Jam Roulette (task L-60, jam-roulette.md §2/§3.1) ────────────────────────
// Rolls a random key + interesting KB progression and seeds the EXACT state
// live detection writes (lockedKey + detectedProgression + a committed-shape
// progressionVoteRef), so the whole dashboard populates as if detected. All
// randomness is here (plain Math.random, no audio contact); inputs = the KB
// registry only. `styleId === 'surprise'` picks uniformly over the 10 styles.
function rollJam(styleId) {
const pool = buildRoulettePool(kb) // lazy memo — round-trip passers, len 28
const sid = styleId === 'surprise'
? Object.keys(kb)[Math.floor(Math.random() * Object.keys(kb).length)]
: styleId
const members = pool.byStyle.get(sid) ?? []
if (!members.length) return
// No-repeat memory (§2.2): exclude the last 6 rolled ids; if that empties the
// pool (small styles), fall back to excluding only the immediately previous.
const mem = rouletteMemoryRef.current
let candidates = members.filter(m => !mem.includes(m.id))
if (!candidates.length) {
const prev = mem[mem.length - 1]
candidates = members.filter(m => m.id !== prev)
if (!candidates.length) candidates = members
}
// Weighted draw: weight = levelW × lenW (§2.2). Intermediate leans in (×2),
// the collapsed "4-bar-ish" sweet spot 37 leans in (×2).
const weightOf = (m) => {
const levelW = m.progression.level === 'intermediate' ? 2 : 1
const lenW = (m.collapsedLen >= 3 && m.collapsedLen <= 7) ? 2 : 1
return levelW * lenW
}
const totalW = candidates.reduce((s, m) => s + weightOf(m), 0)
let r = Math.random() * totalW
let picked = candidates[candidates.length - 1]
for (const m of candidates) { r -= weightOf(m); if (r <= 0) { picked = m; break } }
const prog = picked.progression
// Root: uniform over 12 pcs, SHARP spelling (§2.1 — only sharp names
// string-match live detection); don't repeat the previous roll's root.
let rolledPc = Math.floor(Math.random() * 12)
if (prevRootPcRef.current != null && rolledPc === prevRootPcRef.current) {
rolledPc = Math.floor(Math.random() * 12) // re-draw once
}
const loop = seedableLoop(prog, rolledPc)
if (!loop) return // pool guarantees this, but stay defensive
prevRootPcRef.current = rolledPc
// ── The seed writes (§3.1) — clean slate, then key + loop + committed vote ──
newSong() // §3.6: roulette = New Song + seed (a stale window poisons handoff)
const info = { root: NOTES[rolledPc], mode: prog.mode, confidence: 1 }
setLockedKey(info)
effectiveKeyRef.current = info // the quickLock precedent — detection uses it NOW
chordVotesRef.current = []
setDetectedProgression(loop)
progressionVoteRef.current = {
committedKey: loop.join(','), // the committed shape, L-31's own key
candidateKey: null,
candidateCount: 0,
seeded: true, // the one flag L-60 adds (§3.4)
}
progressionMissRef.current = 0
setSeedInfo({ styleLabel: kb[sid]?.meta?.label ?? sid, name: prog.name, bars: prog.bars })
// Session bookkeeping (§2.2) — survives New Song deliberately.
lastRolledStyleRef.current = sid
mem.push(picked.id)
while (mem.length > 6) mem.shift()
setRouletteMenuOpen(false)
}
// Escape / click-outside closes the roulette menu; focus returns to the button.
useEffect(() => {
if (!rouletteMenuOpen) return
const onKey = (e) => {
if (e.key === 'Escape') {
setRouletteMenuOpen(false)
rouletteRef.current?.querySelector('button')?.focus()
}
}
const onDown = (e) => { if (!rouletteRef.current?.contains(e.target)) setRouletteMenuOpen(false) }
document.addEventListener('keydown', onKey)
document.addEventListener('mousedown', onDown)
return () => {
document.removeEventListener('keydown', onKey)
document.removeEventListener('mousedown', onDown)
}
}, [rouletteMenuOpen])
// ── Waveform handler: feeds oscilloscope / drum view ─────────────────────────
const handleWaveform = useCallback((data) => {
if (showDebugRef.current || showDrumViewRef.current) {
@@ -396,7 +585,7 @@ export default function App() {
}
return (
<div className="min-h-screen bg-surface text-white p-3">
<div className={`min-h-screen bg-surface text-white p-3${jamView ? ' xl:h-screen xl:overflow-hidden xl:flex xl:flex-col' : ''}`}>
{/* ── Header ── */}
<header className="mb-2 flex items-center justify-between">
@@ -536,6 +725,77 @@ export default function App() {
</button>
</div>
)}
{/* ── Jam roulette (L-60, jam-roulette.md §1.1/§1.2) ── */}
<div className="relative ml-auto" ref={rouletteRef}>
<button
type="button"
onClick={() => setRouletteMenuOpen(o => !o)}
aria-haspopup="menu"
aria-expanded={rouletteMenuOpen}
aria-pressed={seedInfo ? true : undefined}
title="Jam roulette — roll a random key + progression to jam on"
className={`min-h-[32px] px-3 py-1 rounded-lg border text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent ${
seedInfo
? 'border-accent/40 text-accent bg-accent/10 font-semibold'
: 'border-border text-gray-200 hover:border-gray-500'
}`}
>
🎲 Jam roulette
</button>
{rouletteMenuOpen && (
<div
role="menu"
aria-label="Pick a genre to roll"
className="absolute right-0 mt-1 w-56 bg-panel border border-border rounded-xl shadow-lg p-1 z-20"
>
{seedInfo && (
<button
type="button"
role="menuitem"
onClick={() => rollJam(lastRolledStyleRef.current)}
className="w-full text-left px-3 py-1.5 rounded-lg text-sm text-gray-200 hover:bg-accent/10 border-b border-border outline-none focus-visible:ring-2 focus-visible:ring-accent"
>
Re-roll {seedInfo.styleLabel}
</button>
)}
<button
type="button"
role="menuitem"
onClick={() => rollJam('surprise')}
className="w-full text-left px-3 py-1.5 rounded-lg text-sm text-gray-200 hover:bg-accent/10 border-b border-border outline-none focus-visible:ring-2 focus-visible:ring-accent"
>
Surprise me
</button>
{Object.entries(kb).map(([id, s]) => (
<button
key={id}
type="button"
role="menuitem"
onClick={() => rollJam(id)}
className="w-full text-left px-3 py-1.5 rounded-lg text-sm text-gray-200 hover:bg-accent/10 outline-none focus-visible:ring-2 focus-visible:ring-accent"
>
{s.meta?.label ?? id}
</button>
))}
</div>
)}
</div>
{/* ── Jam view toggle (L-50, one-screen.md §1.1) — layout-only ── */}
<button
type="button"
onClick={jamView ? exitJamView : enterJamView}
aria-pressed={jamView}
title={jamView ? 'Exit jam view' : 'Jam view — the one-screen dashboard, fullscreen'}
className={`ml-auto min-h-[32px] px-3 py-1 rounded-lg text-sm border transition-all outline-none focus-visible:ring-2 focus-visible:ring-accent ${
jamView
? 'bg-accent/20 border-accent text-accent font-semibold'
: 'border-border text-gray-400 hover:border-gray-500 hover:text-gray-200'
}`}
>
{jamView ? '✕ Exit' : '⛶ Jam view'}
</button>
</div>
<AudioCapture
@@ -569,34 +829,56 @@ export default function App() {
chordHistory={chordHistory}
keyInfo={effectiveKey}
detectedProgression={detectedProgression}
currentChord={currentChord}
seedInfo={seedInfo}
onChordClick={setSelectedChord}
/>
{/* ── Instrument + progressions row ── */}
<div className="flex gap-3 mb-3 items-stretch">
<div className="w-full lg:w-[70%] min-w-0">
{instrument === 'guitar' && <Fretboard keyInfo={effectiveKey} currentChord={currentChord} pentatonicOnly={false} monoColor={monoColor} jamFocusChord={jamFocusChord} />}
{instrument === 'bass' && <BassFretboard keyInfo={effectiveKey} currentChord={currentChord} monoColor={monoColor} />}
{instrument === 'piano' && <Piano keyInfo={effectiveKey} currentChord={currentChord} monoColor={monoColor} />}
</div>
<div className="hidden lg:block w-[30%] min-w-0 relative">
<div className="absolute inset-0">
<ProgressionSuggestions keyInfo={effectiveKey} currentChord={currentChord} />
</div>
</div>
</div>
{/* ── Current jam — collapsible ── */}
<CurrentJamPanel
{/* ── The jam dashboard grid (task L-50, one-screen.md §1/§6): JamGuide
owns the two-column layout — LEFT: compact instrument view (chosen
here, passed as the mainView slot) + licks strip + the related-
progressions slot (RelatedProgressions, task L-51); RIGHT: the
suggested-voicings rail. ProgressionSuggestions is unmounted (file
kept) — its job split into the rail + RelatedProgressions per the
user directive. Follows the one global instrument selector. ── */}
<JamGuide
detectedProgression={detectedProgression}
keyInfo={effectiveKey}
chordHistory={chordHistory}
detectedProgression={detectedProgression}
onChordClick={setSelectedChord}
currentChord={currentChord}
onFocusChord={setJamFocusChord}
instrument={instrument}
mainView={
<>
{instrument === 'guitar' && <Fretboard keyInfo={effectiveKey} currentChord={currentChord} pentatonicOnly={false} monoColor={monoColor} jamFocusChord={jamFocusChord} compact />}
{instrument === 'bass' && <BassFretboard keyInfo={effectiveKey} currentChord={currentChord} monoColor={monoColor} compact />}
{instrument === 'piano' && <Piano keyInfo={effectiveKey} currentChord={currentChord} monoColor={monoColor} compact />}
</>
}
relatedSlot={
<div className="flex flex-col gap-3">
<TryThis
loop={detectedProgression}
keyInfo={effectiveKey}
currentChord={currentChord}
onChordClick={setSelectedChord}
instrument={instrument}
/>
<RelatedProgressions
loop={detectedProgression}
keyInfo={effectiveKey}
onChordClick={setSelectedChord}
/>
</div>
}
fill={jamView}
/>
{/* ── Below the dashboard — the learning / behind-the-scenes area (page
scroll in normal mode; UNMOUNTED in jam view, one-screen.md §1.1/§3:
conditional mount, not `hidden`, so collapsed chrome can't leak
height). ── */}
{!jamView && (
<>
{/* ── Loop station ── */}
<LoopStation
slots={slots}
@@ -667,15 +949,16 @@ export default function App() {
{showTuner && <div className="border-t border-border"><Tuner /></div>}
</div>
{/* ── Jam Guide — bottom dock (Roadmap) ── */}
<JamGuide
detectedProgression={detectedProgression}
{/* ── Knowledge Center — bottom browse & study dock (L-40, D-40 §5) ── */}
<KnowledgeDock
keyInfo={effectiveKey}
chordHistory={chordHistory}
bpm={bpm}
currentChord={currentChord}
onFocusChord={setJamFocusChord}
onChordClick={setSelectedChord}
instrument={instrument}
/>
</>
)}
</div>
)
}
+32 -12
View File
@@ -33,7 +33,10 @@ function noteColor(isChordTone, isPenta, isScale, mono = false) {
return null
}
export default function BassFretboard({ keyInfo, currentChord, monoColor = false }) {
// `compact` (task L-50, one-screen.md §2): trimmed card chrome (p-3, legend
// merged onto the heading line) + a natural-width cap on the SVG (max-width =
// its viewBox width, so it never renders above scale 1.0).
export default function BassFretboard({ keyInfo, currentChord, monoColor = false, compact = false }) {
const { root, mode } = keyInfo ?? {}
if (!root) return null
@@ -44,19 +47,40 @@ export default function BassFretboard({ keyInfo, currentChord, monoColor = false
? new Set(getChordTones(currentChord).map(n => NOTES.indexOf(n)))
: new Set()
const heading = (
<p className={`text-sm text-gray-500 uppercase tracking-widest ${compact ? '' : 'mb-4'}`}>
Bass {root} {mode}
{currentChord && <span className="text-amber-400 ml-2">/ {currentChord}</span>}
</p>
)
const legend = (
// Critic mechanical fix (L-50 gate): non-compact keeps HEAD's exact class
// string so the non-compact render stays byte-identical to the committed one.
<div className={compact ? 'flex items-center text-xs text-gray-500 flex-wrap gap-3' : 'mt-3 flex gap-5 text-xs text-gray-500'}>
<span><span className="text-accent"></span> Chord tone</span>
<span style={{ color: monoColor ? '#c084fc' : '#f59e0b' }}></span><span> Pentatonic</span>
<span style={{ color: monoColor ? '#e9d5ff' : '#6b7280' }}></span><span> Scale</span>
</div>
)
return (
<div className="bg-panel border border-border rounded-2xl p-6">
<p className="text-sm text-gray-500 uppercase tracking-widest mb-4">
Bass {root} {mode}
{currentChord && <span className="text-amber-400 ml-2">/ {currentChord}</span>}
</p>
<div className={`bg-panel border border-border rounded-2xl ${compact ? 'p-3' : 'p-6'}`}>
{compact ? (
<div className="mb-2 flex flex-wrap items-center justify-between gap-x-4 gap-y-1">
{heading}
{legend}
</div>
) : (
heading
)}
<div>
<svg
viewBox={`0 0 ${BOARD_W} ${BOARD_H}`}
width="100%"
height="auto"
style={{ display: 'block' }}
style={{ display: 'block', ...(compact ? { maxWidth: BOARD_W } : null) }}
>
{/* Fretboard background */}
<rect x={NUT_X} y={PAD_T - 6} width={BOARD_W - NUT_X - 4} height={3 * STRING_H + 12}
@@ -139,11 +163,7 @@ export default function BassFretboard({ keyInfo, currentChord, monoColor = false
</svg>
</div>
<div className="mt-3 flex gap-5 text-xs text-gray-500">
<span><span className="text-accent"></span> Chord tone</span>
<span style={{ color: monoColor ? '#c084fc' : '#f59e0b' }}></span><span> Pentatonic</span>
<span style={{ color: monoColor ? '#e9d5ff' : '#6b7280' }}></span><span> Scale</span>
</div>
{!compact && legend}
</div>
)
}
+415
View File
@@ -0,0 +1,415 @@
// BassPatternCard — per-station authored bass pattern as compact 4-string tab
// (task L-42, per docs/design/integrated-glance.md §3's gallery-slot contract
// and SCHEMA.md "Bass play").
//
// Given a station's { rootPc, quality }, one play's per-station `pattern`, and
// the NEXT station's root (approach pitches derive from it — the loop wraps),
// this renders the REALIZED line: the degree/approach data resolved to actual
// pitches and placed on the bass. Visually it rhymes with LickCard's tab SVG
// (same string-line + surface-pill-number language, same technique-glyph
// vocabulary) but with the bass rendering convention from SCHEMA.md:
//
// standard 4-string tuning EADG, string 1 = G (HIGHEST) rendered on top,
// string 4 = low E at the bottom — the same "1 = highest string" counting as
// lick tab and `rootStr`, so no third scheme exists in this codebase.
//
// ── Realization rules (SCHEMA.md "Bass play") ─────────────────────────────────
// Pitch space: semitones above open low E (E1). Open strings sit at 0 (E),
// 5 (A), 10 (D), 15 (G); the playable ceiling is 30 (G string, fret 15).
//
// · The station ROOT lands on its lowest playable position:
// rootAbs = (rootPc 4) mod 12 (open E's pitch class is 4).
// · A `deg` note sits at rootAbs + resolveDegree(deg, quality) + 12·octave.
// The schema caps the resolved offset at 19 semitones, so every deg note
// fits ≤ 30 by construction (11 + 19); anything unresolvable nulls the
// whole pattern and the card renders its placeholder instead of lying.
// · An `approach` note's PITCH CLASS derives from the next station's root:
// chrom-below = next1 · chrom-above = next+1 · fifth-of-next = next+7
// (mod 12). Its OCTAVE is the placement nearest the previous realized note
// (approaches are terminal, so a previous note always exists), which keeps
// the walkup/walkdown contour the author described — e.g. the 12-bar bar-4
// walkup CDE♭ lands its E right above the E♭, not two octaves away.
// · 🚨 C-41 gate rule — the open-E floor: a chrom-below into a next root at
// open E (abs 0) has NO pitch below the instrument (1 does not exist).
// When the nearest placement falls below abs 0 it is OCTAVE-DISPLACED up
// (+12): the approach plays a half-step under the OCTAVE root instead —
// e.g. D♯ at abs 11 leading into E. The symmetric ceiling guard (> 30 →
// 12) exists for completeness. This is the displacement rule the ledger
// row mandates; keep it.
// · String/fret: each realized pitch takes the HIGHEST-tuned open string at
// or below it — the minimum-fret assignment. Because the root starts at
// its lowest position (fret ≤ 11 worst case, usually ≤ 8) and strings are
// tuned in fourths, the whole pattern lands in one hand position within
// frets 015 (the schema's ≤ 19-semitone span guarantee).
//
// ── Rendering ─────────────────────────────────────────────────────────────────
// Beat spacing when every note carries a `beat` (columns proportional to beat,
// faint beat numbers under the bottom string); plain even columns otherwise.
// Approach notes draw AMBER (the established secondary-tone colour) with a
// small arrow after the final one — they belong to the NEXT chord. Technique
// marks reuse the lick glyph vocabulary in its light form (amber letter/symbol
// above the note; ghost notes parenthesise and dim, as in LickCard).
//
// ── Playback (▶) ──────────────────────────────────────────────────────────────
// Sequential single-note scheduling through chordAudio's playVoicing (one call
// per note — playVoicing itself sorts/dedupes, which is wrong for a melodic
// line, so the ORDER lives here in setTimeout scheduling). Bass register:
// realized abs 20 puts open E at chordAudio note 20 = E1 ≈ 41.2 Hz
// (chordAudio's space is 0 = C3; negatives are documented-legal input).
// Timing: beats at a fixed preview tempo when present, else even eighths.
// One pattern at a time module-wide: each play stops the previous sequence
// AND calls stopAll() so it never layers over a VoicingBrowser preview.
import { useEffect } from 'react'
import { NOTES } from '../lib/theory'
import { resolveDegree } from './JamGuide'
import { playVoicing, stopAll } from '../lib/chordAudio'
// SVG palette — mirrors LickCard's token constants (SVG fills can't read
// Tailwind classes): amber = technique/approach, surface = backing pills.
const AMBER = '#f59e0b'
const FRET_TEXT = '#e5e7eb' // gray-200
const GHOST_TEXT = '#9ca3af' // gray-400
const STRING_LINE = '#3a3a3a'
const STRING_LABEL = '#6b7280' // gray-500
const BEAT_LABEL = '#6b7280'
const CARD_BG = '#0f0f0f' // token `surface`
// Strings top → bottom: 1 = G (highest), 4 = low E. `open` = semitones above E1.
const STRINGS = [
{ n: 1, name: 'G', open: 15 },
{ n: 2, name: 'D', open: 10 },
{ n: 3, name: 'A', open: 5 },
{ n: 4, name: 'E', open: 0 },
]
const OPEN_E_PC = 4 // pitch class of the low E string
const ABS_MAX = 30 // G string fret 15 — the playable ceiling
// Approach-type → semitone delta from the NEXT station's root (SCHEMA.md).
const APPROACH_DELTA = { 'chrom-below': -1, 'chrom-above': 1, 'fifth-of-next': 7 }
// Technique mark drawn above the note (light form of LickCard's glyphs; the
// full vocabulary is legal per SCHEMA.md — ghost-note is handled by the
// parenthesised dim label, double-stop by equal beats, chromatic-approach and
// unknown words get no mark, exactly like LickCard's graceful default).
const TECH_MARK = {
'hammer-on': 'h',
'pull-off': 'p',
slide: '',
bend: '↑',
vibrato: '~',
}
const mod12 = (n) => ((n % 12) + 12) % 12
// abs (semitones above open E1 = MIDI 28) → "E1"/"C2"… scientific spelling.
function absName(abs) {
return `${NOTES[mod12(abs + OPEN_E_PC)]}${Math.floor((abs + 28) / 12) - 1}`
}
// Min-fret string assignment: highest-tuned open string at or below the pitch.
function placeOnString(abs) {
for (const s of STRINGS) {
if (abs >= s.open && abs - s.open <= 15) return { string: s.n, fret: abs - s.open }
}
return null // abs outside [0, 30] — caller nulls the pattern
}
/**
* realizeBassPattern(pattern, rootPc, quality, nextRootPc)
* → [{ abs, string, fret, beat?, technique?, approach }] | null
*
* Pure realization per the header rules. Returns null on ANY malformed or
* unplaceable note so the caller can render a placeholder — authored data is
* validator-guaranteed, but a renderer must never crash on bad input.
*/
export function realizeBassPattern(pattern, rootPc, quality, nextRootPc) {
if (!Array.isArray(pattern) || pattern.length === 0) return null
if (!Number.isFinite(rootPc)) return null
const rootAbs = mod12(rootPc - OPEN_E_PC) // lowest playable root position
const out = []
let prev = rootAbs // approach placement anchor (root until a note lands)
for (const note of pattern) {
if (!note || typeof note !== 'object') return null
let abs
if (note.deg !== undefined && note.approach === undefined) {
const off = resolveDegree(String(note.deg), quality)
if (off === null || off === undefined) return null
abs = rootAbs + off + (note.octave === 1 ? 12 : 0)
} else if (note.approach !== undefined && note.deg === undefined) {
const delta = APPROACH_DELTA[note.approach]
if (delta === undefined || !Number.isFinite(nextRootPc)) return null
const pc = mod12(nextRootPc + delta)
const base = mod12(pc - OPEN_E_PC)
// Nearest octave placement to the previous note (ties resolve upward).
abs = base + 12 * Math.round((prev - base) / 12)
// C-41 open-E floor: chrom-below into a next root at open E resolves to
// abs 1, which does not exist on the instrument — octave-displace the
// approach up (+12: a half-step under the OCTAVE root). Ceiling mirror.
if (abs < 0) abs += 12
if (abs > ABS_MAX) abs -= 12
} else {
return null // exactly one of deg | approach per note (schema)
}
const placed = placeOnString(abs)
if (!placed) return null
out.push({
abs,
string: placed.string,
fret: placed.fret,
beat: Number.isFinite(note.beat) ? note.beat : undefined,
technique: typeof note.technique === 'string' ? note.technique : undefined,
approach: note.approach !== undefined,
})
prev = abs
}
return out
}
// ─── Sequential playback (module-level: one pattern at a time, app-wide) ─────
const PREVIEW_BPM = 96 // relaxed shuffle-ish preview tempo (display is tempo-free)
let currentSeq = null // { timeouts: number[], handles: {stop}[] }
function stopPattern() {
if (!currentSeq) return
for (const t of currentSeq.timeouts) clearTimeout(t)
for (const h of currentSeq.handles) h.stop()
currentSeq = null
}
function playPattern(realized) {
stopPattern()
stopAll() // never layer over a VoicingBrowser (or any other) preview
const beatMs = 60000 / PREVIEW_BPM
const hasBeats = realized.every((n) => Number.isFinite(n.beat))
// Beats drive onsets when authored; otherwise even eighths.
const times = realized.map((n, i) => (hasBeats ? (n.beat - 1) * beatMs : (i * beatMs) / 2))
const seq = { timeouts: [], handles: [] }
realized.forEach((n, i) => {
// Ring until the next distinct onset (equal beats = a dyad, same onset);
// the last note gets one beat. Small floor so ghost-short gaps still sound.
const nextT = times.slice(i + 1).find((t) => t > times[i])
const durMs = Math.max(160, (nextT !== undefined ? nextT - times[i] : beatMs) + 120)
seq.timeouts.push(
setTimeout(() => {
// abs 20: open E1 in chordAudio's 0 = C3 note space (negatives legal).
seq.handles.push(playVoicing([n.abs - 20], { strumMs: 0, durMs, gain: 0.5 }))
}, times[i]),
)
})
currentSeq = seq
}
// ─── SVG geometry (LickCard's idiom, 4 strings) ───────────────────────────────
const STR_GAP = 13
const PAD_T = 14
const PAD_B = 6
const PAD_L = 20
const PAD_R = 12
const COL_W = 26
const BEAT_ROW = 10 // extra bottom room for beat numbers when beats render
function layoutPattern(realized) {
const hasBeats =
realized.every((n) => Number.isFinite(n.beat)) &&
realized.every((n, i) => i === 0 || n.beat >= realized[i - 1].beat)
let xs, width, maxBeat, unit = null
if (hasBeats) {
// Columns proportional to beat; scale so the tightest gap ≥ one column.
const gaps = realized
.map((n, i) => (i > 0 ? n.beat - realized[i - 1].beat : 0))
.filter((g) => g > 0)
const minGap = gaps.length ? Math.min(...gaps) : 1
unit = Math.min(COL_W / minGap, COL_W * 4)
xs = realized.map((n) => PAD_L + (n.beat - 1) * unit + 10)
maxBeat = realized[realized.length - 1].beat
width = PAD_L + (maxBeat - 1) * unit + 20 + PAD_R
} else {
xs = realized.map((_, i) => PAD_L + i * COL_W + COL_W / 2)
width = PAD_L + realized.length * COL_W + PAD_R
maxBeat = null
}
return {
hasBeats,
maxBeat,
unit,
width,
height: PAD_T + 3 * STR_GAP + PAD_B + (hasBeats ? BEAT_ROW : 0),
notes: realized.map((n, i) => ({
...n,
x: xs[i],
y: PAD_T + (n.string - 1) * STR_GAP,
ghost: n.technique === 'ghost-note',
label: n.technique === 'ghost-note' ? `(${n.fret})` : String(n.fret),
})),
}
}
function PatternSvg({ layout, ariaLabel }) {
const { notes, width, height, hasBeats, maxBeat, unit } = layout
const bottomY = PAD_T + 3 * STR_GAP
return (
<svg
viewBox={`0 0 ${width} ${height}`}
width="100%"
style={{ display: 'block', height: 'auto', maxWidth: width * 1.4 }}
role="img"
aria-label={ariaLabel}
>
{/* String lines — string 1 (G) on top, string 4 (low E) at the bottom. */}
{STRINGS.map((s, i) => {
const y = PAD_T + i * STR_GAP
return (
<g key={s.name}>
<line
x1={PAD_L - 6} y1={y} x2={width - PAD_R + 6} y2={y}
stroke={STRING_LINE} strokeWidth={i === 3 ? 1.4 : 1}
/>
<text x={7} y={y + 3} textAnchor="middle" fontSize={7} fill={STRING_LABEL}>
{s.name}
</text>
</g>
)
})}
{/* Beat numbers under the bottom string (only when beats are authored;
x mirrors the note columns: beat 1 at PAD_L + 10, `unit` px per beat). */}
{hasBeats &&
Array.from({ length: Math.floor(maxBeat + 1e-6) }, (_, b) => (
<text
key={`b${b}`}
x={PAD_L + b * unit + 10}
y={bottomY + BEAT_ROW}
textAnchor="middle" fontSize={6.5} fill={BEAT_LABEL}
>
{b + 1}
</text>
))}
{/* Technique marks (light lick vocabulary) above their notes. */}
{notes.map((n, i) =>
TECH_MARK[n.technique] ? (
<text
key={`t${i}`} x={n.x} y={n.y - 8} textAnchor="middle" fontSize={8}
fontStyle="italic" fill={AMBER}
>
{TECH_MARK[n.technique]}
</text>
) : null,
)}
{/* Fret numbers on surface pills; approach notes amber (next chord's). */}
{notes.map((n, i) => {
const w = n.label.length * 5.2 + 3
const isLast = i === notes.length - 1
return (
<g key={`n${i}`}>
<rect x={n.x - w / 2} y={n.y - 5.5} width={w} height={11} rx={2} fill={CARD_BG} />
<text
x={n.x} y={n.y + 3.2} textAnchor="middle" fontSize={9.5} fontWeight="600"
fill={n.approach ? AMBER : n.ghost ? GHOST_TEXT : FRET_TEXT}
>
{n.label}
</text>
{/* The final approach points at the next chord. */}
{n.approach && isLast && (
<text x={n.x + w / 2 + 5} y={n.y + 3} textAnchor="middle" fontSize={8} fill={AMBER}>
</text>
)}
</g>
)
})}
</svg>
)
}
// ─── The card ─────────────────────────────────────────────────────────────────
// Same ▶ pill as VoicingBrowser's gallery cells (its PlayButton is file-local;
// classes mirrored so the two galleries read identically).
function PlayButton({ ariaLabel, onClick }) {
return (
<button
type="button"
aria-label={ariaLabel}
onClick={onClick}
className={
'inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full border border-accent ' +
'bg-surface px-2.5 text-xs font-semibold text-accent outline-none transition ' +
'hover:bg-accent hover:text-black focus-visible:ring-2 focus-visible:ring-accent'
}
>
<svg aria-hidden="true" viewBox="0 0 12 12" className="h-3 w-3 fill-current">
<path d="M2.5 1.5v9l8-4.5z" />
</svg>
Play
</button>
)
}
/**
* <BassPatternCard rootPc quality nextRootPc pattern playLabel feel note chordLabel />
*
* Pure/presentational gallery cell for one station of one bass play. Renders
* the realized 4-string tab + the authored per-station note + its own ▶.
* Malformed/unplaceable patterns render an honest placeholder, never crash.
*/
export default function BassPatternCard({
rootPc,
quality,
nextRootPc,
pattern,
playLabel,
feel,
note,
chordLabel,
}) {
const realized = realizeBassPattern(pattern, rootPc, quality, nextRootPc)
// Unmount (loop/style/instrument change) silences any running sequence —
// module-level state, so this is idempotent across sibling cards.
useEffect(() => () => stopPattern(), [])
if (!realized) {
return (
<div
role="group"
aria-label={`${playLabel ?? 'bass pattern'} — unavailable`}
className="flex min-h-[72px] min-w-[140px] flex-col items-center justify-center rounded-md border border-dashed border-border p-2 text-gray-500"
>
<span className="text-lg leading-none" aria-hidden="true"></span>
<span className="mt-1 text-[10px]">pattern unavailable</span>
</div>
)
}
const layout = layoutPattern(realized)
const pitchNames = realized.map((n) => absName(n.abs)).join(', ')
const label = playLabel ?? 'Bass pattern'
return (
<figure className="flex w-[220px] min-w-0 shrink-0 flex-col gap-1.5 rounded-md border border-border bg-surface p-2">
<figcaption
className="text-[11px] font-medium leading-tight text-gray-300"
title={feel ?? undefined}
>
{label}
</figcaption>
<div className="max-w-full overflow-x-auto">
<PatternSvg
layout={layout}
ariaLabel={`Bass tab for ${chordLabel ?? 'this chord'}${label}: ${pitchNames}`}
/>
</div>
{note && <p className="text-[10px] leading-snug text-gray-500">{note}</p>}
<PlayButton
ariaLabel={`Play ${chordLabel ?? 'chord'} bass pattern — ${label}`}
onClick={() => playPattern(realized)}
/>
</figure>
)
}
+52 -26
View File
@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react'
import ChordBox from './ChordBox'
import MiniPiano from './MiniPiano'
import VoicingBrowser from './VoicingBrowser'
import { getGuitarVoicings, getPianoTechniques, parseChord } from '../lib/voicings'
import { CHORD_TYPES, NOTES, getChordsInKey, toRomanNumeral, getSuggestedProgressions } from '../lib/theory'
import { FAMOUS_PROGRESSIONS, progressionInKey, getChordSubstitutions, CHORD_PLAYBOOK } from '../lib/education'
@@ -29,36 +30,50 @@ function chordDisplayName(root, typeKey) {
}
function GuitarTab({ chordName }) {
// parseChord's `type` is a CHORD_TYPES key — exactly VoicingBrowser's
// `quality` prop (same mapping PianoTab/ExploreTab already rely on). L-21.
const parsed = parseChord(chordName)
const voicings = getGuitarVoicings(chordName)
if (!voicings.length) {
if (!parsed && !voicings.length) {
return <p className="text-gray-500 text-sm text-center py-8">No guitar voicings found for {chordName}.</p>
}
return (
<div>
<p className="text-xs text-gray-500 mb-4">
Click any voicing to learn it. Purple = chord tones. Finger numbers inside dots (1=index, 4=pinky).
Barre chords show the fret number on the left.
</p>
<div className="flex flex-wrap gap-6 justify-start">
{voicings.map((v, i) => (
<div key={i} className="flex flex-col items-center gap-1 p-3 rounded-xl bg-surface border border-border hover:border-accent/40 transition-colors">
<ChordBox
frets={v.frets}
fingers={v.fingers}
barre={v.barre}
baseFret={v.baseFret}
/>
<p className="text-[11px] text-gray-400 text-center mt-1 max-w-[120px] leading-tight">{v.label}</p>
<div className="flex flex-col gap-5">
{/* Playable voicing browser (D-21) — browse + audition shapes.
Instrument-scoped to this tab via `show` (task L-25). */}
{parsed && <VoicingBrowser rootPc={parsed.rootPc} quality={parsed.type} show="guitar" />}
{/* Static grid kept as the fingering reference — it carries finger
numbers and barre info the browser doesn't show. */}
{voicings.length > 0 && (
<div>
<p className="text-[11px] uppercase tracking-wider text-gray-600 mb-2">More grips fingering reference</p>
<p className="text-xs text-gray-500 mb-4">
Click any voicing to learn it. Purple = chord tones. Finger numbers inside dots (1=index, 4=pinky).
Barre chords show the fret number on the left.
</p>
<div className="flex flex-wrap gap-6 justify-start">
{voicings.map((v, i) => (
<div key={i} className="flex flex-col items-center gap-1 p-3 rounded-xl bg-surface border border-border hover:border-accent/40 transition-colors">
<ChordBox
frets={v.frets}
fingers={v.fingers}
barre={v.barre}
baseFret={v.baseFret}
/>
<p className="text-[11px] text-gray-400 text-center mt-1 max-w-[120px] leading-tight">{v.label}</p>
</div>
))}
</div>
))}
</div>
<div className="mt-4 p-3 rounded-lg bg-surface border border-border">
<p className="text-xs text-gray-500">
<span className="text-accent font-semibold">Pro tip:</span> Learn the E-shape and A-shape barres first
they cover all 12 roots. Then add open voicings for the keys you play in most.
High-fret voicings (above fret 7) work great as jazz comping shapes in a band mix.
</p>
</div>
<div className="mt-4 p-3 rounded-lg bg-surface border border-border">
<p className="text-xs text-gray-500">
<span className="text-accent font-semibold">Pro tip:</span> Learn the E-shape and A-shape barres first
they cover all 12 roots. Then add open voicings for the keys you play in most.
High-fret voicings (above fret 7) work great as jazz comping shapes in a band mix.
</p>
</div>
</div>
)}
</div>
)
}
@@ -68,17 +83,28 @@ function PianoTab({ chordName }) {
const techniques = getPianoTechniques(chordName)
const rootPc = parsed?.rootPc ?? 0
if (!techniques.length) {
if (!parsed && !techniques.length) {
return <p className="text-gray-500 text-sm text-center py-8">No piano techniques for {chordName}.</p>
}
return (
<div className="flex flex-col gap-4">
{/* Playable voicing browser (D-21) — parseChord's `type` maps 1:1 to the
browser's `quality` (CHORD_TYPES key). L-21. Piano-scoped via `show` (L-25). */}
{parsed && <VoicingBrowser rootPc={parsed.rootPc} quality={parsed.type} show="piano" />}
{/* Technique cards kept below — the name/desc/tip text and LH/RH note
breakdown are not covered by the browser. */}
{techniques.length > 0 && (
<p className="text-[11px] uppercase tracking-wider text-gray-600 mt-1">Techniques how to use it at the keys</p>
)}
{techniques.length > 0 && (
<p className="text-xs text-gray-500">
<span className="text-blue-400 font-semibold">Blue = Left hand</span> &nbsp;·&nbsp;
<span className="text-accent font-semibold">Purple = Right hand</span> &nbsp;·&nbsp;
R marks the root.
</p>
)}
{techniques.map((t, i) => (
<div key={i} className="p-4 rounded-xl bg-surface border border-border hover:border-accent/30 transition-colors">
<div className="flex flex-col lg:flex-row gap-4 items-start">
+391
View File
@@ -0,0 +1,391 @@
// CircleOfFifths — the Knowledge Center's live key map (task D-61).
//
// A read-only SVG circle of fifths for a jamming musician, not a textbook
// poster:
//
// · Outer ring: the 12 major keys, C at 12 o'clock, fifths clockwise.
// Each wedge carries its key-signature glyph (♮ / n♯ / n♭).
// · Inner ring: the relative minors, aligned with their majors.
// · LIVE: the detected/locked key (keyInfo = App's effectiveKey, flowing
// through KnowledgeDock → ExploreSection) lights its wedge in accent; its
// fifths neighbours (subdominant, dominant) and its relative get a soft
// accent tier — the "safe keys to wander to" story with zero interaction.
// Modal keys pick their ring by the mode's third (dorian/phrygian → the
// minor ring), derived from theory.js SCALES — never re-derived here.
// · The highlighted key's diatonic chords (theory.js getChordsInKey) are
// listed beside the circle inline — no hover, no click required.
// · OPTIONAL tap: any wedge previews that key's diatonics in the side panel
// (dashed outline marks the previewed wedge; the live highlight never
// moves). Tapping NEVER changes app key state — this surface is read-only.
// · No key detected → neutral circle with honest microcopy.
//
// Purely presentational: props in ({ keyInfo, onChordClick }), nothing out.
// Keyboard: every wedge is a focusable button (Enter/Space previews); focus
// draws an explicit accent-soft stroke (SVG-safe — no reliance on box-shadow).
//
// Design tokens (tailwind.config.js) — literal here because SVG paint
// attributes can't read Tailwind classes (MiniPiano/Fretboard precedent):
// accent #a855f7, surface #0f0f0f, panel #1a1a1a, border #2a2a2a. No new
// colours: #c084fc is MiniPiano's established soft accent; greys are the
// Tailwind gray-300/400 already used across the app's SVGs.
import { useMemo, useState } from 'react'
import { NOTES, SCALES, getChordsInKey, toRomanNumeral } from '../lib/theory'
import { parseChord } from '../lib/voicings'
// ─── Token literals (SVG paint attrs; see header) ─────────────────────────────
const ACCENT = '#a855f7' // bg-accent — the live key wedge
const ACCENT_SOFT = '#c084fc' // MiniPiano's soft accent — neighbour-tier text
const SURFACE = '#0f0f0f' // bg-surface — wedge gaps + text on accent (AA 4.84:1)
const PANEL = '#1a1a1a' // bg-panel — idle wedge fill
const BORDER = '#2a2a2a' // border-border — centre hub stroke
const TEXT_MAIN = '#d1d5db' // gray-300 — idle key names (11.4:1 on panel)
const TEXT_DIM = '#9ca3af' // gray-400 — signature glyphs, microcopy (6.4:1)
// ─── The circle, index 0 = 12 o'clock, fifths clockwise ───────────────────────
// Display spelling is the conventional poster mix (flats on the flat side);
// all LOGIC runs on pitch classes so detection's sharp spellings match fine.
const MAJOR_LABELS = ['C','G','D','A','E','B','F♯','D♭','A♭','E♭','B♭','F']
const MINOR_LABELS = ['Am','Em','Bm','F♯m','C♯m','G♯m','E♭m','B♭m','Fm','Cm','Gm','Dm']
const SIG_GLYPHS = ['♮','1♯','2♯','3♯','4♯','5♯','6♯','5♭','4♭','3♭','2♭','1♭']
const majorPcAt = (i) => (i * 7) % 12 // wedge index → major tonic pc
const minorPcAt = (i) => (i * 7 + 9) % 12 // wedge index → relative minor pc
const majorIdxOf = (pc) => (pc * 7) % 12 // 7·7 ≡ 1 (mod 12): self-inverse
const minorIdxOf = (pc) => majorIdxOf((pc + 3) % 12)
const sigWords = (i) =>
i === 0 ? 'no sharps or flats' : i <= 6 ? `${i} sharp${i > 1 ? 's' : ''}` : `${12 - i} flat${12 - i > 1 ? 's' : ''}`
// The MODE's parent major: the unique major scale whose pc-set equals the
// mode's pc-set — ITS signature is the mode's true signature (A dorian =
// G major's notes = 1♯, not A major's 3♯, and not the tonic wedge's glyph).
// Uniqueness proof: the diatonic pc-set has no transpositional symmetry, so
// its 12 transpositions are 12 DISTINCT 7-note sets — a given 7-note set can
// therefore equal AT MOST one of them. Every key-dropdown mode (major, minor,
// dorian, phrygian, lydian, mixolydian) is by definition a rotation of the
// diatonic set, so for all 6 modes × 12 roots exactly one parent major exists
// (existence: rotating the mode back to its parent). Non-heptatonic scales
// (pentatonics, blues) match none — we return null and the hub omits the
// signature line rather than guessing.
function parentMajorPc(tonicPc, scale) {
const pcs = new Set(scale.map((s) => (tonicPc + s) % 12))
if (pcs.size !== 7) return null
const hits = []
for (let p = 0; p < 12; p++) {
if (SCALES.major.every((s) => pcs.has((p + s) % 12))) hits.push(p)
}
return hits.length === 1 ? hits[0] : null
}
// ─── Geometry (viewBox 0 0 300 300, centre 150) ───────────────────────────────
const CX = 150, CY = 150
const R_OUT = 142, R_MID = 96, R_IN = 58, R_HUB = 54
function pt(r, deg) {
const t = (deg * Math.PI) / 180 // 0° = 12 o'clock, clockwise
return `${(CX + r * Math.sin(t)).toFixed(2)},${(CY - r * Math.cos(t)).toFixed(2)}`
}
function wedgePath(i, r0, r1) {
const a0 = i * 30 - 15, a1 = i * 30 + 15
return `M ${pt(r1, a0)} A ${r1},${r1} 0 0 1 ${pt(r1, a1)} L ${pt(r0, a1)} A ${r0},${r0} 0 0 0 ${pt(r0, a0)} Z`
}
function labelXY(i, r) {
const t = (i * 30 * Math.PI) / 180
return { x: CX + r * Math.sin(t), y: CY - r * Math.cos(t) }
}
// ─── Diatonic chord chips (inline — the core, zero-click payload) ─────────────
function ChordChips({ root, mode, onChordClick }) {
const chords = getChordsInKey(root, mode)
if (!chords.length) return null
return (
<div className="flex flex-wrap gap-1.5">
{chords.map((c) => {
const rn = toRomanNumeral(c, root, mode)
const inner = (
<>
<span>{c}</span>
{rn && rn !== '?' && (
<span className="text-[9px] font-normal opacity-60 leading-none mt-0.5">{rn}</span>
)}
</>
)
return onChordClick ? (
<button
key={c} type="button" onClick={() => onChordClick(c)}
title={`Open ${c} voicings`}
className="flex flex-col items-center px-2.5 py-1 rounded-lg border text-xs font-bold bg-panel border-border text-gray-300 transition-all outline-none hover:border-accent/50 hover:text-accent focus-visible:ring-2 focus-visible:ring-accent"
>
{inner}
</button>
) : (
<span key={c} className="flex flex-col items-center px-2.5 py-1 rounded-lg border text-xs font-bold bg-panel border-border text-gray-300">
{inner}
</span>
)
})}
</div>
)
}
// ─── The component ────────────────────────────────────────────────────────────
export default function CircleOfFifths({ keyInfo, onChordClick }) {
const [preview, setPreview] = useState(null) // { ring, idx } | null — local only
const [hot, setHot] = useState(null) // 'ring-idx' hovered/focused wedge
// Live key → ring + wedge index. Ring by the MODE'S THIRD (SCALES, theory.js):
// minor/dorian/phrygian sit on the minor ring at their tonic — A minor (or
// A dorian) lights the inner "Am" wedge, NOT outer C.
const live = useMemo(() => {
if (!keyInfo?.root) return null
const pc = parseChord(keyInfo.root)?.rootPc
if (pc == null) return null
const mode = keyInfo.mode ?? 'major'
const scale = SCALES[mode] ?? SCALES.major
// Minor third AND no major third — a bare scale[2] === 3 check would
// misfile the hexatonic blues scale [0,3,5,6,7,10] (carries both colours)
// if it ever reached the key dropdown.
const minorish = scale.includes(3) && !scale.includes(4)
const parentPc = parentMajorPc(pc, scale)
return {
pc, mode,
ring: minorish ? 'minor' : 'major',
idx: minorish ? minorIdxOf(pc) : majorIdxOf(pc),
// circle position of the mode's PARENT MAJOR → the true signature glyph
sigIdx: parentPc == null ? null : majorIdxOf(parentPc),
}
}, [keyInfo])
// Tier per wedge: 2 = the live key (accent), 1 = its safe neighbours
// (subdominant · dominant on the same ring, relative on the other), 0 = idle.
function tierOf(ring, idx) {
if (!live) return 0
if (live.ring === ring) {
if (idx === live.idx) return 2
if (idx === (live.idx + 1) % 12 || idx === (live.idx + 11) % 12) return 1
return 0
}
return idx === live.idx ? 1 : 0
}
const isLiveWedge = (ring, idx) => live && live.ring === ring && live.idx === idx
function tapWedge(ring, idx) {
if (isLiveWedge(ring, idx)) { setPreview(null); return } // tapping home = back to live
setPreview((p) => (p && p.ring === ring && p.idx === idx ? null : { ring, idx }))
}
// Build both rings' wedges; paint order = idle → neighbours → live → preview
// → hot, so highlight strokes always win the shared edges.
const wedges = []
for (const ring of ['major', 'minor']) {
const outer = ring === 'major'
for (let idx = 0; idx < 12; idx++) {
const tier = tierOf(ring, idx)
const previewed = preview && preview.ring === ring && preview.idx === idx
const id = `${ring}-${idx}`
const name = outer ? MAJOR_LABELS[idx] : MINOR_LABELS[idx]
const aria = outer
? `${name} major, ${sigWords(idx)}${tier === 2 ? ' — the live key' : ''}. Preview its chords.`
: `${MINOR_LABELS[idx].replace(/m$/, '')} minor, relative of ${MAJOR_LABELS[idx]} major${tier === 2 ? ' — the live key' : ''}. Preview its chords.`
wedges.push({
ring, idx, id, tier, previewed, outer, aria,
z: hot === id ? 5 : previewed ? 4 : tier + 1,
})
}
}
wedges.sort((a, b) => a.z - b.z)
// Side panel: the previewed key wins the panel; the LIVE view stays complete
// without any tap (live highlight + its chords render by default).
// Preview title is spelled SHARP-side from NOTES, matching its chips:
// getChordsInKey emits the app-wide sharp spelling (theory.js noteName), and
// those names flow into onChordClick → ChordDetailModal, so re-spelling the
// chips flat would add a divergent naming layer in front of the modal. One
// spelling authority (NOTES) for title + chips + modal; the WEDGE keeps its
// poster label (E♭) for at-a-glance reading.
let shown = null
if (preview) {
const root = NOTES[preview.ring === 'major' ? majorPcAt(preview.idx) : minorPcAt(preview.idx)]
const mode = preview.ring === 'major' ? 'major' : 'minor'
shown = { root, mode, title: `${root} ${mode}`, isPreview: true }
} else if (live) {
shown = { root: keyInfo.root, mode: live.mode, title: `${keyInfo.root} ${live.mode}`, isPreview: false }
}
// Neighbour names for the live key (the tier-1 wedges, spelled out).
const neighbours = live && {
sub: (live.ring === 'major' ? MAJOR_LABELS : MINOR_LABELS)[(live.idx + 11) % 12],
dom: (live.ring === 'major' ? MAJOR_LABELS : MINOR_LABELS)[(live.idx + 1) % 12],
rel: (live.ring === 'major' ? MINOR_LABELS : MAJOR_LABELS)[live.idx],
relWord: live.ring === 'major' ? 'relative minor' : 'relative major',
}
return (
<section
aria-label="Circle of fifths"
className="p-3 bg-surface border border-border rounded-xl flex flex-wrap gap-x-5 gap-y-3 items-start"
>
{/* ── The circle ── */}
<svg
viewBox="0 0 300 300"
role="group"
aria-label={live
? `Circle of fifths, live key ${keyInfo.root} ${live.mode}`
: 'Circle of fifths, no key detected yet'}
className="w-[248px] max-w-full h-auto shrink-0 mx-auto select-none"
>
{/* wedges (paint-ordered) */}
{wedges.map((w) => {
const [r0, r1] = w.outer ? [R_MID, R_OUT] : [R_IN, R_MID]
const stroke = hot === w.id ? ACCENT_SOFT : w.previewed ? ACCENT : SURFACE
return (
<path
key={w.id}
d={wedgePath(w.idx, r0, r1)}
fill={w.tier === 0 ? PANEL : ACCENT}
fillOpacity={w.tier === 1 ? 0.22 : 1}
stroke={stroke}
strokeWidth={hot === w.id || w.previewed ? 2 : 1.25}
strokeDasharray={w.previewed && hot !== w.id ? '4 3' : undefined}
role="button"
tabIndex={0}
aria-label={w.aria}
aria-pressed={!!w.previewed}
className="cursor-pointer outline-none"
onClick={() => tapWedge(w.ring, w.idx)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); tapWedge(w.ring, w.idx) }
}}
onPointerEnter={() => setHot(w.id)}
onPointerLeave={() => setHot((h) => (h === w.id ? null : h))}
onFocus={() => setHot(w.id)}
onBlur={() => setHot((h) => (h === w.id ? null : h))}
/>
)
})}
{/* labels (own layer, never swallow clicks) */}
{Array.from({ length: 12 }, (_, i) => {
const tMaj = tierOf('major', i), tMin = tierOf('minor', i)
const name = labelXY(i, 123)
const glyph = labelXY(i, 106)
const minor = labelXY(i, 77)
return (
<g key={i} pointerEvents="none">
<text x={name.x} y={name.y} textAnchor="middle" dominantBaseline="middle"
fontSize="13" fontWeight="700"
fill={tMaj === 2 ? SURFACE : tMaj === 1 ? ACCENT_SOFT : TEXT_MAIN}>
{MAJOR_LABELS[i]}
</text>
<text x={glyph.x} y={glyph.y} textAnchor="middle" dominantBaseline="middle"
fontSize="8.5"
fill={tMaj === 2 ? SURFACE : tMaj === 1 ? ACCENT_SOFT : TEXT_DIM}>
{SIG_GLYPHS[i]}
</text>
<text x={minor.x} y={minor.y} textAnchor="middle" dominantBaseline="middle"
fontSize="11" fontWeight={tMin === 2 ? '700' : '600'}
fill={tMin === 2 ? SURFACE : tMin === 1 ? ACCENT_SOFT : TEXT_DIM}>
{MINOR_LABELS[i]}
</text>
</g>
)
})}
{/* centre hub — always the LIVE state (the glance anchor) */}
<circle cx={CX} cy={CY} r={R_HUB} fill={SURFACE} stroke={BORDER} strokeWidth="1" />
{live ? (
<g pointerEvents="none">
<text x={CX} y={CY - 10} textAnchor="middle" fontSize="14" fontWeight="800" fill={ACCENT}>
{keyInfo.root} {live.mode}
</text>
{/* The MODE's signature (parent major), not the wedge's — A dorian
reads "1♯ · G major's notes", matching the F♯ in its chips. */}
{live.sigIdx != null && (
<text x={CX} y={CY + 6} textAnchor="middle" fontSize="8.5" fill={TEXT_DIM}>
{SIG_GLYPHS[live.sigIdx]} · {live.mode === 'major'
? sigWords(live.sigIdx)
: `${MAJOR_LABELS[live.sigIdx]} major's notes`}
</text>
)}
<text x={CX} y={CY + 21} textAnchor="middle" fontSize="8" fontWeight="700"
letterSpacing="1.5" fill={ACCENT_SOFT}>
LIVE
</text>
</g>
) : (
<g pointerEvents="none">
<text x={CX} y={CY - 8} textAnchor="middle" fontSize="11" fontWeight="700" fill={TEXT_MAIN}>
No key yet
</text>
<text x={CX} y={CY + 7} textAnchor="middle" fontSize="8.5" fill={TEXT_DIM}>
play a few chords
</text>
<text x={CX} y={CY + 18} textAnchor="middle" fontSize="8.5" fill={TEXT_DIM}>
the circle lights up
</text>
</g>
)}
</svg>
{/* ── Beside the circle: the highlighted key's diatonics, inline ── */}
<div className="flex-1 min-w-[220px] flex flex-col gap-2.5">
<h4 className="text-[10px] font-semibold uppercase tracking-widest text-gray-500">
Circle of fifths
</h4>
{shown ? (
<>
<div className="flex items-center flex-wrap gap-2">
<span className="font-bold text-white text-sm">{shown.title}</span>
{shown.isPreview ? (
<>
<span className="text-[9px] uppercase tracking-wide font-semibold text-amber border border-amber/40 rounded px-1.5 py-px">
preview
</span>
<button
type="button"
onClick={() => setPreview(null)}
className="text-[11px] text-accent underline underline-offset-2 outline-none hover:text-white focus-visible:ring-2 focus-visible:ring-accent rounded"
>
back to live
</button>
</>
) : (
<span className="text-[9px] uppercase tracking-wide font-semibold text-accent border border-accent/40 rounded px-1.5 py-px">
live
</span>
)}
</div>
<ChordChips root={shown.root} mode={shown.mode} onChordClick={onChordClick} />
{!shown.isPreview && neighbours && (
<p className="text-[11px] text-gray-400">
Safe keys to wander to:{' '}
<span className="text-accent font-semibold">{neighbours.sub}</span> (subdominant) ·{' '}
<span className="text-accent font-semibold">{neighbours.dom}</span> (dominant) ·{' '}
<span className="text-accent font-semibold">{neighbours.rel}</span> ({neighbours.relWord})
</p>
)}
</>
) : (
<p className="text-sm text-gray-400">
When a key is detected (or locked), its wedge lights up here with the chords that
live in it. Tap any wedge to peek at another key meanwhile.
</p>
)}
<p className="text-xs text-gray-400 leading-snug">
Keys next to each other on the circle share six of their seven notes, so sliding one
step clockwise to the dominant, counter-clockwise to the subdominant barely moves
the ground under the band. The inner ring is each key&apos;s relative minor: the same
notes with a darker home base. The further apart two keys sit, the bolder the jump sounds.
</p>
</div>
</section>
)
}
+291 -76
View File
@@ -1,6 +1,25 @@
import { useState } from 'react'
// ExplorePanel — refactored into Knowledge Center parts (task L-22, per
// docs/design/knowledge-center.md §7 step 1).
//
// This file now exports the named building blocks the Knowledge Center shell
// (JamGuide.jsx) composes:
//
// <LevelChips levels onToggle/> — the shared foundation/intermediate filter
// <ChordPickerToolbar …/> — controlled root × quality picker row
// <ExploreSection …/> — KB progression browser + famous progressions
// <VoicingsSection …/> — picker (follows the live chord) → VoicingBrowser
//
// The default export remains a thin standalone composition of the parts (the
// panel is verified-orphaned — no importer — so it exists only so the file
// stays a complete, mountable component). GuitarGrid/PianoGrid are kept as
// exported no-audio fallbacks per the D-20 IA map (§2).
import { useEffect, useMemo, useState } from 'react'
import ChordBox from './ChordBox'
import CircleOfFifths from './CircleOfFifths'
import MiniPiano from './MiniPiano'
import VoicingBrowser from './VoicingBrowser'
import kb from '../data/kb/index.js'
import { getGuitarVoicings, getPianoTechniques, parseChord } from '../lib/voicings'
import { CHORD_TYPES, NOTES, getChordsInKey, toRomanNumeral } from '../lib/theory'
import { FAMOUS_PROGRESSIONS, progressionInKey } from '../lib/education'
@@ -24,6 +43,66 @@ const CHORD_TYPE_OPTIONS = [
const MAJOR_TYPES = new Set(['maj','maj7','maj6','add9','sus4','sus2','aug','dom7'])
// Progressions/licks without a `level` count as foundation (D-20 §4).
const levelOf = (item) => (item?.level === 'intermediate' ? 'intermediate' : 'foundation')
// ─── Level filter chips (shared by Explore + Licks toolbars) ──────────────────
// Two toggle chips, both on by default. The SHELL owns the `levels` state
// ({foundation, intermediate}) and enforces "both can't be off"; the chip for
// the last active level advertises the no-op via its title.
export function LevelChips({ levels = {}, onToggle }) {
const defs = [
{ key: 'foundation', label: 'Foundation' },
{ key: 'intermediate', label: 'Intermediate' },
]
return (
<div className="flex items-center gap-1" role="group" aria-label="Level filter">
{defs.map(d => {
const active = !!levels[d.key]
const lastActive = active && !defs.some(o => o.key !== d.key && levels[o.key])
return (
<button
key={d.key}
type="button"
aria-pressed={active}
onClick={() => onToggle?.(d.key)}
title={lastActive
? 'At least one level stays on'
: `${active ? 'Hide' : 'Show'} ${d.label.toLowerCase()} material`}
className={`min-h-[32px] px-2.5 py-1 rounded-lg border text-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent ${
active
? 'bg-accent/20 border-accent text-accent font-semibold'
: 'bg-surface border-border text-gray-400 hover:text-gray-200 hover:border-gray-500'
}`}
>
{d.label}
</button>
)
})}
</div>
)
}
// Level badge on cards — mirrors LickCard's badge treatment (amber = the
// existing secondary-tone token; foundation stays quiet).
function LevelBadge({ level }) {
if (level === 'intermediate') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-amber border border-amber/40 rounded px-1.5 py-px">
intermediate
</span>
)
}
if (level === 'foundation') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-gray-400 border border-border rounded px-1.5 py-px">
foundation
</span>
)
}
return null
}
// ─── Quick-pick chip row ──────────────────────────────────────────────────────
function ChipRow({ label, chords, active, keyInfo, onSelect }) {
if (!chords?.length) return null
@@ -35,7 +114,7 @@ function ChipRow({ label, chords, active, keyInfo, onSelect }) {
const rn = keyInfo?.root ? toRomanNumeral(chord, keyInfo.root, keyInfo.mode) : ''
return (
<button key={chord} onClick={() => onSelect(chord)}
className={`flex flex-col items-center px-2.5 py-1 rounded-lg border text-xs font-bold transition-all ${
className={`flex flex-col items-center px-2.5 py-1 rounded-lg border text-xs font-bold transition-all outline-none focus-visible:ring-2 focus-visible:ring-accent ${
active === chord
? 'bg-accent border-accent text-white'
: 'bg-surface border-border text-gray-300 hover:border-accent/50 hover:text-accent'
@@ -50,8 +129,38 @@ function ChipRow({ label, chords, active, keyInfo, onSelect }) {
)
}
// ─── Guitar voicings grid ─────────────────────────────────────────────────────
function GuitarGrid({ chordName }) {
// ─── Chord picker toolbar (controlled: root × quality) ───────────────────────
export function ChordPickerToolbar({ root, typeKey, onRootChange, onTypeChange }) {
const chordName = root + (CHORD_TYPES[typeKey]?.suffix ?? '')
return (
<div className="flex flex-wrap gap-2 items-center p-3 bg-surface border border-border rounded-xl">
<div className="flex flex-wrap gap-1">
{NOTES.map(n => (
<button key={n} type="button" onClick={() => onRootChange?.(n)}
aria-pressed={root === n}
className={`px-2 py-0.5 rounded text-xs font-bold transition-all outline-none focus-visible:ring-2 focus-visible:ring-accent ${
root === n ? 'bg-accent text-white' : 'bg-border text-gray-400 hover:text-white'
}`}>
{n}
</button>
))}
</div>
<div className="w-px h-5 bg-border shrink-0" />
<div className="relative">
<select value={typeKey} onChange={e => onTypeChange?.(e.target.value)}
aria-label="Chord quality"
className="appearance-none bg-panel border border-border rounded-lg pl-2 pr-6 py-1 text-xs text-gray-200 cursor-pointer focus:outline-none focus:border-accent">
{CHORD_TYPE_OPTIONS.map(o => <option key={o.key} value={o.key}>{o.label}</option>)}
</select>
<span className="pointer-events-none absolute right-1.5 top-1/2 -translate-y-1/2 text-gray-500 text-xs"></span>
</div>
<div className="text-2xl font-black text-accent ml-2">{chordName}</div>
</div>
)
}
// ─── Guitar voicings grid (no-audio fallback; superseded by VoicingBrowser) ──
export function GuitarGrid({ chordName }) {
const voicings = getGuitarVoicings(chordName)
if (!voicings.length) return <p className="text-gray-600 text-sm py-4">No voicings for {chordName}.</p>
return (
@@ -71,8 +180,8 @@ function GuitarGrid({ chordName }) {
)
}
// ─── Piano techniques grid ───────────────────────────────────────────────────
function PianoGrid({ chordName }) {
// ─── Piano techniques grid (no-audio fallback; superseded by VoicingBrowser)
export function PianoGrid({ chordName }) {
const parsed = parseChord(chordName)
const techniques = getPianoTechniques(chordName)
const rootPc = parsed?.rootPc ?? 0
@@ -98,6 +207,8 @@ function PianoGrid({ chordName }) {
}
// ─── Famous progressions using this chord as tonic ───────────────────────────
// NOTE (D-20 §4, recorded Maestro call): FAMOUS_PROGRESSIONS carries no `level`
// field — these cards show no badge and are EXEMPT from the level filter.
function ProgressionCards({ chordName, onChordClick }) {
const parsed = parseChord(chordName)
if (!parsed) return null
@@ -131,7 +242,7 @@ function ProgressionCards({ chordName, onChordClick }) {
{chordsHere.map((c, i) => (
<span key={i} className="flex items-center gap-1">
<button onClick={() => onChordClick?.(c)}
className={`px-2.5 py-1 rounded-lg font-bold text-sm border transition-all ${
className={`px-2.5 py-1 rounded-lg font-bold text-sm border transition-all outline-none focus-visible:ring-2 focus-visible:ring-accent ${
i === 0
? 'bg-accent border-accent text-white'
: 'bg-panel border-border text-gray-200 hover:border-accent/50 hover:text-accent'
@@ -153,15 +264,140 @@ function ProgressionCards({ chordName, onChordClick }) {
)
}
// ─── Main panel ───────────────────────────────────────────────────────────────
export default function ExplorePanel({ keyInfo, chordHistory, onChordClick }) {
const [open, setOpen] = useState(false)
// ─── One KB progression card (the Explore browser hero) ──────────────────────
function KbProgressionCard({ prog, keyRootPc, onChordClick }) {
const degrees = prog?.degrees ?? []
const qualities = prog?.qualities ?? []
const chords = degrees.map((deg, i) => {
const pc = (((keyRootPc + deg) % 12) + 12) % 12
return `${NOTES[pc]}${CHORD_TYPES[qualities[i]]?.suffix ?? ''}`
})
const songs = Array.isArray(prog?.songs) ? prog.songs : []
return (
<div className="p-3 bg-surface border border-border rounded-xl">
<div className="flex items-center flex-wrap gap-2 mb-2">
<span className="font-bold text-white text-sm">{prog?.name ?? prog?.id ?? 'Untitled'}</span>
{Array.isArray(prog?.rn) && prog.rn.length > 0 && (
<span className="text-[10px] font-mono text-gray-600">{prog.rn.join(' ')}</span>
)}
<LevelBadge level={levelOf(prog)} />
</div>
{chords.length > 0 && (
<div className="flex flex-wrap gap-1.5 items-center mb-2">
{chords.map((c, i) => (
<span key={i} className="flex items-center gap-1">
<button type="button" onClick={() => onChordClick?.(c)}
title={`Open ${c} details`}
className="px-2.5 py-1 rounded-lg font-bold text-sm border bg-panel border-border text-gray-200 transition-all outline-none hover:border-accent/50 hover:text-accent focus-visible:ring-2 focus-visible:ring-accent">
{c}
</button>
{i < chords.length - 1 && <span className="text-gray-700 text-xs"></span>}
</span>
))}
</div>
)}
{prog?.tip && <p className="text-xs text-gray-400 leading-snug">{prog.tip}</p>}
{songs.length > 0 && (
<p className="text-[11px] text-gray-500 mt-1">{songs.slice(0, 3).join(' · ')}</p>
)}
</div>
)
}
// ─── Explore section — KB progression browser + famous progressions ──────────
// Props: keyInfo (chords render in the detected key; C until one is known),
// levels + onToggleLevel (shell-owned shared filter), onChordClick (chord name
// string → ChordDetailModal).
export function ExploreSection({ keyInfo, levels, onToggleLevel, onChordClick }) {
const styles = useMemo(
() => Object.entries(kb ?? {}).map(([id, s]) => ({ id, label: s?.meta?.label ?? id })),
[]
)
const [styleOverride, setStyleOverride] = useState(null)
const activeStyle = styleOverride ?? styles[0]?.id
const keyRootPc = parseChord(keyInfo?.root ?? '')?.rootPc ?? 0
const keyMode = keyInfo?.mode === 'minor' ? 'minor' : 'major'
const tonicName = `${NOTES[keyRootPc]}${keyMode === 'minor' ? 'm' : ''}`
const progressions = kb?.[activeStyle]?.progressions ?? []
const visible = progressions.filter(p => levels?.[levelOf(p)])
return (
<div className="flex flex-col gap-4">
{/* Toolbar: style chips + shared level filter */}
<div className="flex flex-wrap items-center gap-x-3 gap-y-2">
<div className="flex items-center gap-1 flex-wrap">
{styles.map(s => {
const active = s.id === activeStyle
return (
<button key={s.id} type="button" aria-pressed={active}
onClick={() => setStyleOverride(s.id)}
className={`px-2.5 py-1 min-h-[32px] rounded-lg text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-accent ${
active
? 'bg-accent/20 border border-accent text-accent font-semibold'
: 'border border-transparent text-gray-400 hover:text-gray-200 hover:border-border'
}`}>
{s.label}
</button>
)
})}
</div>
<div className="w-px h-5 bg-border shrink-0" />
<LevelChips levels={levels} onToggle={onToggleLevel} />
</div>
{/* Circle of fifths — live key map with inline diatonics (task D-61).
keyInfo here IS App's effectiveKey (App → KnowledgeDock → this section);
the circle is read-only — tapping wedges never touches key state. */}
<CircleOfFifths keyInfo={keyInfo} onChordClick={onChordClick} />
<p className="text-[11px] text-gray-500">
Chords shown in {NOTES[keyRootPc]} {keyMode}{keyInfo?.root ? '' : ' (no key detected yet)'} · tap any chord for voicings
</p>
{/* KB progression cards */}
{visible.length > 0 ? (
<div className="flex flex-col gap-3">
{visible.map((p, i) => (
<KbProgressionCard key={p?.id ?? i} prog={p} keyRootPc={keyRootPc} onChordClick={onChordClick} />
))}
</div>
) : (
<p className="text-sm text-gray-400 py-2">
{progressions.length === 0
? 'No progressions authored for this style yet.'
: 'Nothing at the selected level for this style — flip the level filter back on.'}
</p>
)}
{/* Famous progressions (exempt from the level filter — untagged corpus) */}
<div className="flex flex-col gap-2 border-t border-border pt-3">
<h4 className="text-[10px] font-semibold uppercase tracking-widest text-gray-500">
Famous progressions <span className="normal-case tracking-normal font-normal">· not affected by the level filter</span>
</h4>
<ProgressionCards chordName={tonicName} onChordClick={onChordClick} />
</div>
</div>
)
}
// ─── Voicings section — picker (follows the live chord) → VoicingBrowser ─────
// Props: keyInfo + chordHistory feed the quick-pick chips; currentChord re-aims
// the picker whenever a new chord commits (manual picks hold until then).
// `instrument` (L-40, D-40 §3) scopes the browser to App's global selector —
// omitted (the orphaned standalone panel below) it falls back to 'both' via
// VoicingBrowser's own `show` default.
export function VoicingsSection({ keyInfo, chordHistory, currentChord, instrument }) {
const [root, setRoot] = useState('C')
const [typeKey, setTypeKey] = useState('maj')
const [view, setView] = useState('guitar') // guitar | piano | progressions
const [active, setActive] = useState('')
const chordName = root + (CHORD_TYPES[typeKey]?.suffix ?? '')
useEffect(() => {
if (!currentChord) return
const p = parseChord(currentChord)
if (p) { setRoot(NOTES[p.rootPc]); setTypeKey(p.type); setActive(currentChord) }
}, [currentChord])
function selectChord(chord) {
setActive(chord)
@@ -169,79 +405,58 @@ export default function ExplorePanel({ keyInfo, chordHistory, onChordClick }) {
if (p) { setRoot(NOTES[p.rootPc]); setTypeKey(p.type) }
}
// Context-aware quick-picks
const recentChords = [...new Set([...(chordHistory ?? [])].reverse())].slice(0, 12)
const keyChords = keyInfo?.root ? getChordsInKey(keyInfo.root, keyInfo.mode ?? 'major') : []
const recentChords = [...new Set([...(chordHistory ?? [])].reverse())].slice(0, 12)
const keyChords = keyInfo?.root ? getChordsInKey(keyInfo.root, keyInfo.mode ?? 'major') : []
const rootPc = parseChord(root)?.rootPc ?? 0
return (
<div className="flex flex-col gap-4">
{(recentChords.length > 0 || keyChords.length > 0) && (
<div className="flex flex-col gap-2.5 p-3 bg-surface border border-border rounded-xl">
<ChipRow label="History" chords={recentChords} active={active} keyInfo={keyInfo} onSelect={selectChord} />
{keyChords.length > 0 && recentChords.length > 0 && <div className="h-px bg-border" />}
{keyChords.length > 0 && (
<ChipRow
label={keyInfo.root + ' ' + (keyInfo.mode ?? '')}
chords={keyChords} active={active} keyInfo={keyInfo} onSelect={selectChord}
/>
)}
</div>
)}
<ChordPickerToolbar
root={root}
typeKey={typeKey}
onRootChange={n => { setRoot(n); setActive('') }}
onTypeChange={k => { setTypeKey(k); setActive('') }}
/>
<VoicingBrowser rootPc={rootPc} quality={typeKey} show={instrument} />
</div>
)
}
// ─── Standalone panel (thin composition; orphaned — kept mountable) ──────────
export default function ExplorePanel({ keyInfo, chordHistory, currentChord, onChordClick }) {
const [open, setOpen] = useState(false)
const [levels, setLevels] = useState({ foundation: true, intermediate: true })
const toggleLevel = (key) => setLevels(prev => {
const next = { ...prev, [key]: !prev[key] }
return (next.foundation || next.intermediate) ? next : prev // both can't be off
})
return (
<div className="mb-3 bg-panel border border-border rounded-xl overflow-hidden">
<button onClick={() => setOpen(v => !v)}
<button onClick={() => setOpen(v => !v)} aria-expanded={open}
className="w-full flex items-center justify-between px-4 py-2 text-sm text-gray-400 hover:text-gray-200 transition-all">
<span>EXPLORE ANY CHORD</span>
<span>{open ? '▲' : '▼'}</span>
</button>
{open && (
<div className="border-t border-border p-4 flex flex-col gap-4">
{/* ── Context quick-picks ── */}
{(recentChords.length > 0 || keyChords.length > 0) && (
<div className="flex flex-col gap-2.5 p-3 bg-surface border border-border rounded-xl">
<ChipRow label="History" chords={recentChords} active={active} keyInfo={keyInfo} onSelect={selectChord} />
{keyChords.length > 0 && recentChords.length > 0 && <div className="h-px bg-border" />}
{keyChords.length > 0 && (
<ChipRow
label={keyInfo.root + ' ' + (keyInfo.mode ?? '')}
chords={keyChords} active={active} keyInfo={keyInfo} onSelect={selectChord}
/>
)}
</div>
)}
{/* ── Manual chord picker ── */}
<div className="flex flex-wrap gap-2 items-center p-3 bg-surface border border-border rounded-xl">
<div className="flex flex-wrap gap-1">
{NOTES.map(n => (
<button key={n} onClick={() => { setRoot(n); setActive('') }}
className={`px-2 py-0.5 rounded text-xs font-bold transition-all ${
root === n ? 'bg-accent text-white' : 'bg-border text-gray-400 hover:text-white'
}`}>
{n}
</button>
))}
</div>
<div className="w-px h-5 bg-border shrink-0" />
<div className="relative">
<select value={typeKey} onChange={e => { setTypeKey(e.target.value); setActive('') }}
className="appearance-none bg-panel border border-border rounded-lg pl-2 pr-6 py-1 text-xs text-gray-200 cursor-pointer focus:outline-none focus:border-accent">
{CHORD_TYPE_OPTIONS.map(o => <option key={o.key} value={o.key}>{o.label}</option>)}
</select>
<span className="pointer-events-none absolute right-1.5 top-1/2 -translate-y-1/2 text-gray-500 text-xs"></span>
</div>
<div className="text-2xl font-black text-accent ml-2">{chordName}</div>
</div>
{/* ── View tabs ── */}
<div className="flex gap-1 bg-surface border border-border rounded-xl p-1 w-fit">
{[
{ key: 'guitar', label: '🎸 Guitar Voicings' },
{ key: 'piano', label: '🎹 Piano Techniques' },
{ key: 'progressions', label: '🎵 Progressions' },
].map(t => (
<button key={t.key} onClick={() => setView(t.key)}
className={`px-3 py-1.5 rounded-lg text-xs font-semibold transition-all whitespace-nowrap ${
view === t.key ? 'bg-accent text-white' : 'text-gray-400 hover:text-white'
}`}>
{t.label}
</button>
))}
</div>
{/* ── Content ── */}
{view === 'guitar' && <GuitarGrid chordName={chordName} />}
{view === 'piano' && <PianoGrid chordName={chordName} />}
{view === 'progressions' && <ProgressionCards chordName={chordName} onChordClick={c => { selectChord(c); onChordClick?.(c) }} />}
<div className="border-t border-border p-4 flex flex-col gap-6">
<ExploreSection keyInfo={keyInfo} levels={levels} onToggleLevel={toggleLevel} onChordClick={onChordClick} />
<VoicingsSection keyInfo={keyInfo} chordHistory={chordHistory} currentChord={currentChord} />
</div>
)}
</div>
+42 -21
View File
@@ -37,7 +37,11 @@ function noteColor(isChordTone, isPenta, isScale, mono = false) {
return null
}
export default function Fretboard({ keyInfo, currentChord, pentatonicOnly = false, monoColor = false, jamFocusChord = null }) {
// `compact` (task L-50, one-screen.md §2): trimmed card chrome (p-3, legend
// merged onto the heading line) + a natural-width cap on the SVG (max-width =
// its viewBox width, so it never renders above scale 1.0). No fret reduction,
// no transform scaling — the notes stay at their designed size.
export default function Fretboard({ keyInfo, currentChord, pentatonicOnly = false, monoColor = false, jamFocusChord = null, compact = false }) {
const { root, mode } = keyInfo ?? {}
if (!root) return null
@@ -78,20 +82,49 @@ export default function Fretboard({ keyInfo, currentChord, pentatonicOnly = fals
const focusLabel = pc =>
pc === focusThird ? '3' : pc === focusSeventh ? focusSeventhLabel : null
const heading = (
<p className={`text-sm text-gray-500 uppercase tracking-widest ${compact ? '' : 'mb-4'}`}>
Fretboard {root} {mode}
{currentChord && <span className="text-amber-400 ml-2">/ {currentChord}</span>}
{hasFocus && <span className="text-accent ml-2"> guide tones</span>}
</p>
)
const legend = (
// Critic mechanical fix (L-50 gate): non-compact keeps HEAD's exact class
// string so the non-compact render stays byte-identical to the committed one.
<div className={compact ? 'flex flex-wrap items-center text-xs text-gray-500 gap-3' : 'mt-3 flex flex-wrap gap-5 text-xs text-gray-500'}>
<span><span className="text-accent"></span> Chord tone</span>
<span style={{ color: monoColor ? '#c084fc' : '#f59e0b' }}></span><span> Pentatonic</span>
<span style={{ color: monoColor ? '#e9d5ff' : '#6b7280' }}></span><span> Scale</span>
{hasFocus && (
<span className="flex items-center gap-1">
<span
className="inline-block w-3 h-3 rounded-full border-2 border-accent"
/>
Guide tones (3 / {focusSeventhLabel})
</span>
)}
</div>
)
return (
<div className="bg-panel border border-border rounded-2xl p-6">
<p className="text-sm text-gray-500 uppercase tracking-widest mb-4">
Fretboard {root} {mode}
{currentChord && <span className="text-amber-400 ml-2">/ {currentChord}</span>}
{hasFocus && <span className="text-accent ml-2"> guide tones</span>}
</p>
<div className={`bg-panel border border-border rounded-2xl ${compact ? 'p-3' : 'p-6'}`}>
{compact ? (
<div className="mb-2 flex flex-wrap items-center justify-between gap-x-4 gap-y-1">
{heading}
{legend}
</div>
) : (
heading
)}
<div>
<svg
viewBox={`0 0 ${BOARD_W} ${BOARD_H}`}
width="100%"
height="auto"
style={{ display: 'block' }}
style={{ display: 'block', ...(compact ? { maxWidth: BOARD_W } : null) }}
>
{/* Fretboard background */}
<rect x={NUT_X} y={PAD_T - 6} width={BOARD_W - NUT_X - 4} height={5 * STRING_H + 12}
@@ -202,19 +235,7 @@ export default function Fretboard({ keyInfo, currentChord, pentatonicOnly = fals
</svg>
</div>
<div className="mt-3 flex flex-wrap gap-5 text-xs text-gray-500">
<span><span className="text-accent"></span> Chord tone</span>
<span style={{ color: monoColor ? '#c084fc' : '#f59e0b' }}></span><span> Pentatonic</span>
<span style={{ color: monoColor ? '#e9d5ff' : '#6b7280' }}></span><span> Scale</span>
{hasFocus && (
<span className="flex items-center gap-1">
<span
className="inline-block w-3 h-3 rounded-full border-2 border-accent"
/>
Guide tones (3 / {focusSeventhLabel})
</span>
)}
</div>
{!compact && legend}
</div>
)
}
+328
View File
@@ -0,0 +1,328 @@
// GlanceRail — ALL loop stations expanded, always (task D-41, per
// docs/design/integrated-glance.md §4; supersedes the L-33 playhead accordion).
//
// D-51 (docs/design/one-screen.md §4/§6.2) adapts the rail to the dashboard's
// 500px right column. Margin-hardening arithmetic, worst case = a classic
// Windows scrollbar (~17px) inside the column's overflow-y-auto wrapper:
// row interior = 500 17 (scrollbar) 18 (section border + p-2)
// 14 (row border + p-1.5) = 451px
// guitar cell 89 (75 SVG + p-1.5 + border) → 4/line (374 ≤ 451; a 5th = 469 ✗)
// piano 1-octave 156.4 / 2-octave 279.6 → the mixed pair 279.6+6+156.4 = 442
// fits with ~9px margin even under the scrollbar (26px without) — the fit the
// doc calls fragile at the old paddings is now robust. Without the scrollbar
// the interior is 468px; every count above is unchanged.
//
// One VERTICAL ROW per loop station, canonical KB order (the same order the
// banner's loop shows after rotation). Every row renders its full voicing
// gallery PERMANENTLY — the playhead HIGHLIGHTS the active row (accent ring +
// "now" badge + aria-current) and never hides, collapses, or reveals content.
// User directive 2026-07-10: "i'd like to see all the chords and their
// voicings … so you can follow and potentially learn new ways to play it while
// you are playing the loop. scrolling is easier then clicking."
//
// Row anatomy (D-40 §4):
// header — chord label + rn (the focus toggle) · "now" badge / "next" tag ·
// solo-scale label · aim dots (3rd filled accent, 7th hollow —
// RoadmapTrack's GuideDot language, honest "5th" fallback kept) ·
// transition chip ("next F→E · ½ step down"; the last row wraps:
// "loop"). This is where the retired RoadmapTrack's education
// folds in (D-40 §2) — theory.js `guideTones` / `voiceLeadingPairs`
// / `soloScale`, read-only imports.
// gallery — the full VoicingBrowser (show={instrument}, dense) with the
// station's OWN voicing passed as `recommended` so it renders as the
// badged, accent-bordered first cell INSIDE the browser (no separate
// own-cell, no dupe — dashboard-polish.md §1.1/§2.1). Guitar caps at
// 4 recommended-first shapes on one line (§1); piano is a 2×2 of
// `size="mini"` keyboards (§2). No ▶ anywhere (§3).
//
// Focus semantics (D-40 §4 — the pin, simplified): with everything always
// expanded there is nothing left to hold open, so tapping a row header TOGGLES
// that station as focused. The PARENT owns the state and the onFocusChord
// emission (the D-03 fretboard guide-tone contract, byte-compatible); a focused
// row shows an "aim on fretboard" chip; tap again (or the loop changes) to
// clear. This component never emits focus-chord itself and never triggers audio
// — the ▶ previews were removed everywhere (dashboard-polish.md §3).
//
// NO auto-scroll (D-40 §4/§6.2 step 1): the band lives in page flow, where
// scrollIntoView's nearest scroller is the DOCUMENT — it would yank the whole
// page mid-jam. The L-33 auto-centre effect was deleted in L-40 and must never
// return; the highlight travels, the user owns the scrollbar.
//
// HYBRID rail reuse (task L-77, refines D-76; user directive 2026-07-13 — "highlight
// the loop chords when it finds a loop but also add the other chords underneath"):
// JamGuide now renders GlanceRail TWICE — once for the canonical LOOP group (the
// original call, byte-unchanged) and once for the "also played" recent-history
// group. The history group passes `showTransitions={false}` (see the prop below)
// because history order is NOT canonical: the between-adjacent voice-leading chips
// and the "next" tag are only true for the loop's canonical wheel, so they are
// suppressed for the history rail. Everything else (per-row gallery, "now" via
// activeIndex, the SoloLabel/AimDots guide-tone education) is correct for any chord
// and stays. Default (`showTransitions` absent) is byte-compatible with the loop.
//
// Pure presentational. Props:
// stations — [{ shape, voicing, rootPc, quality, label, rn }] canonical order
// activeIndex — playhead station (canonicalPos); -1 = loop known, playhead
// not — no row is marked "now" (content never changes either way).
// The history group passes -1 (no playhead — see JamGuide).
// focusedIndex — the focused station index, or null (nothing focused)
// onFocus — fn(index|null): toggle a station's focus
// instrument — 'guitar' | 'piano' (VoicingBrowser `show`; bass never mounts
// this rail — JamGuide renders BassGuideRows instead, D-40 §3)
// keyRoot — key tonic pitch class 011 (ChordDiagram fret placement)
// keyMode — key mode name (soloScale's minor-key dominant nudge)
// showTransitions — default true (the loop caller is unchanged). false → the
// voice-leading TransitionChips and the "next" tag are suppressed
// (history order is not canonically adjacent, task L-77).
import { NOTES, guideTones, voiceLeadingPairs, soloScale } from '../lib/theory'
import VoicingBrowser from './VoicingBrowser'
const pcName = (pc) => NOTES[((pc % 12) + 12) % 12]
// ─── Header atoms (exported — BassGuideRows in JamGuide.jsx composes the same
// anatomy for visual parity across instruments, D-40 §3) ──────────────────
// Solo-scale label: "solo · G mixolydian" (theory.js snake_case → spaces).
export function SoloLabel({ rootPc, quality, keyMode }) {
const { name } = soloScale(quality, keyMode)
return (
<span className="text-xs leading-none text-gray-400">
<span className="text-[9px] uppercase tracking-widest text-gray-500">solo · </span>
{pcName(rootPc)} {name.replace(/_/g, ' ')}
</span>
)
}
// One guide-tone dot: note name in a small circle + its honest kind label.
// Filled accent = the 3rd; hollow = the 7th (or the "5th" fallback — never
// badge a 5th as a 7th). Filled text is BLACK on accent (#a855f7 vs black
// ≈5.3:1 — AA; white would be ~4.0), matching VoicingBrowser's ▶ hover.
function GuideDot({ pc, kind, filled }) {
return (
<span className="flex items-center gap-1">
<span
className={
'flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold leading-none ' +
(filled ? 'bg-accent text-black' : 'border-2 border-accent text-purple-300')
}
>
{pcName(pc)}
</span>
<span className="text-[9px] font-medium uppercase tracking-wide text-gray-400">{kind}</span>
</span>
)
}
// The "aim" pair — the RoadmapTrack TARGET lane, folded to one header line.
export function AimDots({ rootPc, quality }) {
const g = guideTones(rootPc, quality)
const seventhKind = g.hasSeventh ? '7th' : '5th'
return (
<span className="flex items-center gap-2">
<span className="text-[9px] uppercase tracking-widest text-gray-500">aim</span>
<GuideDot pc={g.third} kind="3rd" filled />
<GuideDot pc={g.seventh} kind={seventhKind} filled={false} />
</span>
)
}
// The voice-leading rail, folded to a compact chip: "next F→E · ½ step down";
// a held common tone reads "B holds · common tone"; the last row's chip is the
// wrap-around and says "loop" (D-40 §2). No smooth rail (≤2 semitones) → the
// caller passes null and no chip renders.
function TransitionChip({ pair, wraps }) {
if (!pair) return null
const held = pair.semitones === 0
const label = held ? `${pcName(pair.from)} holds` : `${pcName(pair.from)}${pcName(pair.to)}`
const motion = held
? 'common tone'
: `${Math.abs(pair.semitones) === 1 ? '½' : Math.abs(pair.semitones)} step ${pair.semitones < 0 ? 'down' : 'up'}`
return (
<span className="flex items-center gap-1 rounded border border-border bg-surface px-1.5 py-1 text-[10px] leading-none">
<span className="font-medium uppercase tracking-wide text-gray-500">{wraps ? 'loop' : 'next'}</span>
<span className="font-semibold text-accent">{label}</span>
<span className="text-gray-400">· {motion}</span>
</span>
)
}
// ─── One always-expanded station row ─────────────────────────────────────────
function StationRow({
st, isNow, isNext, isFocused, onToggleFocus, instrument, keyRoot, keyMode, rail, wraps,
}) {
// The station's own voicing — passed to VoicingBrowser as `recommended` so it
// renders as the badged, accent-bordered first cell inside the gallery (guitar:
// a shape; piano: a voicing matched by style). The separate own-cell is gone
// (dashboard-polish.md §1.1/§2.1 — it centralises the ≤4 rule and kills the old
// recommended/gallery duplicate).
const recommended = instrument === 'guitar' ? (st.shape ?? null) : (st.voicing ?? null)
// Active row: unmistakable (accent ring + tint). Focused-but-not-now rows get
// the softer accent border; everything else recedes to the 0.85 opacity floor
// (never below AA legibility).
const stateClass = isNow
? 'border-accent bg-accent/10 ring-2 ring-accent'
: isFocused
? 'border-accent/60 bg-accent/5'
: 'border-border bg-surface'
return (
<div
role="listitem"
aria-current={isNow ? 'true' : undefined}
aria-label={
`${st.label}${st.rn ? ` (${st.rn})` : ''} — every ${instrument} voicing` +
`${isNow ? ', now playing' : ''}${isNext ? ', up next' : ''}`
}
className={`rounded-lg border p-1.5 ${stateClass}`}
style={{ opacity: isNow || isFocused ? 1 : 0.85 }}
>
{/* ── Header line: identity + the folded roadmap education ── */}
{/* Loop rows (onToggleFocus provided) keep the focus-toggle button — the
D-03 fretboard guide-tone contract, byte-unchanged. History rows pass
no toggle → a plain, non-interactive identity (no inert button /
misleading "focus" tooltip / stray focus ring), L-77. */}
<div className="mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1">
{onToggleFocus ? (
<button
type="button"
aria-pressed={isFocused}
onClick={onToggleFocus}
title={isFocused
? `Unfocus ${st.label} — clear its guide tones from the fretboard`
: `Focus ${st.label} — light its guide tones on the fretboard`}
className="flex min-h-[32px] items-center gap-2 rounded px-1 outline-none focus-visible:ring-2 focus-visible:ring-accent"
>
<span className="text-sm font-bold leading-none text-gray-100">{st.label}</span>
{st.rn && (
<span className="text-[9px] font-medium uppercase tracking-wide text-gray-400">
{st.rn}
</span>
)}
</button>
) : (
<div className="flex min-h-[32px] items-center gap-2 px-1">
<span className="text-sm font-bold leading-none text-gray-100">{st.label}</span>
{st.rn && (
<span className="text-[9px] font-medium uppercase tracking-wide text-gray-400">
{st.rn}
</span>
)}
</div>
)}
{isNow && (
<span className="text-[9px] font-semibold uppercase tracking-widest text-accent">
now
</span>
)}
{isNext && (
<span className="rounded border border-accent/60 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider text-accent">
next
</span>
)}
{isFocused && (
<span className="rounded border border-accent bg-accent/10 px-1.5 py-0.5 text-[10px] font-medium leading-none text-accent">
aim on fretboard
</span>
)}
<SoloLabel rootPc={st.rootPc} quality={st.quality} keyMode={keyMode} />
<AimDots rootPc={st.rootPc} quality={st.quality} />
<TransitionChip pair={rail} wraps={wraps} />
</div>
{/* ── Gallery (dashboard-polish.md §1/§2): the recommended voicing is now
cell #1 INSIDE the browser (badged "play", accent border — "the
answer" prominence the old own-cell had, no dupe). Guitar caps at 4
recommended-first cells on one line; piano is a 2×2 of mini
keyboards. Full row interior, no separate own-cell. ── */}
<VoicingBrowser
rootPc={st.rootPc}
quality={st.quality}
show={instrument}
dense
recommended={recommended}
max={4}
/>
</div>
)
}
// ─── The rail ─────────────────────────────────────────────────────────────────
export default function GlanceRail({
stations = [], activeIndex = -1, focusedIndex = null, onFocus, instrument, keyRoot, keyMode,
showTransitions = true,
}) {
const n = stations.length
if (n === 0) return null
// The "next" tag is a loop-adjacency claim → suppressed for the history group.
const nextIndex = showTransitions && activeIndex >= 0 && n > 1 ? (activeIndex + 1) % n : -1
// Voice-leading rails: rail i leaves station i for station (i+1) mod n — the
// last rail wraps back to station 0 (the loop is a wheel). The headline rail
// is the 7→3 (voiceLeadingPairs lists the 7th first); a one-chord loop has
// no transition to speak of. Suppressed entirely for the history group
// (showTransitions=false) — its rows are recent-first, not canonically
// adjacent, so a "next F→E" chip would point at the wrong neighbour (L-77).
const rails = stations.map((st, i) => {
if (!showTransitions || n < 2) return null
const next = stations[(i + 1) % n]
return voiceLeadingPairs(
{ root: st.rootPc, quality: st.quality },
{ root: next.rootPc, quality: next.quality },
)[0] ?? null
})
// Section framing (L-77 honesty fix): showTransitions === true ⟺ the canonical
// LOOP group; the "also played" history group (showTransitions=false) is recent-
// first with no playhead, so it must NOT claim "the loop" / "the playhead". Rows
// in the history group are also non-focusable (no onFocus → no inert header
// button); the loop group's function keeps its focus toggle byte-unchanged.
const isLoop = showTransitions
const focusable = typeof onFocus === 'function'
const sectionAria = isLoop
? 'Voicing variations — every chord of the loop, all expanded'
: 'Voicing variations — every recently played chord, all expanded'
const sectionTitle = isLoop
? 'Variations · every chord, every voicing — the playhead highlights'
: 'Variations · every chord, every voicing'
const sectionFoot = isLoop
? "Voicings follow the loop — the playhead highlights the chord you're on."
: 'Recent chords — newest first; every voicing of each.'
return (
<section
className="rounded-2xl border border-border bg-panel p-2"
aria-label={sectionAria}
>
<h4 className="mb-2 text-[10px] font-semibold uppercase tracking-widest text-gray-500">
{sectionTitle}
</h4>
<div className="flex flex-col gap-2" role="list">
{stations.map((st, i) => (
<StationRow
key={i}
st={st}
isNow={i === activeIndex}
isNext={i === nextIndex}
isFocused={focusedIndex === i}
onToggleFocus={focusable ? (() => onFocus(focusedIndex === i ? null : i)) : null}
instrument={instrument}
keyRoot={keyRoot}
keyMode={keyMode}
rail={rails[i]}
wraps={i === n - 1}
/>
))}
</div>
{/* No ▶ anywhere anymore (dashboard-polish.md §3 — "leave them off,
better not"); the rail is purely visual. */}
<p className="mt-2 text-[11px] text-gray-500">
{sectionFoot}
</p>
</section>
)
}
+1001 -256
View File
File diff suppressed because it is too large Load Diff
+475
View File
@@ -0,0 +1,475 @@
// LickCard — tab-style SVG lick renderer (task D-22).
//
// Renders one structured lick from the KB `licks` schema (src/data/kb/SCHEMA.md):
// { id, name, level, chordContext, techniques[], source?,
// tab: [{ string: 16, fret: 015, technique? }] } // ordered, first → last
//
// Tab convention (per SCHEMA.md): string 1 = high e rendered on TOP,
// string 6 = low E on the bottom — standard guitar tab. NOTE: this is the
// REVERSE of RiffDiagram.jsx's row order (that diagram puts low E on top).
//
// There is no rhythm information in the schema, so notes are simply evenly
// spaced columns in `tab` order — no bars, beams or durations are invented.
//
// Column rule: each note takes the next column, EXCEPT a note tagged
// `double-stop`, which stacks into the PREVIOUS note's column — unless ANY note
// already placed in that column is on the same string (stacking would overlap
// exactly), in which case it takes a new column.
//
// Technique glyphs (amber, the established secondary-tone colour):
// hammer-on → slur arc from the previous note + italic "h" above
// pull-off → slur arc from the previous note + italic "p" above
// slide → short diagonal segment into the note (rises toward higher frets)
// bend → curved arrow rising from the note
// vibrato → small ~ wave above the note
// ghost-note → fret number in parentheses, dimmed
// double-stop→ no glyph; renders as a stacked column (see above)
// chromatic-approach → no glyph (melodic content — the tag chip covers it)
// unknown strings → no glyph, note still renders (graceful)
//
// Exports:
// default <LickCard lick={…} size="thumb"|"full" /> (production API)
// <TechniqueLegend /> — the glyph key, rendered ONCE per grid (per D-20 §3)
// layoutTab(tab) — pure layout helper (returns null on empty/invalid)
// DEMO_LICK — SCHEMA.md's worked B.B.-box example, dev fixture only
//
// Design tokens (tailwind.config.js) — SVG fills can't read Tailwind classes,
// so the constants below mirror the tokens (same convention as MiniPiano /
// ChordDiagram): accent #a855f7, amber #f59e0b, surface #0f0f0f.
const AMBER = '#f59e0b' // token `amber` — technique glyphs
const FRET_TEXT = '#e5e7eb' // gray-200 — fret numbers (≈15:1 on surface)
const GHOST_TEXT = '#9ca3af' // gray-400 — ghost notes, quieter but AA (≈7:1)
const STRING_LINE = '#3a3a3a' // string lines (decorative, RiffDiagram idiom)
const STRING_LABEL = '#6b7280' // gray-500 — string-name microcopy (decorative)
const CARD_BG = '#0f0f0f' // token `surface` — backing pill behind fret numbers
// Fixed technique vocabulary (C-20 schema) — anything else gets no glyph.
export const TECHNIQUE_VOCAB = [
'hammer-on', 'pull-off', 'slide', 'bend',
'double-stop', 'ghost-note', 'chromatic-approach', 'vibrato',
]
// Chip symbol per technique (shown in the technique-tag chips).
const TECH_SYMBOL = {
'hammer-on': 'h',
'pull-off': 'p',
slide: '',
bend: '↑',
vibrato: '~',
'ghost-note': '( )',
'double-stop': '⋮',
'chromatic-approach': null, // tag only — no mark on the tab
}
// ── Geometry (SVG user units; the svg scales to card width via viewBox) ──────
const STR_GAP = 14 // vertical gap between string lines
const PAD_T = 17 // headroom for bend arrows / vibrato above string 1
const PAD_B = 9
const PAD_L = 20 // room for string-name labels
const PAD_R = 12
const COL_W = 26 // horizontal pitch per note column
const STRING_NAMES = ['e', 'B', 'G', 'D', 'A', 'E'] // index = string 1 (top → bottom)
function isValidNote(n) {
return (
n && typeof n === 'object' &&
Number.isInteger(n.string) && n.string >= 1 && n.string <= 6 &&
Number.isInteger(n.fret) && n.fret >= 0 && n.fret <= 15
)
}
/**
* Pure layout: tab array → positioned notes.
* Returns null when there is nothing renderable (not an array / no valid note).
* Otherwise: { notes: [{string,fret,technique?,col,x,y,label,ghost}], nCols, width, height }
* Columns are monotonically non-decreasing; y grows with string number
* (string 1 = smallest y = top line).
*/
export function layoutTab(tab) {
if (!Array.isArray(tab)) return null
const clean = tab.filter(isValidNote)
if (clean.length === 0) return null
const notes = []
let col = -1
for (let i = 0; i < clean.length; i++) {
const n = clean[i]
// double-stop stacks into the previous column — unless ANY note already
// placed there shares this string (a ≥3-note stack can repeat the string of
// a non-adjacent same-column note, which would overlap exactly — D-23).
const stacks =
i > 0 &&
n.technique === 'double-stop' &&
!notes.some((m) => m.col === col && m.string === n.string)
if (!stacks) col++
const ghost = n.technique === 'ghost-note'
notes.push({
string: n.string,
fret: n.fret,
technique: typeof n.technique === 'string' ? n.technique : undefined,
col,
x: PAD_L + col * COL_W + COL_W / 2,
y: PAD_T + (n.string - 1) * STR_GAP,
label: ghost ? `(${n.fret})` : String(n.fret),
ghost,
})
}
const nCols = col + 1
return {
notes,
nCols,
width: PAD_L + nCols * COL_W + PAD_R,
height: PAD_T + 5 * STR_GAP + PAD_B,
}
}
// ── Glyph fragments (pure SVG, all in user units so they scale with the tab) ─
function SlurGlyph({ note, prev, letter }) {
const fs = 8
if (!prev || prev.col === note.col) {
// No source note to slur from — letter alone, just before the note.
return (
<text x={note.x - 10} y={note.y - 7} textAnchor="middle" fontSize={fs}
fontStyle="italic" fill={AMBER}>{letter}</text>
)
}
const midX = (prev.x + note.x) / 2
const topY = Math.min(prev.y, note.y)
return (
<g>
<path
d={`M ${prev.x + 5} ${prev.y - 4} Q ${midX} ${topY - 13} ${note.x - 5} ${note.y - 4}`}
fill="none" stroke={AMBER} strokeWidth={1}
/>
<text x={midX} y={topY - 11} textAnchor="middle" fontSize={fs}
fontStyle="italic" fill={AMBER}>{letter}</text>
</g>
)
}
function SlideGlyph({ note, prev }) {
// Rises toward the higher fret (up-slide ), falls for a down-slide ().
if (prev && prev.col !== note.col) {
const up = note.fret >= prev.fret
const midY = (prev.y + note.y) / 2
return (
<line
x1={prev.x + 7} y1={up ? midY + 3 : midY - 3}
x2={note.x - 7} y2={up ? midY - 3 : midY + 3}
stroke={AMBER} strokeWidth={1.2} strokeLinecap="round"
/>
)
}
// Slide-in from nowhere: short lead-in segment.
return (
<line x1={note.x - 14} y1={note.y + 4} x2={note.x - 7} y2={note.y - 1}
stroke={AMBER} strokeWidth={1.2} strokeLinecap="round" />
)
}
function BendGlyph({ note }) {
const { x, y } = note
return (
<g>
<path d={`M ${x + 4} ${y - 4} Q ${x + 10} ${y - 6} ${x + 10} ${y - 11}`}
fill="none" stroke={AMBER} strokeWidth={1.2} />
<polygon
points={`${x + 7.8},${y - 10} ${x + 12.2},${y - 10} ${x + 10},${y - 14.5}`}
fill={AMBER}
/>
</g>
)
}
function VibratoGlyph({ note }) {
const { x, y } = note
return (
<path
d={`M ${x - 7} ${y - 9} q 2.3 -3.5 4.6 0 t 4.6 0 t 4.6 0`}
fill="none" stroke={AMBER} strokeWidth={1.1} strokeLinecap="round"
/>
)
}
function NoteGlyph({ note, prev }) {
switch (note.technique) {
case 'hammer-on': return <SlurGlyph note={note} prev={prev} letter="h" />
case 'pull-off': return <SlurGlyph note={note} prev={prev} letter="p" />
case 'slide': return <SlideGlyph note={note} prev={prev} />
case 'bend': return <BendGlyph note={note} />
case 'vibrato': return <VibratoGlyph note={note} />
// ghost-note is handled by the parenthesised label; double-stop by the
// column stacking; chromatic-approach and unknown strings get no mark.
default: return null
}
}
// ── The tab SVG ───────────────────────────────────────────────────────────────
function TabSvg({ layout, name, size }) {
const { notes, width, height } = layout
const full = size === 'full'
return (
<div className="w-full" style={{ maxWidth: width * (full ? 2 : 1.3) }}>
<svg
viewBox={`0 0 ${width} ${height}`}
width="100%"
style={{ display: 'block', height: 'auto' }}
role="img"
aria-label={`Tab for ${name}: ${notes.length} note${notes.length === 1 ? '' : 's'}`}
>
{/* String lines — string 1 (high e) on top, string 6 (low E) at bottom */}
{STRING_NAMES.map((label, i) => {
const y = PAD_T + i * STR_GAP
return (
<g key={label + i}>
<line x1={PAD_L - 6} y1={y} x2={width - PAD_R + 6} y2={y}
stroke={STRING_LINE} strokeWidth={i === 5 ? 1.4 : 1} />
<text x={7} y={y + 3} textAnchor="middle" fontSize={7}
fill={STRING_LABEL}>{label}</text>
</g>
)
})}
{/* Technique glyphs (under the numbers so pills stay readable) */}
{notes.map((n, i) => (
<NoteGlyph key={`g${i}`} note={n} prev={notes[i - 1]} />
))}
{/* Fret numbers on their strings, backed by a surface pill so the
number interrupts the string line like printed tab */}
{notes.map((n, i) => {
const w = n.label.length * 5.2 + 3
return (
<g key={`n${i}`}>
<rect x={n.x - w / 2} y={n.y - 5.5} width={w} height={11}
rx={2} fill={CARD_BG} />
<text x={n.x} y={n.y + 3.2} textAnchor="middle" fontSize={9.5}
fontWeight="600" fill={n.ghost ? GHOST_TEXT : FRET_TEXT}>
{n.label}
</text>
</g>
)
})}
</svg>
</div>
)
}
// ── Card chrome ───────────────────────────────────────────────────────────────
function LevelBadge({ level }) {
if (level === 'intermediate') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-amber border border-amber/40 rounded px-1.5 py-px">
intermediate
</span>
)
}
if (level === 'foundation') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-gray-400 border border-border rounded px-1.5 py-px">
foundation
</span>
)
}
return null // unknown/missing level → no badge, never a wrong claim
}
function TechniqueChip({ tech }) {
const symbol = TECH_SYMBOL[tech]
return (
<span className="inline-flex items-center gap-1 text-[10px] text-gray-400 border border-border rounded-full px-1.5 py-px">
{symbol && <span className="text-amber font-semibold" aria-hidden="true">{symbol}</span>}
{tech}
</span>
)
}
function PlaceholderCard({ name, size }) {
return (
<div
className={`bg-surface border border-border rounded-lg flex flex-col items-center justify-center text-gray-500 ${size === 'thumb' ? 'p-2 min-h-[72px]' : 'p-4 min-h-[110px]'}`}
role="group"
aria-label={name ? `${name}: lick unavailable` : 'lick unavailable'}
>
<span className="text-lg leading-none" aria-hidden="true"></span>
<span className="text-[10px] mt-1">
{name ? `${name} — tab unavailable` : 'lick unavailable'}
</span>
</div>
)
}
/**
* <LickCard lick={…} size="thumb"|"full" />
* Pure/presentational — renders one KB lick object; never crashes on bad data.
*/
export default function LickCard({ lick, size = 'full' }) {
const layout = layoutTab(lick?.tab)
const name = typeof lick?.name === 'string' && lick.name.trim() ? lick.name : 'Untitled lick'
if (!lick || !layout) {
return <PlaceholderCard name={lick ? name : null} size={size} />
}
const full = size === 'full'
const chordContext =
typeof lick.chordContext === 'string' && lick.chordContext.trim()
? lick.chordContext
: null
const techniques = Array.isArray(lick.techniques)
? lick.techniques.filter(t => typeof t === 'string' && t.trim())
: []
const source = typeof lick.source === 'string' && lick.source.trim() ? lick.source : null
return (
<div
className={`bg-surface border border-border rounded-lg flex flex-col ${full ? 'p-3 gap-2' : 'p-2 gap-1.5'}`}
role="group"
aria-label={chordContext ? `${name}${chordContext}` : name}
>
{/* Header: name + level badge */}
<div className="flex items-start justify-between gap-2">
<span className={`text-gray-200 font-semibold leading-tight ${full ? 'text-sm' : 'text-[11px]'}`}>
{name}
</span>
<LevelBadge level={lick.level} />
</div>
{/* Where it lands */}
{full && chordContext && (
<div>
<span className="inline-block text-[10px] font-medium text-accent bg-accent/10 border border-accent/40 rounded-full px-2 py-px">
{chordContext}
</span>
</div>
)}
{/* The tab */}
<TabSvg layout={layout} name={name} size={size} />
{/* Technique tags */}
{full && techniques.length > 0 && (
<div className="flex flex-wrap gap-1">
{techniques.map(t => <TechniqueChip key={t} tech={t} />)}
</div>
)}
{/* Attribution */}
{full && source && (
<span className="text-[10px] text-gray-500 italic leading-snug">{source}</span>
)}
</div>
)
}
// ── Glyph legend — render ONCE per lick grid (D-20 §3), not per card ─────────
function LegendSample({ children, w = 22 }) {
return (
<svg viewBox={`0 0 ${w} 18`} width={w} height={18} aria-hidden="true"
style={{ display: 'inline-block', verticalAlign: 'middle' }}>
{children}
</svg>
)
}
export function TechniqueLegend() {
const items = [
{
key: 'hammer-on', label: 'hammer-on',
sample: (
<LegendSample>
<path d="M 3 14 Q 11 4 19 14" fill="none" stroke={AMBER} strokeWidth={1} />
<text x={11} y={9} textAnchor="middle" fontSize={8} fontStyle="italic" fill={AMBER}>h</text>
</LegendSample>
),
},
{
key: 'pull-off', label: 'pull-off',
sample: (
<LegendSample>
<path d="M 3 14 Q 11 4 19 14" fill="none" stroke={AMBER} strokeWidth={1} />
<text x={11} y={9} textAnchor="middle" fontSize={8} fontStyle="italic" fill={AMBER}>p</text>
</LegendSample>
),
},
{
key: 'slide', label: 'slide',
sample: (
<LegendSample>
<line x1={4} y1={13} x2={18} y2={5} stroke={AMBER} strokeWidth={1.2} strokeLinecap="round" />
</LegendSample>
),
},
{
key: 'bend', label: 'bend',
sample: (
<LegendSample>
<path d="M 5 14 Q 12 12 12 7" fill="none" stroke={AMBER} strokeWidth={1.2} />
<polygon points="9.8,8 14.2,8 12,3.5" fill={AMBER} />
</LegendSample>
),
},
{
key: 'vibrato', label: 'vibrato',
sample: (
<LegendSample>
<path d="M 3 10 q 2.3 -3.5 4.6 0 t 4.6 0 t 4.6 0" fill="none" stroke={AMBER} strokeWidth={1.1} strokeLinecap="round" />
</LegendSample>
),
},
{
key: 'ghost-note', label: 'ghost note',
sample: (
<LegendSample>
<text x={11} y={12} textAnchor="middle" fontSize={9} fontWeight="600" fill={GHOST_TEXT}>(5)</text>
</LegendSample>
),
},
{
key: 'double-stop', label: 'double-stop (stacked)',
sample: (
<LegendSample>
<text x={11} y={8} textAnchor="middle" fontSize={8} fontWeight="600" fill={FRET_TEXT}>5</text>
<text x={11} y={17} textAnchor="middle" fontSize={8} fontWeight="600" fill={FRET_TEXT}>7</text>
</LegendSample>
),
},
]
return (
<div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11px] text-gray-400">
{items.map(it => (
<span key={it.key} className="inline-flex items-center gap-1.5">
{it.sample}
{it.label}
</span>
))}
<span className="text-gray-500">chromatic-approach: tag only, no mark</span>
</div>
)
}
// ── Dev fixture — SCHEMA.md's worked example (P-21 real data replaces this in
// the app; this export exists so the card can be exercised before P-21) ────
export const DEMO_LICK = {
id: 'blues-box1-bb-answer',
name: 'B.B. box answer phrase',
level: 'foundation',
chordContext: 'over the I7',
techniques: ['bend', 'vibrato'],
source: 'the B.B. King box, e.g. "The Thrill Is Gone" fills',
tab: [
{ string: 2, fret: 8 },
{ string: 1, fret: 8, technique: 'bend' },
{ string: 1, fret: 10, technique: 'vibrato' },
{ string: 2, fret: 8 },
],
}
+218 -20
View File
@@ -1,10 +1,41 @@
// 2-octave mini piano keyboard showing technique notes
// Props:
// rootPc — root pitch class 0-11
// lh — array of semitone intervals above root (left hand, shown in blue)
// rh — array of semitone intervals above root (right hand, shown in purple)
// Mini piano keyboard.
//
// TWO render modes, chosen by props (additive — legacy path is the default):
//
// 1. LEGACY <MiniPiano rootPc={..} lh={[..]} rh={[..]} />
// Used by ChordDetailModal + ExplorePanel. `lh`/`rh` are semitone intervals
// ABOVE the root (left hand shown blue, right hand shown purple), spanning a
// 2-octave keyboard. Behaviour here is UNCHANGED — byte-for-byte the same
// output the existing consumers have always rendered.
//
// 2. VOICING <MiniPiano voicing={pianoVoicing(...)} size="thumb|full" />
// Renders the output of src/lib/piano.js `pianoVoicing({rootPc,quality},opts)`:
// voicing.notes — ABSOLUTE semitone key positions, 0 = C of the low octave,
// range [0,36]. A note value `n` maps to the key `n`
// semitones above the low C (octave = ⌊n/12⌋, pc = n%12).
// voicing.pcs — pitch classes sounding.
// voicing.bass — lowest absolute note (the LH anchor) — marked distinctly.
// voicing.style / voicing.label — captions (shown in `full` size).
// The root pitch class lights in accent purple; the bass key is ringed as the
// LH anchor; the other voicing tones light in a lighter purple.
//
// Keyboard window (D-24): `size="thumb"` crops to the voicing's whole-octave
// span — from the octave-start at-or-below the lowest sounded key to the
// octave-end at-or-above the highest (plus the closing high C) — so a
// ≤1-octave shell renders ONE octave (~140px) instead of 23 (~266390px)
// and Jam Guide station thumbs sit level with guitar ChordDiagram thumbs.
// `size="mini"` (L-70, dashboard-polish.md §2) is the SAME cropped window at
// scale 0.60 (vs thumb 0.8) so two cells fit one grid column of the rail's
// ~451px interior (2-octave cell 213.2px < 222.5px); it bumps the in-SVG "R"
// glyph (8→10 vu) and the bass-ring stroke (2→2.5) so both stay legible at
// the smaller render. `thumb`/`full` are byte-untouched — `mini` is additive.
// `size="full"` keeps the wide C-anchored 23-octave window: the enlarged
// view benefits from register context, and its output stays byte-identical
// to the D-10 behaviour.
//
// Design tokens (tailwind.config.js): accent #a855f7. The SVG also uses the
// established Piano/Fretboard note language (accent purple for the focal tone).
const OCTAVES = 2
const WW = 22 // white key width
const WH = 60 // white key height
const BW = 14 // black key width
@@ -22,20 +53,33 @@ const BLACK_OFFSETS = [
{ pc: 10, afterWhite: 5 }, // A#
]
const TOTAL_WHITES = WHITE_PCS.length * OCTAVES // 14
const SVG_W = WW * TOTAL_WHITES + 2
const SVG_H = WH + 24
// ─── Design tokens (literal — SVG fills can't read Tailwind classes) ───────────
const ACCENT = '#a855f7' // text-accent — root pitch class (focal tone)
const ACCENT_SOFT = '#c084fc' // lighter accent — non-root voicing tones
const LH_BLUE = '#3b82f6' // legacy left-hand colour (unchanged)
const WHITE_FILL = '#f5f5f5'
const BLACK_FILL = '#1f2937'
const WHITE_STROKE = '#374151'
const BLACK_STROKE = '#111827'
const BASS_RING = '#fbbf24' // amber ring marking the LH bass anchor (AA on keys)
function noteColor(interval) {
// interval < 12 → first octave (root region), ≥12 → second octave
return interval < 12 ? '#a855f7' : '#c084fc'
function legacyNoteColor(hand) {
return hand === 'L' ? LH_BLUE : ACCENT
}
function handLabel(hand) {
return hand === 'L' ? 'LH' : 'RH'
}
export default function MiniPiano({ rootPc, lh = [], rh = [] }) {
// ════════════════════════════════════════════════════════════════════════════
// LEGACY render path — {rootPc, lh, rh}. UNCHANGED from the original component.
// ════════════════════════════════════════════════════════════════════════════
function LegacyPiano({ rootPc, lh = [], rh = [] }) {
const OCTAVES = 2
const TOTAL_WHITES = WHITE_PCS.length * OCTAVES // 14
const SVG_W = WW * TOTAL_WHITES + 2
const SVG_H = WH + 24
// Build a set of highlighted notes: pc → { hand, interval }
// We span 2 octaves (semitones 0…23 above root), mapped to absolute pitch classes
const highlights = new Map() // absIdx → { color, label }
@@ -44,8 +88,7 @@ export default function MiniPiano({ rootPc, lh = [], rh = [] }) {
for (const iv of intervals) {
const octave = Math.floor(iv / 12)
const pc = (rootPc + iv) % 12
const absIdx = octave * 12 + pc // unique index per octave slot
highlights.set(`${octave}-${pc}`, { color: hand === 'L' ? '#3b82f6' : '#a855f7', label: handLabel(hand) })
highlights.set(`${octave}-${pc}`, { color: legacyNoteColor(hand), label: handLabel(hand) })
}
}
addNotes(lh, 'L')
@@ -86,8 +129,8 @@ export default function MiniPiano({ rootPc, lh = [], rh = [] }) {
<rect
x={x} y={1} width={WW - 1} height={WH}
rx={2}
fill={hl ? hl.color : '#f5f5f5'}
stroke="#374151"
fill={hl ? hl.color : WHITE_FILL}
stroke={WHITE_STROKE}
strokeWidth={0.5}
/>
{hl && (
@@ -105,8 +148,8 @@ export default function MiniPiano({ rootPc, lh = [], rh = [] }) {
<rect
x={x} y={1} width={BW} height={BH}
rx={2}
fill={hl ? hl.color : '#1f2937'}
stroke="#111827"
fill={hl ? hl.color : BLACK_FILL}
stroke={BLACK_STROKE}
strokeWidth={0.5}
/>
{hl && (
@@ -124,7 +167,7 @@ export default function MiniPiano({ rootPc, lh = [], rh = [] }) {
if (!isRoot) return null
return (
<text key={`lbl${absWi}`} x={x + (WW - 1) / 2} y={WH + 14}
textAnchor="middle" fill="#a855f7" fontSize={8} fontWeight="bold">
textAnchor="middle" fill={ACCENT} fontSize={8} fontWeight="bold">
R
</text>
)
@@ -132,3 +175,158 @@ export default function MiniPiano({ rootPc, lh = [], rh = [] }) {
</svg>
)
}
// ════════════════════════════════════════════════════════════════════════════
// VOICING render path — renders a pianoVoicing({notes,pcs,bass,style,label}).
// `notes` are absolute semitone positions, 0 = C of the low octave, range [0,36].
// ════════════════════════════════════════════════════════════════════════════
function VoicingPiano({ voicing, size }) {
const isFull = size === 'full'
const isMini = size === 'mini' // L-70: cropped-thumb window at 0.60 for the dashboard 2×2 grid
const notes = Array.isArray(voicing?.notes) ? voicing.notes : []
const rootPc = ((voicing?.rootPc ?? (notes.length ? notes[0] : 0)) % 12 + 12) % 12
const bass = typeof voicing?.bass === 'number' ? voicing.bass : (notes.length ? Math.min(...notes) : null)
// ── Keyboard window (D-24) ──────────────────────────────────────────────────
// `full`: the original wide window — C-anchored, 23 octaves, enough to contain
// the highest note (byte-identical to the pre-D-24 output).
// `thumb`: crop to the voicing's whole-octave span. The window starts at the
// octave C at-or-below the lowest sounded key (octStart) and runs whole
// octaves until the closing C at-or-above the highest key, so white-key
// geometry stays simple and a ≤1-octave voicing renders ONE octave.
// The trailing high C is always drawn (window note octStart*12 +
// OCTAVES*12), so a top note landing exactly on the octave boundary
// still shows without adding a whole extra octave.
const maxNote = notes.length ? Math.max(...notes) : 0
const minNote = notes.length ? Math.min(...notes) : 0
const octStart = isFull ? 0 : Math.floor(minNote / 12)
const OCTAVES = isFull
? Math.min(3, Math.max(2, Math.ceil((maxNote + 1) / 12)))
: Math.max(1, Math.ceil((maxNote - octStart * 12) / 12))
// White keys: OCTAVES full octaves + 1 trailing C closing the top octave.
const TOTAL_WHITES = WHITE_PCS.length * OCTAVES + 1
const scale = isFull ? 1 : isMini ? 0.6 : 0.8
const baseW = WW * TOTAL_WHITES + 2
const SVG_W = baseW * scale
const SVG_H = (WH + (isFull ? 26 : 4)) * scale
// A highlighted absolute note → its render style. Keyed by absolute note value.
const noteSet = new Set(notes)
function styleFor(absNote) {
if (!noteSet.has(absNote)) return null
const pc = ((absNote % 12) + 12) % 12
return {
isRoot: pc === rootPc,
isBass: absNote === bass,
color: pc === rootPc ? ACCENT : ACCENT_SOFT,
}
}
// White keys across OCTAVES octaves + trailing C. `oct` is window-relative
// (drives x geometry); absNote adds octStart so highlights land on the right
// keys inside a cropped window.
const whites = []
for (let oct = 0; oct < OCTAVES; oct++) {
for (let wi = 0; wi < WHITE_PCS.length; wi++) {
const pc = WHITE_PCS[wi]
const absWi = oct * WHITE_PCS.length + wi
const absNote = (octStart + oct) * 12 + pc // absolute semitone of this white key
const x = absWi * WW + 1
whites.push({ x, absWi, absNote, hl: styleFor(absNote) })
}
}
// Trailing high C (top of the renderable window, e.g. note 36 when OCTAVES=3).
{
const absWi = OCTAVES * WHITE_PCS.length
const absNote = (octStart + OCTAVES) * 12
whites.push({ x: absWi * WW + 1, absWi, absNote, hl: styleFor(absNote) })
}
// Black keys across OCTAVES octaves.
const blacks = []
for (let oct = 0; oct < OCTAVES; oct++) {
for (const { pc, afterWhite } of BLACK_OFFSETS) {
const absWi = oct * WHITE_PCS.length + afterWhite
const absNote = (octStart + oct) * 12 + pc
const x = absWi * WW + WW - BW / 2
blacks.push({ x, pc, oct, absNote, hl: styleFor(absNote) })
}
}
const ariaLabel = `Piano voicing${voicing?.label ? `: ${voicing.label}` : ''}`
return (
<svg
width={SVG_W} height={SVG_H} viewBox={`0 0 ${baseW} ${WH + (isFull ? 26 : 4)}`}
className="overflow-visible" role="img" aria-label={ariaLabel}
>
{/* White keys */}
{whites.map(({ x, hl, absWi }) => (
<g key={`w${absWi}`}>
<rect
x={x} y={1} width={WW - 1} height={WH}
rx={2}
fill={hl ? hl.color : WHITE_FILL}
stroke={WHITE_STROKE}
strokeWidth={0.5}
/>
{hl?.isBass && (
<rect
x={x + 1} y={2} width={WW - 3} height={WH - 2}
rx={2} fill="none" stroke={BASS_RING} strokeWidth={isMini ? 2.5 : 2}
/>
)}
{hl?.isRoot && (
<text x={x + (WW - 1) / 2} y={WH - 8}
textAnchor="middle" fill="white" fontSize={isMini ? 10 : 8} fontWeight="bold">
R
</text>
)}
</g>
))}
{/* Black keys */}
{blacks.map(({ x, pc, oct, hl }) => (
<g key={`b${oct}-${pc}`}>
<rect
x={x} y={1} width={BW} height={BH}
rx={2}
fill={hl ? hl.color : BLACK_FILL}
stroke={BLACK_STROKE}
strokeWidth={0.5}
/>
{hl?.isBass && (
<rect
x={x + 1} y={2} width={BW - 2} height={BH - 2}
rx={2} fill="none" stroke={BASS_RING} strokeWidth={isMini ? 2.5 : 2}
/>
)}
{hl?.isRoot && (
<text x={x + BW / 2} y={BH - 5}
textAnchor="middle" fill="white" fontSize={isMini ? 8 : 6} fontWeight="bold">
R
</text>
)}
</g>
))}
{/* Caption (full size only): label + style */}
{isFull && voicing?.label && (
<text x={baseW / 2} y={WH + 20}
textAnchor="middle" fill={ACCENT} fontSize={9} fontWeight="bold">
{voicing.label}
</text>
)}
</svg>
)
}
// ════════════════════════════════════════════════════════════════════════════
// Public component — dispatches on whether `voicing` is supplied (additive).
// ════════════════════════════════════════════════════════════════════════════
export default function MiniPiano({ rootPc, lh = [], rh = [], voicing, size = 'thumb' }) {
if (voicing) {
return <VoicingPiano voicing={voicing} size={size} />
}
return <LegacyPiano rootPc={rootPc} lh={lh} rh={rh} />
}
+32 -12
View File
@@ -37,7 +37,10 @@ function keyColor(isChordTone, isPenta, isScale, isBlack, mono = false) {
: { fill: '#f5f5f5', text: '#6b7280' }
}
export default function Piano({ keyInfo, currentChord, monoColor = false }) {
// `compact` (task L-50, one-screen.md §2): trimmed card chrome (p-3, legend
// merged onto the heading line) + a natural-width cap on the SVG (max-width =
// its viewBox width, so it never renders above scale 1.0).
export default function Piano({ keyInfo, currentChord, monoColor = false, compact = false }) {
const { root, mode } = keyInfo ?? {}
if (!root) return null
@@ -51,15 +54,36 @@ export default function Piano({ keyInfo, currentChord, monoColor = false }) {
const svgW = totalWhite * KEY_W + 2
const svgH = KEY_H + 20 // +20 for octave labels
const heading = (
<p className={`text-sm text-gray-500 uppercase tracking-widest ${compact ? '' : 'mb-4'}`}>
Piano {root} {mode}
{currentChord && <span className="text-amber-400 ml-2">/ {currentChord}</span>}
</p>
)
const legend = (
// Critic mechanical fix (L-50 gate): non-compact keeps HEAD's exact class
// string so the non-compact render stays byte-identical to the committed one.
<div className={compact ? 'flex items-center text-xs text-gray-500 flex-wrap gap-3' : 'mt-3 flex gap-5 text-xs text-gray-500'}>
<span><span className="text-accent"></span> Chord tone</span>
<span><span style={{ color: monoColor ? '#c084fc' : '#f59e0b' }}></span> Pentatonic</span>
<span><span style={{ color: monoColor ? '#e9d5ff' : '#6b7280' }}></span> Scale</span>
</div>
)
return (
<div className="bg-panel border border-border rounded-2xl p-6">
<p className="text-sm text-gray-500 uppercase tracking-widest mb-4">
Piano {root} {mode}
{currentChord && <span className="text-amber-400 ml-2">/ {currentChord}</span>}
</p>
<div className={`bg-panel border border-border rounded-2xl ${compact ? 'p-3' : 'p-6'}`}>
{compact ? (
<div className="mb-2 flex flex-wrap items-center justify-between gap-x-4 gap-y-1">
{heading}
{legend}
</div>
) : (
heading
)}
<div>
<svg viewBox={`0 0 ${svgW} ${svgH}`} width="100%" height="auto" style={{ display: 'block' }}>
<svg viewBox={`0 0 ${svgW} ${svgH}`} width="100%" height="auto" style={{ display: 'block', ...(compact ? { maxWidth: svgW } : null) }}>
{/* White keys */}
{Array.from({ length: OCTAVES }, (_, oct) =>
@@ -132,11 +156,7 @@ export default function Piano({ keyInfo, currentChord, monoColor = false }) {
</svg>
</div>
<div className="mt-3 flex gap-5 text-xs text-gray-500">
<span><span className="text-accent"></span> Chord tone</span>
<span><span style={{ color: monoColor ? '#c084fc' : '#f59e0b' }}></span> Pentatonic</span>
<span><span style={{ color: monoColor ? '#e9d5ff' : '#6b7280' }}></span> Scale</span>
</div>
{!compact && legend}
</div>
)
}
+624
View File
@@ -0,0 +1,624 @@
// PianoLickCard — degree-based piano lick renderer (task D-60).
//
// Renders one structured piano lick from the KB `licks` schema for piano packs
// (src/data/kb/SCHEMA.md "Piano licks"): degree-language notes realized over a
// LIVE root — the same reasoning as BassPatternCard: the data transposes, the
// card shows the actual keys under your hands right now.
//
// { id, name, level, chordContext, quality, techniques[], source?, tips?,
// notes: [{ deg|approach, octave?, beat?, technique? }] } // ordered
//
// ── Realization (SCHEMA.md rules) ─────────────────────────────────────────────
// Pitch space: MiniPiano's absolute-note window, 0 = C3, range [0, 36] — which
// is ALSO chordAudio's playVoicing space (its doc: "0 = the C of the low
// displayed octave = C3"), so realized notes drop straight into playback.
// · The ROOT sits at its pitch class in the bottom octave: rootAbs = rootPc
// (011). The schema caps every resolved offset at 25 semitones, so the
// highest legal note is 11 + 25 = 36 — every lick fits in all 12 keys.
// · A `deg` note: abs = rootAbs + resolveDegree(deg, lick.quality) + 12·octave.
// `quality` is the lick's own machine truth (NOT the live chord's quality —
// the lick states what it resolves through; the caller picks licks that fit).
// · An `approach` note derives from the NEXT `deg` note in `notes[]` order
// (scanning past intervening approaches): chrom-below = target 1,
// chrom-above = target + 1. Approaches are non-terminal by schema; a lick
// ending on an approach (or any unresolvable note) nulls the realization and
// the card renders an honest placeholder instead of lying.
//
// ── Visual design (thumb): pitch-timeline ─────────────────────────────────────
// x = beat (proportional columns when every note carries a beat, LickCard-style
// even columns otherwise), y = pitch — a piano-roll miniature. Chosen over
// order-numbered keyboard dots for the thumb because a lick IS contour + rhythm:
// the line shape reads at strip size without decoding numbers. Note markers are
// LickCard's surface-pill idiom carrying NOTE NAMES (the actionable info for a
// keyboard player), connected by a faint contour line; dashed accent lines mark
// the root pitch ("R" gutter label) so "home" is visible at a glance.
//
// Colour tiers (established language, Fretboard/Piano/BassPatternCard):
// chord tone → purple (ACCENT_SOFT text; root itself full ACCENT)
// other scale degrees/extensions → gray-200
// approaches (borrowed chromatics) → amber, like BassPatternCard
// ghost-note → parenthesised, dimmed (LickCard idiom)
//
// Technique glyphs (amber): grace-note = slashed mini-note crushed before its
// target · slide = thicker amber glissando segment replacing that contour hop ·
// double-stop = stacked pills at one x (equal beats; or LickCard's column rule
// beatless) · ghost-note = the parenthesised dim label. <PianoTechniqueLegend/>
// renders the key ONCE per grid (LickCard's TechniqueLegend contract).
//
// `size="full"` adds: chordContext chip, an order-numbered keyboard view
// (MiniPiano's cropped-window geometry), technique chips, tips, source —
// mirroring LickCard's full-size behaviour.
//
// ── No playback (D-70 §3) ─────────────────────────────────────────────────────
// The strip is purely visual — glance over audio (the user's settled call, "then
// leave them off, better not"). The ▶ play path (sequencer + PlayButton) was
// removed with the rest of the ▶s across the app; the card only renders now.
//
// ── Wiring contract (LicksStrip integration — Luthier, L-71) ──────────────────
// <PianoLickCard lick={…} rootPc={011} chordLabel="Dm7" size="thumb|full" />
// lick — one entry of a piano pack's top-level `licks` array
// rootPc — the LIVE chord root pitch class (from the loop station)
// chordLabel — optional display name for aria/captions (falls back to
// NOTES[rootPc] + quality)
// Pure/presentational; never crashes on bad data (placeholder instead).
//
// Design tokens (tailwind.config.js) — SVG fills can't read Tailwind classes,
// so the constants below mirror the tokens (LickCard/MiniPiano convention).
import { NOTES, CHORD_TYPES } from '../lib/theory'
import { resolveDegree } from './JamGuide'
// ─── Vocabulary (hand-synced with validate-kb.mjs PIANO_LICK_TECHNIQUES; the
// smoke §7b-piano guard enforces set-equality — add to BOTH or neither) ────
export const PIANO_TECHNIQUE_VOCAB = ['slide', 'double-stop', 'ghost-note', 'grace-note']
// Chip symbol per technique (technique-tag chips, full size).
const TECH_SYMBOL = {
slide: '',
'double-stop': '⋮',
'ghost-note': '( )',
'grace-note': '♪',
}
// ─── Palette (mirrors tailwind.config.js tokens + MiniPiano's key colours) ────
const ACCENT = '#a855f7' // token `accent` — the root (focal tone)
const ACCENT_SOFT = '#c084fc' // lighter accent — chord tones (MiniPiano tier)
const AMBER = '#f59e0b' // token `amber` — approaches + technique glyphs
const NOTE_TEXT = '#e5e7eb' // gray-200 — non-chord-tone degrees
const GHOST_TEXT = '#9ca3af' // gray-400 — ghost notes (dim but AA)
const CONTOUR = '#3a3a3a' // contour line (decorative, LickCard string idiom)
const LABEL = '#6b7280' // gray-500 — beat numbers / gutter microcopy
const CARD_BG = '#0f0f0f' // token `surface` — backing pills
const WHITE_FILL = '#f5f5f5' // MiniPiano key colours (keyboard view)
const BLACK_FILL = '#1f2937'
const WHITE_STROKE = '#374151'
const BLACK_STROKE = '#111827'
const APPROACH_DELTA = { 'chrom-below': -1, 'chrom-above': 1 }
const ABS_MAX = 36 // MiniPiano window top key
const mod12 = (n) => ((n % 12) + 12) % 12
// abs (0 = C3) → "A3"/"F4"… scientific spelling, for aria pitch lists.
const absName = (abs) => `${NOTES[mod12(abs)]}${Math.floor(abs / 12) + 3}`
/**
* realizePianoLick(lick, rootPc)
* → [{ abs, name, beat?, technique?, approach, chordTone, isRoot }] | null
*
* Pure realization per the header rules. Returns null on ANY malformed or
* out-of-window note so the caller renders a placeholder — authored data is
* validator-guaranteed, but a renderer must never crash on bad input.
*/
export function realizePianoLick(lick, rootPc) {
if (!lick || typeof lick !== 'object' || !Number.isFinite(rootPc)) return null
const notes = lick.notes
if (!Array.isArray(notes) || notes.length === 0) return null
const quality = lick.quality
const intervals = CHORD_TYPES[quality]?.intervals
if (!intervals) return null // quality is required machine truth (schema)
const root = mod12(rootPc)
const chordPcs = new Set(intervals.map(mod12))
// Pass 1: resolve every deg note's absolute pitch.
const abs = new Array(notes.length).fill(null)
for (let i = 0; i < notes.length; i++) {
const n = notes[i]
if (!n || typeof n !== 'object') return null
const isDeg = n.deg !== undefined
const isApp = n.approach !== undefined
if (isDeg === isApp) return null // exactly one of deg | approach (schema)
if (isDeg) {
const off = resolveDegree(String(n.deg), quality)
if (off === null || off === undefined) return null
const oct = n.octave === undefined ? 0 : n.octave
if (![0, 1, 2].includes(oct)) return null
abs[i] = root + off + 12 * oct
}
}
// Pass 2: approaches derive from the NEXT deg note (schema: never terminal).
for (let i = 0; i < notes.length; i++) {
if (abs[i] !== null) continue
const delta = APPROACH_DELTA[notes[i].approach]
if (delta === undefined) return null
const target = abs.slice(i + 1).find((a) => a !== null)
if (target === undefined) return null // approach with nothing to target
abs[i] = target + delta
}
if (abs.some((a) => a < 0 || a > ABS_MAX)) return null // outside the window
return notes.map((n, i) => ({
abs: abs[i],
name: NOTES[mod12(abs[i])],
beat: Number.isFinite(n.beat) ? n.beat : undefined,
technique: typeof n.technique === 'string' ? n.technique : undefined,
approach: n.approach !== undefined,
chordTone: !(n.approach !== undefined) && chordPcs.has(mod12(abs[i] - root)),
isRoot: !(n.approach !== undefined) && mod12(abs[i] - root) === 0,
}))
}
// ─── Timeline layout (x = beat/column, y = pitch) ─────────────────────────────
const PAD_T = 14 // headroom for grace glyphs above the top pill
const PAD_B = 8
const PAD_L = 16 // gutter for the "R" root-line label
const PAD_R = 12
const COL_W = 26 // beatless column pitch (LickCard's)
const BEAT_ROW = 10
const SEMI_MIN = 3 // px per semitone bounds — wide licks compress,
const SEMI_MAX = 7 // narrow licks stretch, so contour stays legible
function layoutLick(realized, rootPc) {
const hasBeats =
realized.every((n) => Number.isFinite(n.beat)) &&
realized.every((n, i) => i === 0 || n.beat >= realized[i - 1].beat)
// x: proportional to beat when authored (BassPatternCard), else LickCard
// columns — where a double-stop stacks into the previous column.
let xs, width, maxBeat = null, unit = null
if (hasBeats) {
const gaps = realized
.map((n, i) => (i > 0 ? n.beat - realized[i - 1].beat : 0))
.filter((g) => g > 0)
const minGap = gaps.length ? Math.min(...gaps) : 1
unit = Math.min(COL_W / minGap, COL_W * 4)
xs = realized.map((n) => PAD_L + (n.beat - 1) * unit + 10)
maxBeat = realized[realized.length - 1].beat
width = PAD_L + (maxBeat - 1) * unit + 20 + PAD_R
} else {
let col = -1
xs = realized.map((n, i) => {
const stacks = i > 0 && n.technique === 'double-stop'
if (!stacks) col++
return PAD_L + col * COL_W + COL_W / 2
})
width = PAD_L + (col + 1) * COL_W + PAD_R
}
// y: linear pitch axis over the lick's own range.
const lo = Math.min(...realized.map((n) => n.abs))
const hi = Math.max(...realized.map((n) => n.abs))
const range = Math.max(1, hi - lo)
const semi = Math.min(SEMI_MAX, Math.max(SEMI_MIN, 66 / range))
const plotH = Math.max(26, range * semi)
const yFor = (a) => PAD_T + plotH - (a - lo) * semi
return {
hasBeats,
maxBeat,
unit,
width,
height: PAD_T + plotH + PAD_B + (hasBeats ? BEAT_ROW : 0),
plotBottom: PAD_T + plotH,
// Root reference lines: every root-pc pitch inside the plotted range.
rootYs: Array.from({ length: hi - lo + 1 }, (_, k) => lo + k)
.filter((a) => mod12(a) === mod12(rootPc))
.map(yFor),
notes: realized.map((n, i) => ({
...n,
x: xs[i],
y: yFor(n.abs),
label: n.technique === 'ghost-note' ? `(${n.name})` : n.name,
ghost: n.technique === 'ghost-note',
})),
}
}
function pillColor(n) {
if (n.approach) return AMBER
if (n.ghost) return GHOST_TEXT
if (n.isRoot) return ACCENT
if (n.chordTone) return ACCENT_SOFT
return NOTE_TEXT
}
// Grace ornament: slashed mini-note crushed just before its target pill.
function GraceGlyph({ note }) {
const cx = note.x - 12
const cy = note.y - 8
return (
<g>
<circle cx={cx} cy={cy} r={2} fill={AMBER} />
<line x1={cx - 3} y1={cy + 3} x2={cx + 3} y2={cy - 3}
stroke={AMBER} strokeWidth={1} strokeLinecap="round" />
<path d={`M ${cx + 2.5} ${cy} Q ${(cx + note.x) / 2} ${cy - 4} ${note.x - 6} ${note.y - 4}`}
fill="none" stroke={AMBER} strokeWidth={0.9} />
</g>
)
}
function TimelineSvg({ layout, ariaLabel }) {
const { notes, width, height, hasBeats, maxBeat, unit, plotBottom, rootYs } = layout
return (
<svg
viewBox={`0 0 ${width} ${height}`}
width="100%"
style={{ display: 'block', height: 'auto', maxWidth: width * 1.4 }}
role="img"
aria-label={ariaLabel}
>
{/* Root ("home") reference lines + gutter label */}
{rootYs.map((y, i) => (
<g key={`r${i}`}>
<line x1={PAD_L - 4} y1={y} x2={width - PAD_R + 4} y2={y}
stroke={ACCENT} strokeOpacity={0.3} strokeWidth={1} strokeDasharray="3 3" />
<text x={6} y={y + 2.5} textAnchor="middle" fontSize={6.5} fill={ACCENT} fillOpacity={0.75}>
R
</text>
</g>
))}
{/* Beat numbers (only when beats are authored; x mirrors note columns) */}
{hasBeats &&
Array.from({ length: Math.floor(maxBeat + 1e-6) }, (_, b) => (
<text key={`b${b}`} x={PAD_L + b * unit + 10} y={plotBottom + BEAT_ROW}
textAnchor="middle" fontSize={6.5} fill={LABEL}>
{b + 1}
</text>
))}
{/* Contour: connect consecutive notes when x advances (dyad partners
float stacked); a slide hop redraws its segment as a thicker amber
glissando line. */}
{notes.map((n, i) => {
const prev = notes[i - 1]
if (!prev || n.x <= prev.x) return null
const slide = n.technique === 'slide'
return (
<line key={`c${i}`}
x1={prev.x} y1={prev.y} x2={n.x} y2={n.y}
stroke={slide ? AMBER : CONTOUR}
strokeWidth={slide ? 1.6 : 1}
strokeLinecap="round"
/>
)
})}
{/* Grace ornaments (above the pills) */}
{notes.map((n, i) => (n.technique === 'grace-note' ? <GraceGlyph key={`g${i}`} note={n} /> : null))}
{/* Note-name pills at pitch height — LickCard's fret-pill idiom */}
{notes.map((n, i) => {
const w = n.label.length * 5.2 + 4
return (
<g key={`n${i}`}>
<rect x={n.x - w / 2} y={n.y - 5.5} width={w} height={11} rx={2} fill={CARD_BG} />
<text x={n.x} y={n.y + 3.2} textAnchor="middle" fontSize={9}
fontWeight="600" fill={pillColor(n)}>
{n.label}
</text>
</g>
)
})}
</svg>
)
}
// ─── Keyboard view (full size): which keys, in what order ────────────────────
// MiniPiano's cropped-window geometry (whole-octave span + trailing high C),
// replicated here because order badges aren't part of MiniPiano's contract.
const WW = 22
const WH = 60
const BW = 14
const BH = 38
const WHITE_PCS = [0, 2, 4, 5, 7, 9, 11]
const BLACK_OFFSETS = [
{ pc: 1, afterWhite: 0 }, { pc: 3, afterWhite: 1 }, { pc: 6, afterWhite: 3 },
{ pc: 8, afterWhite: 4 }, { pc: 10, afterWhite: 5 },
]
function LickKeyboard({ realized, ariaLabel }) {
// abs → { orders: [1-based strike order…], tier }
const hits = new Map()
realized.forEach((n, i) => {
const h = hits.get(n.abs) ?? { orders: [], isRoot: false, deg: false, approach: false }
h.orders.push(i + 1)
h.isRoot ||= n.isRoot
h.deg ||= !n.approach
h.approach ||= n.approach
hits.set(n.abs, h)
})
const lo = Math.min(...realized.map((n) => n.abs))
const hi = Math.max(...realized.map((n) => n.abs))
const octStart = Math.floor(lo / 12)
const OCTAVES = Math.max(1, Math.ceil((hi - octStart * 12) / 12))
const TOTAL_WHITES = WHITE_PCS.length * OCTAVES + 1
const baseW = WW * TOTAL_WHITES + 2
const scale = 0.85
const fillFor = (h) => (h.deg ? (h.isRoot ? ACCENT : ACCENT_SOFT) : AMBER)
const whites = []
for (let oct = 0; oct < OCTAVES; oct++) {
for (let wi = 0; wi < WHITE_PCS.length; wi++) {
const absWi = oct * WHITE_PCS.length + wi
whites.push({ x: absWi * WW + 1, absWi, absNote: (octStart + oct) * 12 + WHITE_PCS[wi] })
}
}
whites.push({
x: OCTAVES * WHITE_PCS.length * WW + 1,
absWi: OCTAVES * WHITE_PCS.length,
absNote: (octStart + OCTAVES) * 12,
})
const blacks = []
for (let oct = 0; oct < OCTAVES; oct++) {
for (const { pc, afterWhite } of BLACK_OFFSETS) {
blacks.push({
x: (oct * WHITE_PCS.length + afterWhite) * WW + WW - BW / 2,
key: `${oct}-${pc}`,
absNote: (octStart + oct) * 12 + pc,
})
}
}
return (
<svg width={baseW * scale} height={(WH + 4) * scale} viewBox={`0 0 ${baseW} ${WH + 4}`}
className="overflow-visible" role="img" aria-label={ariaLabel}>
{whites.map(({ x, absWi, absNote }) => {
const h = hits.get(absNote)
return (
<g key={`w${absWi}`}>
<rect x={x} y={1} width={WW - 1} height={WH} rx={2}
fill={h ? fillFor(h) : WHITE_FILL} stroke={WHITE_STROKE} strokeWidth={0.5} />
{h && (
<text x={x + (WW - 1) / 2} y={WH - 6} textAnchor="middle"
fontSize={7} fontWeight="bold" fill={h.deg ? 'white' : 'black'}>
{h.orders.join('·')}
</text>
)}
</g>
)
})}
{blacks.map(({ x, key, absNote }) => {
const h = hits.get(absNote)
return (
<g key={`b${key}`}>
<rect x={x} y={1} width={BW} height={BH} rx={2}
fill={h ? fillFor(h) : BLACK_FILL} stroke={BLACK_STROKE} strokeWidth={0.5} />
{h && (
<text x={x + BW / 2} y={BH - 5} textAnchor="middle"
fontSize={6} fontWeight="bold" fill={h.deg ? 'white' : 'black'}>
{h.orders.join('·')}
</text>
)}
</g>
)
})}
</svg>
)
}
// ─── Card chrome (LickCard's idiom) ───────────────────────────────────────────
function LevelBadge({ level }) {
if (level === 'intermediate') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-amber border border-amber/40 rounded px-1.5 py-px">
intermediate
</span>
)
}
if (level === 'foundation') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-gray-400 border border-border rounded px-1.5 py-px">
foundation
</span>
)
}
return null
}
function TechniqueChip({ tech }) {
const symbol = TECH_SYMBOL[tech]
return (
<span className="inline-flex items-center gap-1 text-[10px] text-gray-400 border border-border rounded-full px-1.5 py-px">
{symbol && <span className="text-amber font-semibold" aria-hidden="true">{symbol}</span>}
{tech}
</span>
)
}
function PlaceholderCard({ name, size }) {
return (
<div
className={`bg-surface border border-border rounded-lg flex flex-col items-center justify-center text-gray-500 ${size === 'thumb' ? 'p-2 min-h-[72px]' : 'p-4 min-h-[110px]'}`}
role="group"
aria-label={name ? `${name}: lick unavailable` : 'lick unavailable'}
>
<span className="text-lg leading-none" aria-hidden="true"></span>
<span className="text-[10px] mt-1">
{name ? `${name} — lick unavailable` : 'lick unavailable'}
</span>
</div>
)
}
/**
* <PianoLickCard lick={…} rootPc={011} chordLabel? size="thumb"|"full" />
* Pure/presentational — realizes one KB piano lick over the live chord root;
* never crashes on bad data. See the header for the full wiring contract.
*/
export default function PianoLickCard({ lick, rootPc, chordLabel, size = 'full' }) {
const realized = realizePianoLick(lick, rootPc)
const name = typeof lick?.name === 'string' && lick.name.trim() ? lick.name : 'Untitled lick'
if (!realized) {
return <PlaceholderCard name={lick ? name : null} size={size} />
}
const full = size === 'full'
const chordName =
typeof chordLabel === 'string' && chordLabel.trim()
? chordLabel
: `${NOTES[mod12(rootPc)]}${CHORD_TYPES[lick.quality]?.suffix ?? lick.quality}`
const chordContext =
typeof lick.chordContext === 'string' && lick.chordContext.trim() ? lick.chordContext : null
const techniques = Array.isArray(lick.techniques)
? lick.techniques.filter((t) => typeof t === 'string' && t.trim())
: []
const source = typeof lick.source === 'string' && lick.source.trim() ? lick.source : null
const tips = typeof lick.tips === 'string' && lick.tips.trim() ? lick.tips : null
const layout = layoutLick(realized, rootPc)
const pitchNames = realized.map((n) => absName(n.abs)).join(', ')
return (
<div
className={`bg-surface border border-border rounded-lg flex flex-col ${full ? 'p-3 gap-2' : 'p-2 gap-1.5'}`}
role="group"
aria-label={`${name} — over ${chordName}${chordContext ? ` (${chordContext})` : ''}`}
>
{/* Header: name + level badge */}
<div className="flex items-start justify-between gap-2">
<span className={`text-gray-200 font-semibold leading-tight ${full ? 'text-sm' : 'text-[11px]'}`}>
{name}
</span>
<LevelBadge level={lick.level} />
</div>
{/* Where it lands */}
{full && chordContext && (
<div>
<span className="inline-block text-[10px] font-medium text-accent bg-accent/10 border border-accent/40 rounded-full px-2 py-px">
{chordContext} · here: {chordName}
</span>
</div>
)}
{/* The pitch timeline */}
<div className="max-w-full overflow-x-auto dark-scroll">
<TimelineSvg
layout={layout}
ariaLabel={`Melody for ${name} over ${chordName}: ${pitchNames}`}
/>
</div>
{/* Keyboard view (full): the actual keys, numbered in strike order */}
{full && (
<div className="max-w-full overflow-x-auto dark-scroll">
<LickKeyboard
realized={realized}
ariaLabel={`Keys for ${name} over ${chordName}, numbered in playing order`}
/>
</div>
)}
{/* Technique tags */}
{full && techniques.length > 0 && (
<div className="flex flex-wrap gap-1">
{techniques.map((t) => <TechniqueChip key={t} tech={t} />)}
</div>
)}
{/* Transferable idea + attribution */}
{full && tips && <p className="text-[10px] leading-snug text-gray-500">{tips}</p>}
{full && source && (
<span className="text-[10px] text-gray-500 italic leading-snug">{source}</span>
)}
</div>
)
}
// ─── Glyph legend — render ONCE per lick grid (LickCard contract) ─────────────
function LegendSample({ children, w = 22 }) {
return (
<svg viewBox={`0 0 ${w} 18`} width={w} height={18} aria-hidden="true"
style={{ display: 'inline-block', verticalAlign: 'middle' }}>
{children}
</svg>
)
}
export function PianoTechniqueLegend() {
const items = [
{
key: 'grace-note', label: 'grace note',
sample: (
<LegendSample>
<circle cx={5} cy={7} r={2} fill={AMBER} />
<line x1={2} y1={10} x2={8} y2={4} stroke={AMBER} strokeWidth={1} strokeLinecap="round" />
<path d="M 7 8 Q 12 5 16 10" fill="none" stroke={AMBER} strokeWidth={0.9} />
<circle cx={17} cy={12} r={3} fill={NOTE_TEXT} />
</LegendSample>
),
},
{
key: 'slide', label: 'slide (key-slip)',
sample: (
<LegendSample>
<line x1={4} y1={13} x2={18} y2={5} stroke={AMBER} strokeWidth={1.6} strokeLinecap="round" />
</LegendSample>
),
},
{
key: 'double-stop', label: 'double-stop (stacked)',
sample: (
<LegendSample>
<text x={11} y={8} textAnchor="middle" fontSize={8} fontWeight="600" fill={NOTE_TEXT}>G</text>
<text x={11} y={17} textAnchor="middle" fontSize={8} fontWeight="600" fill={NOTE_TEXT}>D</text>
</LegendSample>
),
},
{
key: 'ghost-note', label: 'ghost note',
sample: (
<LegendSample>
<text x={11} y={12} textAnchor="middle" fontSize={9} fontWeight="600" fill={GHOST_TEXT}>(E)</text>
</LegendSample>
),
},
]
return (
<div className="flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[11px] text-gray-400">
{items.map((it) => (
<span key={it.key} className="inline-flex items-center gap-1.5">
{it.sample}
{it.label}
</span>
))}
<span className="text-gray-500">amber = chromatic approach · purple = chord tone · R line = the root</span>
</div>
)
}
// ─── Dev fixture — SCHEMA.md's worked enclosure (P-60 real data replaces this
// in the app; exported so the card can be exercised before P-60 lands) ─────
export const DEMO_PIANO_LICK = {
id: 'jazz-enclosure-into-3',
name: 'Bebop enclosure into the 3rd',
level: 'intermediate',
chordContext: 'over the ii7',
quality: 'min7',
techniques: ['grace-note'],
source: 'Barry Harris workshop vocabulary',
notes: [
{ deg: '5', octave: 1, beat: 1 },
{ approach: 'chrom-above', beat: 2 },
{ approach: 'chrom-below', beat: 2.5 },
{ deg: '3', octave: 1, beat: 3, technique: 'grace-note' },
],
}
+84 -86
View File
@@ -2,15 +2,29 @@ import { useRef, useEffect } from 'react'
import { toRomanNumeral } from '../lib/theory'
import { findLoopPosition } from '../lib/match'
const HISTORY_SHOWN = 8
// ─── ProgressionBanner — the SLIM LOOP STRIP (task L-50, one-screen.md §1.2) ──
//
// One full-width status row: key chip · chord history (last 5, age-faded) ·
// ♻ loop chips. The old right-30% "Now Playing" text-6xl chord + its divider
// are GONE per the user directive — the enlarged current history chip and the
// accent-glowing active loop chip ARE the now-playing display. Chrome trimmed
// (p-4 → p-2, history pb-1 dropped) so the strip lands at ~76px.
const HISTORY_SHOWN = 5
export default function ProgressionBanner({ chordHistory, keyInfo, detectedProgression, currentChord, onChordClick }) {
export default function ProgressionBanner({ chordHistory, keyInfo, detectedProgression, seedInfo, onChordClick }) {
const { root, mode, confidence } = keyInfo ?? {}
// Jam-roulette provenance (task L-60, jam-roulette.md §1.3): while a rolled
// loop is unconfirmed the loop row swaps its ♻ chrome for 🎲 + an amber chip
// naming the source; it flips back to normal the moment live detection
// confirms it (App clears seedInfo). The loop chips themselves are identical.
const seedBars = Array.isArray(seedInfo?.bars)
? seedInfo.bars.reduce((a, b) => a + (b ?? 0), 0)
: null
const visible = chordHistory.slice(-HISTORY_SHOWN)
const current = visible[visible.length - 1]
const loopPos = findLoopPosition(chordHistory, detectedProgression)
const currentRN = root && current ? toRomanNumeral(current, root, mode) : ''
const currentRef = useRef(null)
const prevChord = useRef(null)
@@ -25,71 +39,69 @@ export default function ProgressionBanner({ chordHistory, keyInfo, detectedProgr
}, [current])
return (
<div className="bg-panel border border-border rounded-2xl p-4 mb-3 flex gap-4">
<div className="bg-panel border border-border rounded-2xl p-2 mb-3 flex flex-wrap items-end gap-x-3 gap-y-1">
{/* ── Left: key + chord history + loop ── */}
<div className="w-full lg:w-[70%] min-w-0 flex flex-col gap-2">
{/* Key + history on one row */}
<div className="flex items-end gap-3">
<div className="shrink-0 flex items-baseline gap-1.5">
{root ? (
<>
<span className="text-2xl font-bold text-accent">{root}</span>
<span className="text-gray-400 text-sm">{mode}</span>
{confidence && (
<span className="text-xs text-gray-600">{Math.round(confidence * 100)}%</span>
)}
</>
) : (
<span className="text-gray-600 text-sm">Detecting key</span>
{/* ── Key chip ── */}
<div className="shrink-0 flex items-baseline gap-1.5 self-center">
{root ? (
<>
<span className="text-2xl font-bold text-accent">{root}</span>
<span className="text-gray-400 text-sm">{mode}</span>
{confidence && (
<span className="text-xs text-gray-600">{Math.round(confidence * 100)}%</span>
)}
</div>
</>
) : (
<span className="text-gray-600 text-sm">Detecting key</span>
)}
</div>
<div className="w-px h-6 bg-border shrink-0" />
<div className="w-px h-6 bg-border shrink-0 self-center" />
{!chordHistory.length ? (
<p className="text-gray-600 text-sm">Start listening</p>
) : (
<div className="flex items-end gap-1 overflow-x-auto pb-1">
{visible.map((chord, i) => {
const isCurrent = i === visible.length - 1
const age = visible.length - 1 - i
const opacity = Math.max(0.25, 1 - age * 0.09)
const rn = root ? toRomanNumeral(chord, root, mode) : ''
return (
<div
key={i}
ref={isCurrent ? currentRef : null}
style={{ opacity }}
onClick={() => onChordClick?.(chord)}
className={`flex flex-col items-center shrink-0 px-2 py-1 rounded-xl transition-colors duration-200 cursor-pointer ${
isCurrent
? 'bg-accent/10 border border-accent/40 ring-1 ring-accent/20 hover:bg-accent/20'
: 'border border-transparent hover:border-border hover:bg-panel'
}`}
>
<span className={`font-black leading-none tracking-tight ${
isCurrent ? 'text-3xl text-accent' : 'text-xl text-gray-200'
}`}>
{chord}
</span>
<span className={`text-xs font-semibold mt-0.5 ${
isCurrent ? 'text-amber-400' : 'text-gray-500'
}`}>
{rn || '\u00A0'}
</span>
</div>
)
})}
</div>
)}
{/* ── Chord history (the enlarged current chip is the "now") ── */}
{!chordHistory.length ? (
<p className="text-gray-600 text-sm self-center">Start listening</p>
) : (
<div className="flex items-end gap-1 overflow-x-auto">
{visible.map((chord, i) => {
const isCurrent = i === visible.length - 1
const age = visible.length - 1 - i
const opacity = Math.max(0.25, 1 - age * 0.09)
const rn = root ? toRomanNumeral(chord, root, mode) : ''
return (
<div
key={i}
ref={isCurrent ? currentRef : null}
style={{ opacity }}
onClick={() => onChordClick?.(chord)}
className={`flex flex-col items-center shrink-0 px-2 py-1 rounded-xl transition-colors duration-200 cursor-pointer ${
isCurrent
? 'bg-accent/10 border border-accent/40 ring-1 ring-accent/20 hover:bg-accent/20'
: 'border border-transparent hover:border-border hover:bg-panel'
}`}
>
<span className={`font-black leading-none tracking-tight ${
isCurrent ? 'text-3xl text-accent' : 'text-xl text-gray-200'
}`}>
{chord}
</span>
<span className={`text-xs font-semibold mt-0.5 ${
isCurrent ? 'text-amber-400' : 'text-gray-500'
}`}>
{rn || ' '}
</span>
</div>
)
})}
</div>
)}
{/* Loop */}
{detectedProgression && (
<div className="flex items-center gap-1.5 flex-wrap">
<span className="text-xs text-gray-500"></span>
{/* ── Loop — on the same row (divider between); playhead chip = the now ── */}
{detectedProgression && (
<>
<div className="w-px h-6 bg-border shrink-0 self-center" />
<div className="flex items-center gap-1.5 flex-wrap self-center">
<span className="text-xs text-gray-500">{seedInfo ? '🎲' : '♻'}</span>
{detectedProgression.map((chord, i) => {
const isActive = i === loopPos
const rn = root ? toRomanNumeral(chord, root, mode) : chord
@@ -110,31 +122,17 @@ export default function ProgressionBanner({ chordHistory, keyInfo, detectedProgr
</div>
)
})}
<span className="text-gray-600 text-xs"> loop</span>
{seedInfo ? (
<span className="text-amber-400 text-xs">
rolled · {seedInfo.styleLabel} · {seedInfo.name}
{seedBars != null ? ` · ${seedBars} bars` : ''} play it!
</span>
) : (
<span className="text-gray-600 text-xs"> loop</span>
)}
</div>
)}
</div>
{/* ── Divider ── */}
<div className="hidden lg:block w-px bg-border shrink-0" />
{/* ── Right: big chord ── */}
<div className="hidden lg:flex w-[30%] flex-col items-center justify-center gap-1">
{current ? (
<button
onClick={() => onChordClick?.(current)}
className="flex flex-col items-center gap-1 px-4 py-2 rounded-xl hover:bg-accent/10 transition-colors group"
title="Click to see voicings"
>
<p className="text-xs text-gray-600 uppercase tracking-widest">Now Playing</p>
<div className="text-6xl font-black text-amber-400 leading-none group-hover:text-accent transition-colors">{current}</div>
<div className="text-sm text-gray-500">{currentRN}</div>
<p className="text-[10px] text-gray-700 group-hover:text-gray-500 transition-colors">tap for voicings</p>
</button>
) : (
<p className="text-gray-600 text-xs text-center">Play a chord</p>
)}
</div>
</>
)}
</div>
)
+450
View File
@@ -0,0 +1,450 @@
import { useMemo } from 'react'
import kb from '../data/kb/index.js'
import { NOTES, CHORD_TYPES } from '../lib/theory'
import {
buildLoopIndex,
matchLoopToProgression,
loopToDegrees,
canonicalDegrees,
chordRootPC,
} from '../lib/match'
// ─── RelatedProgressions — loop-relative songbook relatives (task L-51) ───────
//
// 35 KB progressions genuinely related to the DETECTED loop, replacing the
// retired generic ProgressionSuggestions table. KB-sourced only, loop-relative
// by construction. Spec: docs/design/one-screen.md §5 (ranking + render + empty
// states) and §6 (component boundary: pure/prop-driven, computes its own match
// so it stays file-disjoint from D-51's rail work).
//
// Props:
// loop : string[] | null — the detected repeating progression (chord names)
// keyInfo : { root, mode, confidence } | null — effective key (realizes chips)
// onChordClick : fn(chordName) — opens ChordDetailModal (App's setSelectedChord)
//
// The ranking (rankRelatedProgressions) is exported for smoke coverage.
// Suffix → KB quality token, derived from CHORD_TYPES (the vocabulary
// authority — same inverse mapping as match.js's private suffixToQuality; all
// 14 suffixes are unique). Unknown suffixes stay unmapped → wildcard (§5:
// match on Δ alone).
const SUFFIX_TO_QUALITY = Object.fromEntries(
Object.entries(CHORD_TYPES).map(([quality, def]) => [def.suffix, quality])
)
// §5 scoring constants.
const SCORE_SAME_CHANGES = 100 // same canonical degree shape
const SCORE_SAME_STYLE = 40 // same style as the matched progression
const SCORE_PER_TRANSITION = 12 // per shared (Δ, quality→quality) transition…
const TRANSITION_CAP = 36 // …capped (= 3 distinct transitions)
const SCORE_JACCARD = 16 // × rebased degree-set Jaccard
export const RELATED_SCORE_FLOOR = 24
export const RELATED_MAX_ENTRIES = 5
// The module-level index (§6: "matchLoopToProgression over a module-level
// index is trivially cheap") — built once, shared across renders.
const DEFAULT_INDEX = buildLoopIndex(kb)
// ─── The MANDATORY collapse step (§5 step 2) ──────────────────────────────────
// The live detected loop is a COLLAPSED form (detection never commits the same
// chord twice in a row), while KB `degrees` are raw, bar-per-bar — blues-12bar
// is [0,0,0,0,5,5,0,0,7,5,0,7]. Compared raw, the +100 same-shape term would
// never fire for collapse-affected KB progressions. So before
// canonicalDegrees(p.degrees) AND before building T(p): collapse consecutive
// equal (degree, quality) pairs — including the wrap-around pair (last === first
// as a cycle). Each surviving unit keeps the rn of its first bar for the
// "shares {rn}→{rn}" annotation.
// (L-60 will land a shared collapsed-form index in match.js; this local
// collapse is deliberately component-scoped until then — one-screen.md §9.)
export function collapseChanges(progression) {
const degrees = Array.isArray(progression?.degrees) ? progression.degrees : []
const qualities = Array.isArray(progression?.qualities) ? progression.qualities : []
const rn = Array.isArray(progression?.rn) ? progression.rn : []
const out = []
for (let i = 0; i < degrees.length; i++) {
const q = qualities[i] ?? null
const prev = out[out.length - 1]
if (prev && prev.deg === degrees[i] && prev.quality === q) continue
out.push({ deg: degrees[i], quality: q, rn: rn[i] ?? '' })
}
if (out.length > 1) {
const first = out[0]
const last = out[out.length - 1]
if (first.deg === last.deg && first.quality === last.quality) out.pop()
}
return out
}
// Transition set over units [{deg, quality, rn?}], wrap-around included (§5):
// triples (Δ = (deg[i+1] deg[i]) mod 12, q[i], q[i+1]); rn labels ride along
// for the annotation.
function transitionsOf(units) {
const n = units.length
if (n < 2) return []
const out = []
for (let i = 0; i < n; i++) {
const a = units[i]
const b = units[(i + 1) % n]
out.push({
d: (((b.deg - a.deg) % 12) + 12) % 12,
qa: a.quality,
qb: b.quality,
rnFrom: a.rn ?? '',
rnTo: b.rn ?? '',
})
}
return out
}
// Live-loop units: degree from loopToDegrees, quality from the chord-name
// suffix (unmappable → null = wildcard, matches on Δ alone).
function loopUnitsOf(loop, loopDeg) {
return loop.map((name, i) => {
const m = typeof name === 'string' ? name.match(/^[A-G][b#]?(.*)$/) : null
const suffix = m ? m[1] : null
return { deg: loopDeg[i], quality: suffix != null ? SUFFIX_TO_QUALITY[suffix] ?? null : null }
})
}
// Distinct triples of T(p) matched by some loop transition (wildcard-aware),
// in p's canonical order — shared[0] names the annotation.
function sharedTransitions(loopT, pT) {
const seen = new Set()
const shared = []
for (const t of pT) {
const key = `${t.d}|${t.qa}|${t.qb}`
if (seen.has(key)) continue
seen.add(key)
const hit = loopT.some(
l =>
l.d === t.d &&
(l.qa == null || t.qa == null || l.qa === t.qa) &&
(l.qb == null || t.qb == null || l.qb === t.qb)
)
if (hit) shared.push(t)
}
return shared
}
// Rebased degree-set Jaccard over the canonical rotations (both sides rebased
// so their canonical first element is 0 — rotation-invariant by construction).
function degreeSetJaccard(aCanon, bCanon) {
const a = new Set(aCanon.split(','))
const b = new Set(bCanon.split(','))
let inter = 0
for (const x of a) if (b.has(x)) inter++
const union = a.size + b.size - inter
return union ? inter / union : 0
}
// Summed bar count of a progression (the total form length), or null when the
// KB entry carries no `bars` array. Used only by siblingRole (§3 rules 24).
function totalBars(prog) {
const bars = Array.isArray(prog?.bars) ? prog.bars : null
if (!bars) return null
return bars.reduce((sum, n) => sum + (typeof n === 'number' ? n : 0), 0)
}
/**
* siblingRole(sibling, active) → role phrase | null (same-style-first §3)
*
* A short character phrase framing a same-style `sibling` against the `active`
* (matched) progression, derived ONLY from KB `mode` / `bars` / `qualities`.
* First rule that fires:
* 1. mode differs → "{mode} version" (minor/major, else the name)
* 2. same mode, fewer bars → "shorter form"
* 3. same mode, more bars → "extended form"
* 4. same mode & length, a quality the active lacks → "reharmonized"
* 5. otherwise → null (honest: name + level only)
* Returns null when `active` is unresolved. The finding-B gate (a sibling that
* shares NO genuine relationship with the played loop) is applied at the call
* site — see the `genuine` guard in rankRelatedProgressions.
*/
export function siblingRole(sibling, active) {
if (!sibling || !active) return null
const sMode = sibling.mode ?? null
const aMode = active.mode ?? null
// 1. mode differs → the mode-flavoured version.
if (sMode && aMode && sMode !== aMode) {
if (sMode === 'minor') return 'minor version'
if (sMode === 'major') return 'major version'
return `${sMode} version`
}
// 24 only compare within a shared mode (or when both modes are absent).
if (sMode !== aMode) return null
const sBars = totalBars(sibling)
const aBars = totalBars(active)
if (sBars != null && aBars != null) {
if (sBars < aBars) return 'shorter form'
if (sBars > aBars) return 'extended form'
}
// 4. same mode & length: a colour the active progression lacks.
const aQ = new Set(Array.isArray(active.qualities) ? active.qualities : [])
const sQ = Array.isArray(sibling.qualities) ? sibling.qualities : []
if (aQ.size && sQ.some(q => !aQ.has(q))) return 'reharmonized'
return null
}
/**
* rankRelatedProgressions(loop, kbRegistry?) →
* { match, activeStyle, activeStyleLabel, primary, secondary, entries } | null
*
* The §5 ranking, extended for same-style-first (L-72, docs/design/related-
* same-style.md). Returns null when the loop yields no degrees. When the loop
* matches a KB progression, `activeStyle = match.style` and the panel leads with
* that style's OTHER progressions (same-style siblings) — floor relaxed to 0,
* scorer order kept, each carrying a `role` phrase (siblingRole, §3). Per the
* Maestro finding-A resolution, when a style is locked the panel shows SAME-STYLE
* ONLY (`secondary` stays empty — no cross-style section). When `!match.matched`
* (`activeStyle == null`) the pre-existing cross-style flat list is returned
* unchanged (floor RELATED_SCORE_FLOOR, annotations). `entries` =
* `primary.concat(secondary)` for back-compat with `entries[0]` reads.
* Exported for smoke coverage.
*/
export function rankRelatedProgressions(loop, kbRegistry = kb) {
const loopDeg = loopToDegrees(loop)
if (!loopDeg || !loopDeg.length) return null
const loopCanon = canonicalDegrees(loopDeg)
const index = kbRegistry === kb ? DEFAULT_INDEX : buildLoopIndex(kbRegistry)
const match = matchLoopToProgression(loop, index)
const loopT = transitionsOf(loopUnitsOf(loop, loopDeg))
// §1: the active style IS the component's own match (roulette seed + live
// detection both route through the L-60 collapsed index). No prop needed.
const activeStyle = match.matched ? match.style : null
const activeStyleLabel = activeStyle
? kbRegistry[activeStyle]?.meta?.label ?? activeStyle
: null
// The raw active KB entry — authoritative mode/bars for siblingRole (§3).
const activeProg = activeStyle
? kbRegistry[activeStyle]?.progressions?.find(p => p.id === match.id) ?? null
: null
const entries = []
for (const style of Object.keys(kbRegistry)) {
const styleLabel = kbRegistry[style]?.meta?.label ?? style
const progs = kbRegistry[style]?.progressions
if (!Array.isArray(progs)) continue
for (const prog of progs) {
if (!Array.isArray(prog.degrees) || !prog.degrees.length) continue
if (match.matched && prog.id === match.id) continue // §5: every p ≠ the matched one
const collapsed = collapseChanges(prog)
if (!collapsed.length) continue
const pCanon = canonicalDegrees(collapsed.map(u => u.deg))
const shared = sharedTransitions(loopT, transitionsOf(collapsed))
const sameChanges = pCanon === loopCanon
const sameStyle = activeStyle != null && style === activeStyle
let score = 0
if (sameChanges) score += SCORE_SAME_CHANGES
if (sameStyle) score += SCORE_SAME_STYLE
score += Math.min(shared.length * SCORE_PER_TRANSITION, TRANSITION_CAP)
score += degreeSetJaccard(loopCanon, pCanon) * SCORE_JACCARD
score -= Math.abs(loop.length - collapsed.length)
// §2/§4: same-style siblings bypass the floor (never "junk" — they are the
// "other options" the user asked for); cross-style keeps the floor.
const floor = sameStyle ? 0 : RELATED_SCORE_FLOOR
if (score < floor) continue
// §5 annotation (cross-style rows): why this entry is here.
const annotation = sameChanges
? 'same changes'
: shared.length
? `shares ${shared[0].rnFrom || '?'}${shared[0].rnTo || '?'}`
: 'same style'
// §3 role (same-style rows only). finding-B gate: emit a phrase only when
// there is a genuine relationship to the played loop — identical changes
// OR at least one shared (Δ, quality→quality) transition. A distantly-
// related same-style sibling (neither) gets no false "extended form" /
// "reharmonized" label — just its name + level.
const genuine = sameChanges || shared.length > 0
const role = sameStyle && genuine ? siblingRole(prog, activeProg) : null
entries.push({
style,
styleLabel,
id: prog.id,
name: prog.name,
level: prog.level === 'intermediate' ? 'intermediate' : 'foundation', // untagged counts foundation
score,
sameChanges,
sameStyle,
annotation,
role,
progression: prog,
})
}
}
entries.sort(
(a, b) => b.score - a.score || a.style.localeCompare(b.style) || a.id.localeCompare(b.id)
)
// §2 + finding-A: with a style locked, primary = same-style siblings only
// (cap 5), secondary dropped. Without a lock, the flat cross-style list.
let primary, secondary
if (activeStyle != null) {
primary = entries.filter(e => e.sameStyle).slice(0, RELATED_MAX_ENTRIES)
secondary = [] // finding-A: no cross-style section when a style is locked
} else {
primary = entries.slice(0, RELATED_MAX_ENTRIES)
secondary = []
}
return {
match,
activeStyle,
activeStyleLabel,
primary,
secondary,
entries: primary.concat(secondary),
}
}
// ─── Presentational bits ──────────────────────────────────────────────────────
// Level chip — ExplorePanel's LevelBadge language (amber = the existing
// secondary-tone token; foundation stays quiet; untagged counts foundation).
function LevelBadge({ level }) {
if (level === 'intermediate') {
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-amber border border-amber/40 rounded px-1.5 py-px">
intermediate
</span>
)
}
return (
<span className="shrink-0 text-[9px] uppercase tracking-wide font-semibold text-gray-400 border border-border rounded px-1.5 py-px">
foundation
</span>
)
}
// The chord chain realized in the current key — the raw (bar-per-bar) KB form,
// truncated to the first 8 + "…" (§5); each chip taps through to
// ChordDetailModal via onChordClick (the banner-chip pattern, smaller).
const CHAIN_SHOWN = 8
function ChordChain({ progression, keyRoot, onChordClick }) {
const degrees = progression.degrees ?? []
const qualities = progression.qualities ?? []
const rn = progression.rn ?? []
const shown = degrees.slice(0, CHAIN_SHOWN)
return (
<div className="mt-1 flex items-end gap-1 flex-wrap">
{shown.map((deg, i) => {
const rootPc = (((keyRoot + deg) % 12) + 12) % 12
const label = `${NOTES[rootPc]}${CHORD_TYPES[qualities[i]]?.suffix ?? ''}`
return (
<button
key={i}
type="button"
onClick={() => onChordClick?.(label)}
aria-label={`${label} — open chord detail`}
className="flex flex-col items-center px-1.5 py-0.5 rounded-lg border border-border bg-border hover:border-gray-500 transition-all cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-accent"
>
<span className="text-xs font-bold leading-none text-gray-300">{label}</span>
<span className="text-[10px] text-gray-500">{rn[i] ?? ''}</span>
</button>
)
})}
{degrees.length > CHAIN_SHOWN && <span className="self-center text-xs text-gray-500"></span>}
</div>
)
}
export default function RelatedProgressions({ loop, keyInfo, onChordClick }) {
const loopKey = Array.isArray(loop) ? loop.join(',') : ''
const ranked = useMemo(
() => (loopKey ? rankRelatedProgressions(loop) : null),
[loopKey] // eslint-disable-line react-hooks/exhaustive-deps
)
// keyInfo.root is a note NAME; chips want a pitch class. Default to C (0)
// until a key is known, same fallback JamGuide's stations use.
const keyRoot = useMemo(() => {
const pc = chordRootPC(keyInfo?.root)
return pc >= 0 ? pc : 0
}, [keyInfo?.root])
// Idle — no loop (or unparseable chord names, which rank as no loop).
if (!ranked) {
return (
<section
className="rounded-2xl border border-dashed border-border p-3"
aria-label="Related progressions"
>
<p className="text-sm text-gray-500">
Loop a progression related changes from the songbook land here.
</p>
</section>
)
}
const { activeStyle, activeStyleLabel, primary } = ranked
return (
<section
className="rounded-2xl border border-border bg-panel p-3"
aria-label="Related progressions"
>
<h4 className="mb-2 text-[10px] font-semibold uppercase tracking-widest text-gray-500">
Related progressions · from the songbook
{keyInfo?.root ? ` · in ${keyInfo.root}` : ''}
</h4>
{primary.length === 0 ? (
activeStyle != null ? (
// Locked to a style with no siblings (§5 edge). Honest, never padded.
<p className="text-sm text-gray-500">
You&rsquo;re on the only {activeStyleLabel} loop in the songbook.
</p>
) : (
// Loop, but nothing clears the floor — honest, never padded (§5).
<p className="text-sm text-gray-500">
Nothing in the songbook genuinely relates to this loop yet.
</p>
)
) : (
<>
{/* §2/§3: when a style is locked, lead with its OTHER progressions
reframed as variations to try — same-style only (finding-A). */}
{activeStyle != null && (
<p className="mb-2 text-xs font-medium text-gray-300">
Try these in {activeStyleLabel}
</p>
)}
{/* D-75 §4: 2-col grid to use the left column's width; display cap
4 for a clean 2×2 (render-time slice — RELATED_MAX_ENTRIES and the
ranker are untouched). Stacks to 1-col on narrow. */}
<ul className="grid grid-cols-1 sm:grid-cols-2 gap-2.5">
{primary.slice(0, 4).map(entry => (
<li key={`${entry.style}-${entry.id}`} className="min-w-0">
<div className="flex flex-wrap items-baseline gap-x-1.5 gap-y-0.5">
<span className="text-sm font-semibold text-gray-100">{entry.name}</span>
{/* Same-style rows share the header's style — hide the redundant
label; cross-style rows keep it. */}
{activeStyle == null && (
<span className="text-xs text-gray-500">{entry.styleLabel}</span>
)}
<LevelBadge level={entry.level} />
{/* Same-style rows show the role phrase (omitted when null,
finding-B); cross-style rows keep the §5 annotation. */}
{activeStyle != null
? entry.role && (
<span className="text-[10px] text-gray-500">{entry.role}</span>
)
: <span className="text-[10px] text-gray-500">{entry.annotation}</span>}
</div>
<ChordChain
progression={entry.progression}
keyRoot={keyRoot}
onChordClick={onChordClick}
/>
</li>
))}
</ul>
</>
)}
</section>
)
}
+234
View File
@@ -0,0 +1,234 @@
import { CHORD_TYPES, NOTES, suggestSubstitutions } from '../lib/theory'
import { chordRootPC } from '../lib/match'
import { getGuitarVoicings } from '../lib/voicings'
import { pianoVoicing } from '../lib/piano'
import ChordDiagram from './ChordDiagram'
import MiniPiano from './MiniPiano'
// ─── TryThis — stable 3-slot rows-of-shapes substitution rail (L-78 / D-76) ─────
//
// For the chord under the playhead, in the detected key, show up to THREE curated
// substitutions (from theory.js `suggestSubstitutions`, the L-73 engine) as
// stacked ROWS — turned 90° from L-75's cards-across. Each row = a left identity
// block (tappable chord chip + category tag + why) and a right "ways to play it"
// block that follows the global instrument:
// guitar → up to 3 ChordDiagram thumbs (the 3×3 grid), the genuinely different
// grips from getGuitarVoicings(label).slice(0, 3)
// piano → ONE MiniPiano ("for piano it can be just one thats okay")
// bass → a root · {note} caption (no honest compact bass-chord renderer)
//
// The layout is a FIXED 3-slot frame: present subs render SubRow, absent slots
// render a subtle EmptySlot that holds the exact row height — so sub #1 and #2
// never shift position whether the chord yields 2 or 3 subs (the user's anti-jump
// ask: "annoying when the layout changes then u dont know where to look").
// Spec: docs/design/related-area-v2.md §2. Sibling of RelatedProgressions.
//
// Props:
// loop : string[] | null — the detected repeating progression (chord names)
// keyInfo : { root, mode, confidence } | null — effective key (frames the why)
// currentChord : string — the chord sounding NOW ("F", "Dm7")
// onChordClick : fn(label) — opens ChordDetailModal (App's setSelectedChord)
// instrument : 'guitar' | 'piano' | 'bass' — which mini diagram to draw
// Invert CHORD_TYPES suffix → quality — the app idiom (mirrors
// RelatedProgressions' SUFFIX_TO_QUALITY). All 14 suffixes are unique.
const SUFFIX_TO_QUALITY = Object.fromEntries(
Object.entries(CHORD_TYPES).map(([quality, def]) => [def.suffix, quality])
)
// Parse a chord-name string → { rootPc, quality } (a CHORD_TYPES key) using the
// established helpers — chordRootPC for the root pc, the CHORD_TYPES suffix
// inversion for the quality. Never re-derived. Returns null when unparseable.
export function parseChordName(name) {
if (typeof name !== 'string') return null
const rootPc = chordRootPC(name)
if (rootPc < 0) return null
const m = name.match(/^[A-G][b#]?(.*)$/)
const quality = m ? SUFFIX_TO_QUALITY[m[1]] : undefined
if (!quality) return null
return { rootPc, quality }
}
// Circle-of-fifths categories (relative = inner ring, secondary_dominant =
// clockwise step). Only these earn the ↻ glyph — borrowed/extension are modal /
// vertical colour and must NOT claim the circle (docs §6).
const CIRCLE_CATEGORIES = new Set(['relative', 'secondary_dominant'])
const CATEGORY_TAG = {
relative: 'relative',
borrowed: 'borrowed',
extension: 'colour',
secondary_dominant: 'V7',
}
// Per-instrument uniform row height (§2.2/§3). All 3 slots — filled or empty —
// share the current instrument's height so the frame never reflows.
const ROW_MIN_H = {
guitar: 'min-h-[100px]',
piano: 'min-h-[72px]',
bass: 'min-h-[64px]',
}
// Compute the substitution set for a chord NAME at loop index `pos` (1 when the
// chord is not a loop station). The next station's root pc gates Rule D (secondary
// dominant of the next chord). Returns { name, pos, subs } or null when the name
// won't parse. Reuses parseChordName / chordRootPC / suggestSubstitutions — never
// re-derives theory.
function subsForChord(name, pos, loopArr, keyInfo) {
const parsed = parseChordName(name)
if (!parsed) return null
let nextRootPc
if (loopArr && pos >= 0) {
const pc = chordRootPC(loopArr[(pos + 1) % loopArr.length])
if (pc >= 0) nextRootPc = pc
}
return { name, pos, subs: suggestSubstitutions(parsed, keyInfo, { nextRootPc }) }
}
// Choose the SUBJECT chord the card speaks about (pure — no hooks):
// (a) the live currentChord, if it parses and yields ≥1 sub (the playing case —
// whether or not it's a loop station; keeps the card live as you play);
// (b) else the FIRST loop chord that yields ≥1 sub — so a rolled/detected loop
// in a locked key shows the card immediately, with no live input;
// (c) else null — no loop and no valid live chord → honest empty.
function pickSubject(loopArr, keyInfo, currentChord) {
const pos = loopArr ? loopArr.indexOf(currentChord) : -1
const live = subsForChord(currentChord, pos, loopArr, keyInfo)
if (live && live.subs.length) return live
if (loopArr) {
for (let i = 0; i < loopArr.length; i++) {
const cand = subsForChord(loopArr[i], i, loopArr, keyInfo)
if (cand && cand.subs.length) return cand
}
}
return null
}
// The "ways to play" block on the right of a SubRow, chosen by the global
// instrument (§2.3):
// guitar → up to 3 ChordDiagram thumbs (the 3×3), each captioned with its shape
// name so the three read as genuinely different grips. Fewer than 3
// shapes exist (e.g. add9 → 2 for most roots) → show what exists, never
// pad with fakes (honest, §2.4). None → nothing (chip + why carry it).
// piano → ONE MiniPiano; rootPc spread back in so the "R" badge lands right.
// bass → root · {note} caption (no honest compact bass-chord renderer).
function WaysToPlay({ sub, instrument }) {
if (instrument === 'piano') {
return (
<div className="flex items-center">
<MiniPiano
voicing={{ ...pianoVoicing({ rootPc: sub.rootPc, quality: sub.quality }), rootPc: sub.rootPc }}
size="mini"
/>
</div>
)
}
if (instrument === 'bass') {
return (
<span className="text-[10px] text-gray-500">
root · {NOTES[((sub.rootPc % 12) + 12) % 12]}
</span>
)
}
// guitar (default): up to 3 genuinely different grips, left-aligned. Omit the
// ChordDiagram label (the chip names the chord) — caption the shape name below.
const shapes = getGuitarVoicings(sub.label).slice(0, 3)
if (!shapes.length) return null
return (
<div className="flex gap-2">
{shapes.map((shape, i) => (
<div key={`${shape.label}-${i}`} className="flex flex-col items-center gap-0.5">
<ChordDiagram shape={shape} rootPc={sub.rootPc} size="thumb" />
<span className="max-w-[75px] truncate text-center text-[9px] leading-none text-gray-500">
{shape.label}
</span>
</div>
))}
</div>
)
}
// One substitution ROW — left identity (chip → modal + tag + why) | right ways.
function SubRow({ sub, instrument, onChordClick }) {
const isCircle = CIRCLE_CATEGORIES.has(sub.category)
const tag = CATEGORY_TAG[sub.category] ?? sub.category
return (
<div
className={`flex items-center gap-3 rounded-lg border border-border bg-border/30 p-2 ${ROW_MIN_H[instrument] ?? ROW_MIN_H.guitar}`}
>
{/* Left identity block (~180px) */}
<div className="flex w-[180px] shrink-0 flex-col gap-1">
<div className="flex items-center gap-1.5">
<button
type="button"
onClick={() => onChordClick?.(sub.label)}
aria-label={`${sub.label}${sub.why}`}
className="shrink-0 rounded-lg border border-border bg-border px-2 py-1 text-sm font-bold leading-none text-gray-100 outline-none transition-all cursor-pointer hover:border-accent/50 hover:text-accent focus-visible:ring-2 focus-visible:ring-accent"
>
{sub.label}
</button>
<span className="text-[9px] uppercase tracking-wide text-gray-500">
{tag}
{isCircle && <span className="ml-0.5 text-accent" aria-hidden="true"></span>}
</span>
</div>
<p className="line-clamp-2 text-[11px] leading-snug text-gray-400">
{sub.why}
</p>
</div>
{/* Right "ways to play" block */}
<div className="min-w-0 flex-1">
<WaysToPlay sub={sub} instrument={instrument} />
</div>
</div>
)
}
// A reserved-but-empty slot — holds the exact SubRow height so the present subs
// never move when the chord yields fewer than 3 (§2.2, the anti-jump).
function EmptySlot({ instrument }) {
return (
<div
aria-hidden="true"
className={`flex items-center justify-center rounded-lg border border-dashed border-border/50 bg-transparent ${ROW_MIN_H[instrument] ?? ROW_MIN_H.guitar}`}
>
<span className="text-[11px] text-gray-600"></span>
</div>
)
}
export default function TryThis({ loop, keyInfo, currentChord, onChordClick, instrument = 'guitar' }) {
const loopArr = Array.isArray(loop) && loop.length ? loop : null
const subject = pickSubject(loopArr, keyInfo, currentChord)
// No subject (no loop + no valid live chord) or 0 subs → no card.
if (!subject) return null
const subjectChord = subject.name
const subs = subject.subs.slice(0, 3) // cap at 3 (§2.1)
return (
<section
className="rounded-2xl border border-border bg-panel p-3"
aria-label={`Try this instead of ${subjectChord}`}
>
<h4 className="mb-2 text-[10px] font-semibold uppercase tracking-widest text-gray-500">
Try this instead of {subjectChord}
{keyInfo?.root ? ` · in ${keyInfo.root} ${keyInfo.mode ?? 'major'}` : ''}
</h4>
{/* Fixed 3-slot frame — a present sub → SubRow, an absent one → EmptySlot,
so sub #1/#2 hold their position whether there are 2 or 3 subs. */}
<div className="flex flex-col gap-2">
{[0, 1, 2].map(i =>
subs[i]
? <SubRow key={`${subs[i].label}-${i}`} sub={subs[i]} instrument={instrument} onChordClick={onChordClick} />
: <EmptySlot key={`empty-${i}`} instrument={instrument} />
)}
</div>
</section>
)
}
+345
View File
@@ -0,0 +1,345 @@
// VoicingBrowser a playable voicing GALLERY for ONE chord (task D-30; was the
// chip-switched browser of D-21/D-23).
//
// For a given { rootPc, quality } it shows every way the KB knows to voice that
// chord ALL AT ONCE, no chips, no selection state (user directive 2026-07-10:
// "see all the variations G shape, C shape, etc in one view without having to
// push a button. so they all line up next to each other"):
//
// Guitar section every placeable `GUITAR_SHAPES[quality]` entry from
// src/lib/voicings.js (open shapes only in their native key, movable shapes
// only when the whole grip fits under fret 15), each cell = shape label +
// <ChordDiagram size="thumb"/>.
// Piano section all four src/lib/piano.js `pianoVoicing` styles
// (root / shell / rootlessA / rootlessB), each cell = the voicing's honest
// label (e.g. "rootless A (3-5-7-9)") + <MiniPiano voicing/>.
//
// No playback (L-70 / dashboard-polish.md §3): the per-cell preview was removed
// from EVERY mount the user settled "leave them off, better not." The component
// is now purely visual; src/lib/chordAudio.js is no longer imported here.
//
// Mount points (wired by L-21/L-22, NOT here): Knowledge Center Voicings
// section, ChordDetailModal Guitar/Piano tabs (show="guitar"/"piano", L-25),
// and the Jam Guide station rail / heard-live view (dense). This component stays
// pure & prop-driven.
//
// Layout: each instrument section is a flex-wrap gallery of fixed-content-width
// cells, so it reflows to fewer columns (down to one cell per row) inside a
// narrow modal or the Jam Guide dock no horizontal scroll needed except the
// per-cell guard around the widest MiniPiano thumbs (~266px for 2-octave
// rootless voicings).
//
// Props:
// rootPc chord root pitch class 011 (default 0 = C)
// quality CHORD_TYPES key; unknown values fall back to 'maj'
// (matching voicings.js / piano.js behaviour)
// show 'guitar' | 'piano' | 'both' (default 'both', task D-23): which
// instrument section(s) to render. 'bass' (task D-41, D-40 §3)
// renders NEITHER gallery guitar shapes are not bass patterns and
// pianoVoicing is piano, so showing either under the global BASS
// selector would lie; an honest one-liner renders instead. Any
// OTHER value still falls back to both, so every pre-existing
// mount renders identically with no prop.
// dense boolean (default false, task L-33 additive per D-31 §5; D-41
// restyled it for the all-expanded GlanceRail rows): drops the
// section chrome (border/panel background/heading the row header
// already names the chord) and suppresses the per-mount
// mic-feedback microcopy (the rail shows it ONCE for the whole
// rail, D-31 §2.5). D-51 (one-screen.md §4) additionally tightens
// the DENSE cell spacing for the 500px right column cell p-2
// p-1.5 and gallery gap-2 gap-1.5 which hardens the column's
// two-octave + one-octave piano pair fit (279.6 + 6 + 156.4 = 442
// 451px row interior even with a classic Windows scrollbar in
// the rail's scroller; it was 452 vs 456, a ~4px squeak, before).
// L-70 (dashboard-polish.md §2) additionally renders the piano
// styles as a 2×2 grid of `size="mini"` keyboards under dense, and
// applies the `.dark-scroll` utility to each cell's scroller. Every
// pre-existing mount renders identically with no prop.
// recommended a shape object (guitar) or voicing object (piano) marking the
// KB play's own voicing (dashboard rail only). Guitar: matched into
// the list by `label`, floated to cell #1, badged "play" + accent
// border, and the list reordered recommended-first (§1.2). Piano:
// matched by `voicing.style`, that 2×2 cell gets the accent border
// (§2.1). Default null no highlight, order untouched.
// max cap the guitar list to this many cells (dashboard rail passes 4).
// Undefined no cap (all placeable shapes). Off-rail mounts pass
// neither `recommended` nor `max`, so the guitar list keeps its raw
// `matchingShapes` declared order byte-identical to today.
import { useMemo } from 'react'
import ChordDiagram from './ChordDiagram'
import MiniPiano from './MiniPiano'
import { GUITAR_SHAPES } from '../lib/voicings'
import { pianoVoicing } from '../lib/piano'
import { NOTES, CHORD_TYPES } from '../lib/theory'
// Standard-tuning open-string pitch classes, low-E first (mirrors ChordDiagram).
const OPEN_PCS = [4, 9, 2, 7, 11, 4]
const PIANO_STYLES = ['root', 'shell', 'rootlessA', 'rootlessB']
const mod12 = (n) => ((n % 12) + 12) % 12
// The shapes of `quality` that can actually be shown for this root:
// - open shapes only when their native root matches (onlyRoot === rootPc);
// - movable shapes only when every fretted string lands in 015 under
// ChordDiagram's placement convention (root-at-open-string fret-12 barre).
// Unknown quality falls back to maj (same fallback voicings.js itself uses).
function matchingShapes(quality, rootPc) {
const shapes = GUITAR_SHAPES[quality] ?? GUITAR_SHAPES.maj
return shapes.filter((shape) => {
if (Array.isArray(shape.frets)) {
// Open shape: fixed grip, valid only in its native key.
return shape.onlyRoot === undefined || shape.onlyRoot === rootPc
}
if (!Array.isArray(shape.offsets) || !Number.isFinite(shape.rootStr)) return false
const idx = 6 - shape.rootStr // rootStr 6 = low E low-E-first index 0
let baseFret = mod12(rootPc - (OPEN_PCS[idx] ?? 4))
if (baseFret === 0) baseFret = 12 // ChordDiagram's octave-barre placement
const abs = shape.offsets.filter((o) => typeof o === 'number').map((o) => baseFret + o)
if (abs.length === 0) return false
return Math.min(...abs) >= 0 && Math.max(...abs) <= 15
})
}
// Lowest base fret of a movable shape under ChordDiagram's placement convention
// (root-at-open-string fret-12 barre). Open shapes sit at the nut (0).
function baseFretOf(shape, rootPc) {
if (Array.isArray(shape.frets)) return 0
const idx = 6 - shape.rootStr
let bf = mod12(rootPc - (OPEN_PCS[idx] ?? 4))
if (bf === 0) bf = 12
return bf
}
// Count of muted strings in a shape's grip (fewer = a fuller voicing wins ties).
function mutedCount(shape) {
const arr = Array.isArray(shape.frets) ? shape.frets : shape.offsets
return Array.isArray(arr) ? arr.filter((v) => v === 'x').length : 0
}
// The rail's max, recommended-first ordering (dashboard-polish.md §1.2). Only
// invoked when `recommended` and/or `max` are supplied (the dashboard rail)
// non-dense mounts skip it entirely and keep `matchingShapes` declared order,
// so VoicingsSection/ChordDetailModal stay byte-identical.
// 1. recommended first (matched into the placeable list by label; prepended
// even if it was filtered out as unplaceable);
// 2. open-position forms (Array.isArray(frets));
// 3. movable/barre by lowest base fret ascending;
// 4. tiebreak: fewer muted strings, then declared order in GUITAR_SHAPES.
// Then slice to `max` (recommended deduped so it never repeats). <max placeable
// shapes just show what exist the rule caps, never pads.
function orderGuitarShapes(shapes, rootPc, recommended, max) {
const declaredIndex = new Map(shapes.map((s, i) => [s, i]))
let rec = null
if (recommended?.label) {
rec = shapes.find((s) => s.label === recommended.label) ?? recommended
}
const rest = shapes.filter((s) => s.label !== rec?.label)
rest.sort((a, b) => {
const aOpen = Array.isArray(a.frets) ? 0 : 1
const bOpen = Array.isArray(b.frets) ? 0 : 1
if (aOpen !== bOpen) return aOpen - bOpen
if (aOpen === 1) {
const bf = baseFretOf(a, rootPc) - baseFretOf(b, rootPc)
if (bf !== 0) return bf
}
const mc = mutedCount(a) - mutedCount(b)
if (mc !== 0) return mc
return (declaredIndex.get(a) ?? 0) - (declaredIndex.get(b) ?? 0)
})
const ordered = rec ? [rec, ...rest] : rest
const list = Number.isFinite(max) ? ordered.slice(0, max) : ordered
return { list, recLabel: rec?.label ?? null }
}
// "C", "Cm7", "Cmaj7" display name from the app's canonical chord model.
function chordName(rootPc, quality) {
const q = CHORD_TYPES[quality] ? quality : 'maj'
return `${NOTES[mod12(rootPc)]}${CHORD_TYPES[q].suffix}`
}
// Small presentational atoms
function SectionHeading({ children }) {
return (
<h4 className="text-[11px] font-semibold uppercase tracking-wider text-gray-400">
{children}
</h4>
)
}
// One gallery cell: label on top, diagram/keyboard thumb underneath.
// bg-surface inside the bg-panel section gives the cells a quiet inlay border;
// label is gray-300 on surface (AA comfortable at 11px semibold).
// `dense` (D-51): p-1.5 instead of p-2 4px off each cell's box width, part of
// the right-column margin-hardening. Non-dense output is byte-identical.
// `recommended` (L-70, dashboard-polish.md §1.2): the KB play's shape/style
// accent border + a "play" badge (finger-this, not audio; is gone), the
// prominence the old GlanceRail own-cell carried. Only ever set under the
// dashboard rail, so non-recommended cells stay byte-identical.
function GalleryCell({ label, recommended = false, dense = false, children }) {
return (
<figure className={`flex min-w-0 flex-col items-center gap-1.5 rounded-md border ${recommended ? 'border-accent' : 'border-border'} bg-surface ${dense ? 'p-1.5' : 'p-2'}`}>
{recommended ? (
<figcaption
className="flex max-w-full items-center gap-1.5 text-center text-[11px] font-medium leading-tight text-gray-300"
title={label}
>
<span className="rounded bg-accent px-1 py-0.5 text-[9px] font-bold uppercase tracking-wider text-black">
play
</span>
<span className="break-words">{label}</span>
</figcaption>
) : (
<figcaption
className="max-w-full break-words text-center text-[11px] font-medium leading-tight text-gray-300"
title={label}
>
{label}
</figcaption>
)}
{/* Scroll guard: MiniPiano's SVG has a fixed pixel width (up to ~266px
for a 2-octave thumb window); scroll inside the cell on very narrow
viewports rather than letting it break the wrap layout. `dark-scroll`
(L-70 §4) dresses this scroller on the dashboard rail only (dense)
the KC/modal keep the OS default, so non-dense stays byte-identical. */}
<div className={`max-w-full overflow-x-auto${dense ? ' dark-scroll' : ''}`}>{children}</div>
</figure>
)
}
// The gallery
export default function VoicingBrowser({
rootPc = 0, quality = 'maj', show = 'both', dense = false, recommended = null, max,
}) {
const pc = mod12(Number.isFinite(rootPc) ? rootPc : 0)
const name = chordName(pc, quality)
// Section gating (D-23; 'bass' added by D-41 per D-40 §3). 'guitar' hides
// the piano section, 'piano' hides the guitar section, 'bass' hides BOTH
// (neither gallery is honest for a bassist the one-liner below renders
// instead, so the dock's VoicingsSection under the global BASS selector
// stops showing guitar+piano). Anything else (incl. the 'both' default)
// shows both. Hooks stay unconditional.
const showGuitar = show !== 'piano' && show !== 'bass'
const showPiano = show !== 'guitar' && show !== 'bass'
const allGuitarShapes = useMemo(() => matchingShapes(quality, pc), [quality, pc])
// Guitar list: the dashboard rail (recommended and/or max supplied) reorders
// recommended-first + caps to `max` (§1.2); every other mount keeps the raw
// `matchingShapes` declared order untouched byte-identical to today.
const guitarView = useMemo(() => {
if (!recommended && !Number.isFinite(max)) {
return { list: allGuitarShapes, recLabel: null }
}
return orderGuitarShapes(allGuitarShapes, pc, recommended, max)
}, [allGuitarShapes, pc, recommended, max])
const guitarShapes = guitarView.list
const pianoOptions = useMemo(
() =>
PIANO_STYLES.map((style) => ({
style,
voicing: pianoVoicing({ rootPc: pc, quality }, { style }),
})),
[pc, quality],
)
// Piano "recommended" (dashboard rail): the station's authored voicing matches
// one of the four styles that 2×2 cell gets the accent border (§2.1). Guitar-
// shape `recommended` objects have no `.style`, so this stays null off-rail.
const recStyle = recommended && typeof recommended.style === 'string' ? recommended.style : null
return (
<div className="flex w-full min-w-0 flex-wrap gap-2">
{/* ── Guitar section: every placeable shape, side by side ── */}
{showGuitar && (
<section
aria-label={`Guitar voicings for ${name}`}
className={`min-w-[240px] flex-1 basis-[300px] ${dense ? '' : 'rounded-lg border border-border bg-panel p-3'}`}
>
{/* dense (a GlanceRail row): the row header already names the chord and
the global selector names the instrument no repeated heading. */}
{!dense && (
<div className="mb-2">
<SectionHeading>Guitar · {name}</SectionHeading>
</div>
)}
{guitarShapes.length === 0 ? (
// Graceful: nothing placeable for this root/quality say so, no crash.
<p className="text-xs text-gray-400">
No guitar shape sits comfortably for {name} try the piano voicings.
</p>
) : (
<div
role="group"
aria-label={`${name} guitar shapes — every shape shown, each playable`}
className={`flex flex-wrap items-stretch ${dense ? 'gap-1.5' : 'gap-2'}`}
>
{guitarShapes.map((shape, i) => (
<GalleryCell
key={`${shape.label}-${i}`}
label={shape.label}
recommended={guitarView.recLabel !== null && shape.label === guitarView.recLabel}
dense={dense}
>
<ChordDiagram shape={shape} rootPc={pc} size="thumb" />
</GalleryCell>
))}
</div>
)}
</section>
)}
{/* ── Piano section: all four voicing styles, side by side ── */}
{showPiano && (
<section
aria-label={`Piano voicings for ${name}`}
className={`min-w-[240px] flex-1 basis-[300px] ${dense ? '' : 'rounded-lg border border-border bg-panel p-3'}`}
>
{!dense && (
<div className="mb-2">
<SectionHeading>Piano · {name}</SectionHeading>
</div>
)}
{/* dense (dashboard rail, §2.1): the four styles render as a tidy 2×2
grid of compact `size="mini"` keyboards (two per column fit the
~451px row interior). Non-dense keeps today's flex-wrap gallery at
size="thumb" byte-identical. */}
<div
role="group"
aria-label={`${name} piano voicings — every style shown, each playable`}
className={dense ? 'grid grid-cols-2 gap-1.5' : 'flex flex-wrap items-stretch gap-2'}
>
{/* pianoVoicing() output carries no rootPc, and without it VoicingPiano
falls back to the LOWEST voice for its "R" badge wrong for rootless
voicings, whose bass is the 3rd (A) or 7th (B). Supply the chord root. */}
{pianoOptions.map(({ style, voicing }) => (
<GalleryCell
key={style}
label={voicing.label}
recommended={recStyle !== null && style === recStyle}
dense={dense}
>
<MiniPiano voicing={{ ...voicing, rootPc: pc }} size={dense ? 'mini' : 'thumb'} />
</GalleryCell>
))}
</div>
</section>
)}
{/* show='bass' (D-41, D-40 §3): no gallery would be honest say so
in one line instead of rendering guitar+piano under BASS. */}
{!showGuitar && !showPiano && (
<p className="text-xs text-gray-400">
No bass voicings for {name} yet authored bass patterns are on the way
(blues first). Guitar and piano voicings live under those instruments.
</p>
)}
</div>
)
}
+225 -7
View File
@@ -46,12 +46,20 @@ export default [
mode: 'major', // major | minor | dorian | mixolydian | …
songs: ['Autumn Leaves'],
tip: 'One transferable idea.',
level: 'intermediate', // OPTIONAL: 'foundation' | 'intermediate'
},
]
```
48 progressions per style. Cross-check `docs/progression-repertoire.md` §1.
**`level` (optional).** Tags the progression's difficulty for the in-app level
filter. Allowed values: `'foundation'` (the style's bread-and-butter loops) or
`'intermediate'` (secondary dominants, chained iiVs, backdoor, borrowed
chords…). **Omitting the field is fine and means `'foundation'`** — consumers
treat an absent `level` as foundation, so existing styles need no edits. The
validator only checks the value when the field is present.
## Instrument packs
Common envelope:
@@ -60,7 +68,7 @@ Common envelope:
export default {
styleIntro: '2-3 sentences on this instrument's role in the style.',
comping: [{ label, rhythm, description }], // ≥1 named rhythm
plays: { '<progression-id>': [ <play>, <play> ] }, // ≥2 plays per progression
plays: { '<progression-id>': [ <play>, <play> ] }, // ≥2 plays per progression (bass: ≥1 — see Bass play)
improv: { // guitar/piano; optional for bass
scales: [{ over: 'ii7', scale: 'dorian', why }],
targetNotes: '…',
@@ -100,6 +108,14 @@ export default {
Voicings are degree recipes resolved through the chord quality. Degrees: `'1' '3' '5' '7'` resolve per quality (e.g. `'3'` → ♭3 for min7); altered/extended degrees are explicit: `'b9' '9' '#9' '11' '#11' 'b13' '13' '6'`.
> **Resolver quirk (both hand-synced `resolveDegree` copies —
> `scripts/validate-kb.mjs` and `src/components/JamGuide.jsx`):** on
> `maj6`/`min6` the degree `'7'` resolves to **9 semitones, i.e. the 6th**
> (those qualities have no 7th in their interval set, and the resolver takes
> the top stack tone as the "7 slot"). It never misspells the chord, but when
> you mean the 6th, write `'6'` explicitly — don't lean on `'7'`. This applies
> equally to bass patterns below, which share the same resolver.
```js
{
label: 'Rootless A/B alternation',
@@ -115,17 +131,216 @@ Voicings are degree recipes resolved through the chord quality. Degrees: `'1' '3
### Bass play
A bass play is per-station patterns: `chords` has **one entry per progression
step** (like guitar/piano plays), each carrying the ordered notes the bassist
plays over that chord.
Patterns are **degree-based** — the piano-recipe language — not string/fret
tab. Why: hard rule 1. A bass play renders over every station of a *detected*
loop in the *detected* key, so the data must transpose automatically; and a
degree either resolves through the chord quality or it doesn't — you cannot
misspell a pitch class, only mislabel your intent. Fret tab was considered and
rejected: absolute frets are key-specific (licks are the one documented
exception, and they say so), and a movable-fret variant breaks at the nut —
exactly where bass lives, on open strings. The open-string/position idiom
belongs in authoring prose: the optional `position` hint.
Rendering convention (for the per-station pattern card): standard 4-string
tuning **EADG**, strings numbered **1 = G (highest) … 4 = E (lowest)**
the same "1 = highest string" convention as lick tab and `rootStr`, so no
third counting scheme exists in this codebase. The renderer places each
pattern in the lowest playable position within frets 015; the data itself
never encodes strings or frets.
```js
{
label: 'Walking, chromatic approach',
level: 'intermediate',
bars: [{ beats: ['R', '3', '5', 'chrom>'] }], // per bar of the progression
// beat tokens: R 3 5 7 (chord degrees) · 'chrom>' / 'chrom<' (chromatic into next root
// from below/above) · '5>' (dominant approach) · 'x' (ghost) · '-' (hold)
tips: '…',
label: 'Boogie cell',
level: 'foundation',
feel: 'swung 8ths, locked with the kick', // REQUIRED — the groove in one line
chords: [ // one per progression step
{
pattern: [ // the ORDERED notes (played first → last)
{ deg: '1', beat: 1 }, // chord/color tone, resolved through the quality
{ deg: '3', beat: 2 },
{ deg: '5', beat: 3, technique: 'ghost-note' }, // technique optional (lick vocabulary)
{ approach: 'chrom-below', beat: 4 }, // leads into the NEXT station's root
],
note: 'walk up into the IV', // optional, as in guitar/piano plays
},
// …
],
position: 'first five frets; open E and A when the key allows', // OPTIONAL prose hint
tips: 'Transferable idea.',
}
```
Field rules (all enforced by `node scripts/validate-kb.mjs` when a `bass.js`
pack exists — a style without one is complete and valid):
| Field | Rule |
|---|---|
| `feel` | required non-empty string — bass is a rhythm role; the pattern alone doesn't say swung vs straight |
| `chords` | array, exactly one entry per progression step |
| `pattern` | non-empty ordered array; ≤ 8 notes per bar of its step (straight-8ths density cap — rule 3) |
| note shape | exactly one of `deg` \| `approach` per note |
| `deg` | a degree **string** from the piano-recipe language above, resolved through the step's quality (`'1' '3' '5' '7'` quality-resolved; `'b3' '6' 'b7' 'b9' '9' '#9' '11' '#11' 'b5' 'b13' '13'` explicit). The maj6/min6 `'7'` quirk above applies — write `'6'` |
| root rule | every pattern states `'1'` at least once — a bassline grounds the chord (a deliberately rootless play needs a schema change, not silence) |
| `octave` | optional on `deg` notes, `0` (default) or `1`; the resolved offset `deg + 12·octave` must stay **≤ 19 semitones** (an octave + a fifth) so every pattern sits on EADG within frets 015 in one position |
| `approach` | `'chrom-below'` (next root 1 semitone) · `'chrom-above'` (next root + 1) · `'fifth-of-next'` (next root + 7). The pitch is **derived from the next station's root** (last step wraps to the first), never authored — that's why the validator can allow a non-chord tone here while untyped chromatics stay illegal. Approach notes must be the **final note(s)** of the pattern — they lead into the next chord |
| `beat` | optional number, `1 ≤ beat < 4·bars + 1` for that step (patterns are notated in 4 — a 12/8 shuffle is `feel`, not extra beats); non-decreasing in pattern order (equal beats = a dyad) |
| `technique` | optional per note, from the fixed lick technique vocabulary (see Licks) |
**Coverage: every progression of the style needs ≥ 1 bass play** — deliberately
1, not the guitar/piano 2. The band wants ONE bassline at a time, and rule 4's
"idiomatically different" bar is hard to clear twice per progression without
filler. A second play is welcome where a genuinely different lane exists
(two-feel vs walking, say) — the validator sets a floor, not a ceiling.
## Licks (optional)
A style's instrument pack may also teach short, named licks — the ordered-note
phrases the Licks & Techniques cards render. **The whole section is optional**:
a pack without licks is complete and valid. Guitar licks are tab-based (this
section); piano licks are degree-based (next section).
**How to register licks:** add a `licks` array as one more top-level key on the
instrument pack's default export (next to `styleIntro`/`comping`/`plays`/`improv`
in e.g. `src/data/kb/blues/guitar.js`). No change to `src/data/kb/index.js` is
needed — the registry already exposes the whole pack, and the UI reads
`kb[style].instruments.guitar.licks ?? []`.
```js
export default {
styleIntro: '…',
comping: [ /* … */ ],
plays: { /* … */ },
improv: { /* … */ },
// OPTIONAL — structured licks (this section):
licks: [
{
id: 'blues-box1-bb-answer', // '<style>-<slug>', globally unique
// (shares ONE id namespace with progression ids)
name: 'B.B. box answer phrase',
level: 'foundation', // 'foundation' | 'intermediate' (required)
chordContext: 'over the I7', // which chord/station it fits — free text,
// e.g. 'dom7' or 'over the V7 turnaround'
techniques: ['bend', 'vibrato'], // summary tags, from the fixed vocabulary below
source: 'the B.B. King box, e.g. "The Thrill Is Gone" fills', // recommended attribution
tab: [ // the ORDERED note sequence (played first → last)
{ string: 2, fret: 8 }, // string 1 = high e … 6 = low E
{ string: 1, fret: 8, technique: 'bend' }, // fret 0 (open) … 15
{ string: 1, fret: 10, technique: 'vibrato' }, // technique is optional per note
{ string: 2, fret: 8 },
],
},
],
}
```
Field rules (all enforced by `node scripts/validate-kb.mjs` when `licks` is present):
| Field | Rule |
|---|---|
| `id` | starts with `'<style>-'`; globally unique across **all** progression and lick ids in the whole KB |
| `name` | required, non-empty |
| `level` | `'foundation'` or `'intermediate'` — nothing else |
| `chordContext` | required, non-empty string — tells the player *where* the lick lands |
| `techniques` | array; every entry from the fixed vocabulary below (empty array = plain-picked) |
| `tab` | non-empty ordered array of `{string, fret, technique?}` |
| `tab[].string` | integer 16 (**1 = high e, 6 = low E** — standard tab convention; note `rootStr` in shapes counts the same way) |
| `tab[].fret` | integer 015 (0 = open string) |
| `tab[].technique` | optional; from the vocabulary; must **also** appear in the lick's `techniques[]` summary so card tags stay honest |
| `source` | optional but recommended — name where the lick comes from (checklist: nothing invented) |
**Fixed technique vocabulary** (both for `techniques[]` and per-note `technique`
— the validator rejects anything else):
`hammer-on` · `pull-off` · `slide` · `bend` · `double-stop` · `ghost-note` · `chromatic-approach` · `vibrato`
Like shapes, licks are **key-agnostic in spirit**: write them where they sit in
the style's home position and say in `chordContext` which chord they fit; the
tab renders as absolute string/fret positions.
Note: the older freeform `improv.licks` (prose `{tab/notation, description,
over, source}`) is unchanged and still welcome — it feeds the improv text
section. This top-level `licks` array is the *structured* shape that the lick
cards render and the validator checks.
## Piano licks (optional, degree-based)
A piano pack's `licks` array uses the **degree language**, not tab — the same
reasoning as bass patterns (hard rule 1): a lick renders over a *detected*
chord in the *detected* key, so the data must transpose automatically, and a
degree either resolves through the stated quality or it doesn't — you cannot
misspell a pitch, only mislabel your intent. Registration is identical to
guitar licks: a top-level `licks` key on `<style>/piano.js`; no registry
change; the section is optional.
Unlike guitar licks (whose tab is instrument-truth and needs no quality),
degree-based licks **require an explicit `quality`** — a `CHORD_TYPES` key —
so the validator can resolve every degree. `chordContext` stays the human
sentence; `quality` is the machine truth. They must agree by eye ("over the
ii7" → `min7`); the validator can only check the machine half.
```js
licks: [
{
id: 'jazz-enclosure-into-3', // '<style>-<slug>', same global id namespace
name: 'Bebop enclosure into the 3rd',
level: 'intermediate', // 'foundation' | 'intermediate'
chordContext: 'over the ii7', // human text, as in guitar licks
quality: 'min7', // REQUIRED — CHORD_TYPES key every deg resolves through
techniques: ['grace-note'], // summary tags, PIANO vocabulary (below)
source: 'Barry Harris workshop vocabulary', // recommended attribution
notes: [ // the ORDERED melodic line (played first → last)
{ deg: '5', octave: 1, beat: 1 },
{ approach: 'chrom-above', beat: 2 }, // targets the NEXT deg note
{ approach: 'chrom-below', beat: 2.5 }, // enclosure: above, below…
{ deg: '3', octave: 1, beat: 3, technique: 'grace-note' }, // …target
],
tips: 'Optional transferable idea.', // optional, unlike guitar licks
},
]
```
Field rules (enforced by `node scripts/validate-kb.mjs` when a piano pack has
`licks`; guitar packs keep the tab rules above — the validator routes by
instrument):
| Field | Rule |
|---|---|
| `id` `name` `level` `chordContext` | exactly as guitar licks (shared global id namespace) |
| `quality` | required, a `CHORD_TYPES` key — the context every `deg` resolves through |
| `techniques` | array; every entry from the **piano vocabulary** below (empty = plain) |
| `notes` | non-empty ordered array; ≤ 16 notes (8ths over the 2-bar beat window — rule 3); the **final note must be a `deg` note** |
| note shape | exactly one of `deg` \| `approach` per note |
| `deg` | a degree **string** from the piano-recipe language, resolved through `quality` (the maj6/min6 `'7'` quirk applies — write `'6'`) |
| `octave` | optional on `deg` notes, `0` (default) \| `1` \| `2` |
| range cap | every resolved offset — `deg`: `pc + 12·octave`; `approach`: derived (below) — must sit in **[0, 25]** semitones above the root. Proof: MiniPiano's render window is absolute notes [0, 36] (0 = low C); placing the root at its pitch class in the bottom octave (011), the highest possible note is 11 + 25 = 36 — the window's top key — so **every lick fits the window in all 12 keys**. (Note `octave: 2` is only legal where the cap allows — e.g. ending on the high root `'1'`.) |
| `approach` | `'chrom-below'` (target 1 semitone) · `'chrom-above'` (target + 1). The **target is the next `deg` note** in `notes[]` order, scanning past intervening approaches — so `chrom-above, chrom-below, deg` is the classic enclosure and both approaches frame the same target. The pitch is always **derived**, never authored (that's why a non-chord tone is legal here while untyped chromatics stay illegal). Guitar licks have no "next station", so unlike bass approaches these target a note *inside* the lick — and therefore **cannot close it** (nothing to target). Consecutive approaches must **differ in type** (two of the same type would derive the identical pitch — write the note you mean as a `deg` instead). No `octave` on approach notes. |
| `beat` | optional number, `1 ≤ beat < 9` (a lick spans at most two 4/4 bars); non-decreasing in order (equal beats = grace-note placement or a dyad) |
| `technique` | optional per note, from the piano vocabulary; must also appear in `techniques[]` (same honesty rule as guitar) |
| `source` | optional but recommended (checklist: nothing invented) |
| `tips` | optional string |
No root rule (unlike bass): a melodic line targets 3rds and 7ths; grounding
the root is the bassist's job.
**Piano technique vocabulary** (a distinct list from the guitar vocabulary —
keys don't bend, hammer, or sustain vibrato; the shared words keep their
guitar-lick meanings):
`slide` (the blues key-slip, off a black key onto its neighbour) ·
`double-stop` (two keys struck together) · `ghost-note` (barely-voiced filler)
· `grace-note` (crushed ornament into the main note — piano-specific)
The first three are shared with the guitar vocabulary and mean the same thing;
`grace-note` exists only here. The smoke test guards both lists (and, once
`PianoLickCard.jsx` exists, its exported `PIANO_TECHNIQUE_VOCAB` must be
set-equal to the validator's `PIANO_LICK_TECHNIQUES` — same hand-sync rule as
LickCard).
## Musician checklist (self-review before committing)
- [ ] Plays per progression genuinely differ in register/density/technique
@@ -133,4 +348,7 @@ Voicings are degree recipes resolved through the chord quality. Degrees: `'1' '3
- [ ] The style is recognizable from the rhythm descriptions alone (bossa ≠ jazz with new labels)
- [ ] Every tip teaches a transferable idea (voice leading, register, space), not just "play this"
- [ ] Songs/licks have sources; nothing invented
- [ ] Lick techniques use only the fixed vocabulary; every lick is playable as written (strings 16, frets 015, in order)
- [ ] Piano licks state their `quality`, keep approaches typed and non-terminal, and stay within [0, 25] semitones of the root
- [ ] Bass patterns state the root, keep approaches typed and terminal, and stay within an octave + a fifth of the root
- [ ] `node scripts/validate-kb.mjs` green; `npm run build` green
+496
View File
@@ -0,0 +1,496 @@
// Blues bass pack (task P-41) — the first bass cell. Patterns are degree-based
// per SCHEMA.md "Bass play": every note is either a `deg` resolved through the
// step's quality or a typed terminal `approach` whose pitch derives from the
// NEXT station's root (chrom-below = next1, chrom-above = next+1,
// fifth-of-next = next+7). Every pitch-class and interval claim in the notes,
// feels and tips below was computed in a reference key (C) before writing:
// I=C7, IV=F7, V=G7; minor form Cm7/Fm7/A♭7/G7; turnaround C7/A7/Dm7/G7.
//
// Lines and treatments sourced from:
// Ed Friedland, "Blues Bass — A Guide to the Essential Styles and Techniques"
// (Hal Leonard Bass Method Stylistic Supplement, 2005) — the boogie/shuffle
// cells (R356, R56), two-feel, walkups, and the turnaround treatments;
// its studied repertoire includes this cell's progression songs ("Sweet Home
// Chicago", "Pride and Joy", "Hide Away", "The Thrill Is Gone");
// Ed Friedland, "Building Walking Bass Lines" (Hal Leonard) — the approach-note
// method this schema's typed approaches encode (chromatic below/above,
// dominant/fifth approach into the next root);
// Jerry Jemmott (bass on B.B. King's "Completely Well" sessions, 1969 — "The
// Thrill Is Gone"): Jemmott describes his defining move on that record as the
// half-step-below approach slid into the tonic (Guitar World bassist
// interviews) — the minor play's approach language;
// Willie Dixon — the Chess Records lane (upright behind Muddy Waters and on
// Chuck Berry sessions) that the quarter-note and eighth-note boogie lines
// double; the ramble figure itself is the boogie-woogie piano left hand
// (Pinetop Smith lineage — see blues/piano.js) moved to the bass;
// Tommy Shannon (Double Trouble) — the driving-shuffle lane the eighth-note
// ramble lives in on "Pride and Joy"-style Texas blues.
// Pedagogy frame: docs/learn-curriculum.md — lock with the kick, target the
// changes, walk as a signal rather than a default.
// Reusable cells (degree strings; quarters unless noted). Reference key C.
const BOOGIE = [ // 1356: C E G A — the major-triad walkup plus the 6th
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 }, { deg: '6', beat: 4 },
]
const CHI_CELL = [ // 1565: C G A G — the bass half of the Jimmy Reed dyad rock
{ deg: '1', beat: 1 }, { deg: '5', beat: 2 }, { deg: '6', beat: 3 }, { deg: '5', beat: 4 },
]
const RAMBLE = [ // 1356–♭7653 in swung 8ths: C E G A B♭ A G E
{ deg: '1', beat: 1 }, { deg: '3', beat: 1.5 }, { deg: '5', beat: 2 }, { deg: '6', beat: 2.5 },
{ deg: 'b7', beat: 3 }, { deg: '6', beat: 3.5 }, { deg: '5', beat: 4 }, { deg: '3', beat: 4.5 },
]
const R5_OCT = [ // slow 12/8 pillar: root, fifth, octave (offsets 0, 7, 12)
{ deg: '1', beat: 1 }, { deg: '5', beat: 3 }, { deg: '1', octave: 1, beat: 4 },
]
const BOX_RIFF = [ // 1345, quality-resolved: Cm7 → C E♭ F G; G7 → G B C D
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '11', beat: 3 }, { deg: '5', beat: 4 },
]
export default {
styleIntro:
'Blues bass is the handshake between the kick drum and the chord: roots on the strong beats, everything else in service of the next change. The craft is targeting — knowing which note pulls the band into bar 5, bar 9, and the top of the next chorus — and the discipline is repetition: pick a cell, lock it with the drummer, and let the form (not your fingers) provide the variety.',
comping: [
{
label: 'Two-feel (root and fifth)',
rhythm: 'half-note pulse: root on 1, fifth on 3',
description:
'The oldest blues bass job: two notes a bar, fat and unhurried. The fifth can sit above or below the root (same pitch class); the groove lives in note length, not note count. Default lane for slow blues and country blues.',
},
{
label: 'Quarter-note boogie',
rhythm: 'four swung quarters, locked with the kick',
description:
'One note per beat walking the chord — 1356 or 1565 cells transposed to each station. The shuffle swing lives in the drummer; the bass plays even quarters and lets note placement carry the lean.',
},
{
label: '12/8 slow blues',
rhythm: 'beats 1 and 3 weighted; triplet air between',
description:
'At slow-blues tempo every beat splits in three. The bass states less, not more: root and fifth as pillars, then a single pickup note — usually a half-step under the next root — sliding the band into the change. The Jerry Jemmott "Thrill Is Gone" lane.',
},
],
plays: {
'blues-12bar': [
{
label: 'Quarter-note boogie with walking seams',
level: 'foundation',
feel: 'medium shuffle — even quarters locked with the kick; the walkups do the leaning',
chords: [
{ pattern: BOOGIE, note: '1356 — the triad plus the 6th; home base' },
{ pattern: BOOGIE },
{ pattern: BOOGIE },
{
// C D E♭ E → F: whole step then three half-steps, the classic blue-note walkup.
pattern: [
{ deg: '1', beat: 1 }, { deg: '9', beat: 2 }, { deg: 'b3', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'walk up into the IV: 12–♭3, then the half-step under its root',
},
{ pattern: BOOGIE, note: 'same cell, new root — the boogie transposes, it never changes' },
{
// F G A B → C: 123 of the IV, then the half-step under home.
pattern: [
{ deg: '1', beat: 1 }, { deg: '9', beat: 2 }, { deg: '3', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'walk home: 123, then a half-step under the I',
},
{
// C A B♭ B → C: the 6–♭771 climb. The chord's 7th degree is out of the
// degree vocabulary over dom7, so the final half-step is TYPED — the
// approach derives its pitch from bar 8's root, which is the same I.
pattern: [
{ deg: '1', beat: 1 }, { deg: '6', beat: 2 }, { deg: 'b7', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'the boogie climb: 6–♭7, then chromatically under the octave root of bar 8',
},
{
// C D E F♯ → G: same 123 walkup aimed at the V; F♯ is the key's ♯4.
pattern: [
{ deg: '1', beat: 1 }, { deg: '9', beat: 2 }, { deg: '3', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'bar 8 aims at the V: 123, then the half-step under its root',
},
{
// G B D E → F: up the V triad; E is the half-step under the IV's root.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'up the triad, then duck a half-step under the IV',
},
{
// F A C B → C: up the IV triad to the key's root, dip under it, resolve.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'the IV\'s 5th IS the key\'s root — touch it, dip under, land',
},
{
// C B♭ A A♭ → G: the turnaround descent 1–♭76–♭6, the ♭6 typed as the
// approach from above (V root + 1). Four consecutive tones: whole step,
// half step, half step, then the half-step sink onto the V.
pattern: [
{ deg: '1', beat: 1 }, { deg: 'b7', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'the turnaround descent: 1–♭76–♭6 sinking onto the V',
},
{
// G G A B → C: pedal the V, then walk the key's 6th and 7th home.
pattern: [
{ deg: '1', beat: 1 }, { deg: '1', beat: 2 }, { deg: '9', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'double the root, then climb the last two steps into the next chorus',
},
],
position: 'one position around the key root; open E and A do the low roots when the key allows',
tips: 'Approach-note targeting is the whole craft: beats 13 belong to THIS chord, beat 4 belongs to the NEXT one. Every seam here is the same move — walk toward the coming root and place a half-step under it — so once your ear owns bar 4, bars 6, 8, 9 and 10 are free. The one seam that differs is bar 11: the classic descent (1–♭76–♭6) approaches the V from a half-step ABOVE, because the ♭6 of the key already lives there.',
},
{
label: 'Eighth-note ramble (jump / rock\'n\'roll)',
level: 'intermediate',
feel: 'driving swung 8ths — the boogie-woogie piano left hand on four strings, doubling the guitar\'s ramble',
chords: [
{ pattern: RAMBLE, note: 'up 1356–♭7 and back down — peaks a minor 7th above the root' },
{ pattern: RAMBLE }, { pattern: RAMBLE },
{ pattern: RAMBLE, note: 'the last 8th (the 3rd) is already a half-step under the IV — the figure walks itself into bar 5' },
{ pattern: RAMBLE }, { pattern: RAMBLE },
{ pattern: RAMBLE }, { pattern: RAMBLE },
{
// G B D E F E D E → F: bar 9's tail bends — the V's closing 3rd (B) sits a
// tritone from the IV's root (F), so the last 8th becomes the chromatic
// approach (E) and the bar ends walking 56 → root of the IV.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 1.5 }, { deg: '5', beat: 2 }, { deg: '6', beat: 2.5 },
{ deg: 'b7', beat: 3 }, { deg: '6', beat: 3.5 }, { deg: '5', beat: 4 },
{ approach: 'chrom-below', beat: 4.5 },
],
note: 'V into IV is the figure\'s one rough seam (a tritone) — swap the last 8th for the half-step under the IV',
},
{ pattern: RAMBLE },
{ pattern: RAMBLE },
{ pattern: RAMBLE, note: 'bar 12 needs no edit: the closing 3rd of the V is a half-step under the returning tonic — the push is built in' },
],
position: 'one position; the figure spans root to ♭7, so it sits on two strings',
tips: 'The ramble is an agreement, not a line — guitar, piano left hand and bass all play it in octaves and nobody varies it (that IS the sound: Chess-session discipline, Willie Dixon behind Chuck Berry). Note what the figure buys you for free: it closes every bar on the chord\'s 3rd, which into the IV — and from the V back home — is already the chromatic approach. Only bar 9\'s V-to-IV seam needs a repair, and one eighth note fixes it.',
},
],
'blues-quickchange': [
{
label: 'Chicago shuffle cell (R565)',
level: 'foundation',
feel: 'Chicago shuffle — fat quarters, the 6th answering the 5th; the bass half of the Jimmy Reed rock',
chords: [
{
// C G A E → F: the cell with its 4th beat swapped for the approach —
// E, a half-step under the IV's root, is the I's own major 3rd.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'beat 4 announces the quick change — and that approach note is the I\'s own 3rd',
},
{
// F C D D♭ → C: 6th, then chromatic slide DD♭–C back home from above.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'exit by half-steps: the IV\'s 6th slides 6–♭6 onto the I\'s root',
},
{ pattern: CHI_CELL, note: 'home — root, fifth, sixth, fifth' },
{ pattern: CHI_CELL, note: 'plain into bar 5: the cell\'s last 5th falls a whole step onto the IV\'s root' },
{ pattern: CHI_CELL },
{
// F C D D♭ → C — the same exit as bar 2.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'the bar-2 exit again — the quick change taught you this one early',
},
{ pattern: CHI_CELL },
{
// C G A F♯ → G: cell into the half-step under the V.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: '6 down to ♯4, half-step under the V',
},
{
// G B D E → F: up the V triad, then a half-step under the IV.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'V to IV: up the triad, duck under',
},
{
// F A C B → C: up the IV triad, dip under home, land.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'touch the key\'s root (the IV\'s 5th), dip a half-step, resolve',
},
{
// C G A F♯ → G — the bar-8 walkup again; bar 11 aims at the V.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'same aim as bar 8 — the turnaround\'s V arrives on schedule',
},
{
// G F E D → C: 1–♭765 of the V = the key's 5432 walking down to home.
pattern: [
{ deg: '1', beat: 1 }, { deg: 'b7', beat: 2 }, { deg: '6', beat: 3 },
{ deg: '5', beat: 4 },
],
note: 'walk straight down the scale — the key\'s 5432 — into the next chorus',
},
],
position: 'first five frets; the R56 cell sits across two strings in one hand position',
tips: 'The R565 rock is the same figure the rhythm guitarist plays as dyads (the Jimmy Reed shuffle) — you are the bottom note of that conversation, so match the guitarist\'s swing exactly or the whole band flams. The quick change is a hearing exam: beat 4 of bar 1 is where you tell the band you knew it was coming. And notice the economy — two approach flavors (half-step from below, half-step from above) cover every seam this play marks; the two it leaves plain (bars 4 and 12) already move by step on their own.',
},
],
'blues-8bar': [
{
label: 'Two-feel with walking seams (Key to the Highway)',
level: 'intermediate',
feel: 'easy shuffle two-feel — roots and fifths as the default, walking only where the form moves',
chords: [
{
// C E F F♯ → G: the 134–♯4 walkup, ♯4 typed as the approach under the V.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '11', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'the V is already in bar 2 — walk 134–♯4 straight at it',
},
{
// G B D E → F: up the V triad, half-step under the IV.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'and immediately down to the IV — up the triad, duck under',
},
{
pattern: [{ deg: '1', beat: 1 }, { deg: '5', beat: 3 }],
note: 'two-feel — the form finally sits still for a bar',
},
{
// F A B♭ B → C: the SAME 134–♯4 walkup — IV to I is also root motion
// up a perfect fifth, so the shape transfers note-for-note.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '11', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'the bar-1 walkup again: IV→I is the same fifth-up motion as I→V',
},
{
pattern: [{ deg: '1', beat: 1 }, { deg: '5', beat: 3 }],
note: 'two-feel — and beat 3 (the I\'s 5th) is already the V\'s root, naming what comes',
},
{
// G D B → C: root, fifth, then the half-step under home.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'stay in the two-feel and add one pickup note under the I',
},
{
// C B♭ A A♭ → G: the turnaround descent, ♭6 typed as the approach from above.
pattern: [
{ deg: '1', beat: 1 }, { deg: 'b7', beat: 2 }, { deg: '6', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: '1–♭76–♭6 sinking onto the V — the classic descent',
},
{
// G A B → C: 12, then the half-step under the wrap.
pattern: [
{ deg: '1', beat: 1 }, { deg: '9', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'push: walk 123-of-the-V shape up into the next chorus',
},
],
position: 'first position; the walkups stay within a hand span',
tips: 'The 8-bar form punishes autopilot — the V lands in bar 2, where a 12-bar reflex expects home. So invert the usual economy: sit in the two-feel and spend motion ONLY at the seams, which makes every walkup an announcement the band can steer by. The transferable prize is the 134–♯4 walkup: it targets any root a fifth above where you stand, which is why bars 1 (I→V) and 4 (IV→I) are the identical shape on different roots.',
},
],
'blues-minor': [
{
label: 'Slow-burn 12/8 (root, fifth, octave)',
level: 'foundation',
feel: '12/8 slow burn — pillars on 1 and 3, one pickup note per seam; whole-bar patience',
chords: [
{ pattern: R5_OCT, note: 'root, fifth, octave — three pillars, then air' },
{ pattern: R5_OCT },
{ pattern: R5_OCT },
{
// C G E → F: the pickup under the iv is E — outside C minor, borrowed
// for one beat as a leading tone; typed as the approach, it can't misspell.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 3 },
{ approach: 'chrom-below', beat: 4 },
],
note: 'the Jemmott move: a half-step under the iv, slid into its root',
},
{ pattern: R5_OCT },
{
// F C D♭ → C: approach from above — a half-step sigh onto the tonic.
pattern: [
{ deg: '1', beat: 1 }, { deg: '5', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'come home from above — the ♭2 sighing a half-step onto the i',
},
{ pattern: R5_OCT },
{
// C E♭ G → A♭: spell the minor triad; its 5th already sits a half-step
// under the ♭VI's root, so the approach into bar 9 is free.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 3 }, { deg: '5', beat: 4 },
],
note: 'the i\'s own 5th is a half-step under the ♭VI — beat 4 is already the approach',
},
{
// A♭ C E♭ A♭ → G: outline the new dominant, then restate the root as the
// typed approach (V root + 1 = this chord's own root) and let it sink.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'the drama bar: the ♭VI\'s root IS the half-step above the V — restate it and sink',
},
{
// G B D → C: the V with its leading-tone 3rd; the 5th lands home from a
// whole step above.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 3 }, { deg: '5', beat: 4 },
],
note: 'the V\'s major 3rd is the key\'s leading tone — one bar of light, then dark',
},
{ pattern: R5_OCT },
{
pattern: [{ deg: '1', beat: 1 }],
note: 'one note, whole bar — no push; the minor chorus ends at home',
},
],
position: 'low and open; let every note ring into the triplet space',
tips: 'Minor blues is won by subtraction: three pillars a bar, and one pickup note per seam does all the storytelling. Bars 810 are the lesson in root motion — the i\'s 5th sits a half-step under the ♭VI, and the ♭VI\'s root sits a half-step above the V, so the form\'s whole climax is two half-steps you barely have to reach for. Jerry Jemmott built "The Thrill Is Gone" on exactly this economy: the half-step-below approach, slid — not hammered — into the target.',
},
{
label: 'Minor box riff (1–♭345)',
level: 'intermediate',
feel: 'hypnotic medium groove — one four-note riff, unbroken, transposed by the form',
chords: [
{ pattern: BOX_RIFF, note: 'the first four notes of the minor pentatonic, as a bassline' },
{ pattern: BOX_RIFF }, { pattern: BOX_RIFF }, { pattern: BOX_RIFF },
{ pattern: BOX_RIFF, note: 'on the iv the riff\'s top note is the key\'s tonic — the loop points home' },
{ pattern: BOX_RIFF },
{ pattern: BOX_RIFF },
{ pattern: BOX_RIFF, note: 'ends on the 5th, a half-step under the ♭VI — the approach comes free' },
{ pattern: BOX_RIFF, note: 'the 3rd majorizes by itself on the dominant — same degrees, new quality' },
{ pattern: BOX_RIFF, note: 'and again on the V: 1345 with the leading tone in it' },
{ pattern: BOX_RIFF },
{ pattern: BOX_RIFF, note: 'the closing 5th drops a fifth onto the wrap — the strongest landing there is' },
],
position: 'one box position — the riff never leaves a four-fret window',
tips: 'The riff lane: pick a cell and refuse to leave it — the hypnosis is the point, and the form does the arranging. Because the degrees resolve through each chord\'s quality, the identical fingering thinks for you: ♭3 on the minor chords becomes a major 3rd on the ♭VI7 and V7 without you deciding anything. That is the deepest habit this pack can teach — think in degrees, not notes, and every riff you own transposes to every chord you meet.',
},
],
'blues-turnaround': [
{
label: 'Walking the cycle',
level: 'intermediate',
feel: 'swinging quarters — a jazz walk squeezed into the blues\' back door',
chords: [
{
// C E G B♭ → A: up the I7 arpeggio; the ♭7 is ALSO the half-step above
// the VI's root, so the approach note is a chord tone wearing two hats.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'the approach into the VI is the I\'s own ♭7 — one note, two jobs',
},
{
// A C♯ E G → D: the full dominant arpeggio; the ♭7 falls a perfect
// fourth onto the ii's root.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ deg: 'b7', beat: 4 },
],
note: 'straight up the VI7 — the ♭7 lands on the ii from a fourth above',
},
{
// D F A A♭ → G: minor arpeggio, then AA♭–G — a pure chromatic walkdown.
pattern: [
{ deg: '1', beat: 1 }, { deg: '3', beat: 2 }, { deg: '5', beat: 3 },
{ approach: 'chrom-above', beat: 4 },
],
note: 'the ii\'s 5th starts a chromatic slide: 5, then the half-step above the V, then the V',
},
{
// G A B G → C: walk 123, then drop to the fifth of the TARGET — which
// on this wrap is the V's own root: the VI cadence inside one bar.
pattern: [
{ deg: '1', beat: 1 }, { deg: '9', beat: 2 }, { deg: '3', beat: 3 },
{ approach: 'fifth-of-next', beat: 4 },
],
note: 'climb 123, then drop to the 5th of the next root — here, the V root itself',
},
],
position: 'one position; the arpeggios alternate strings on their own as the roots fall in fifths',
tips: 'The jazz handshake, learned as three approach flavors in four bars: half-step from above (twice — and the first one is a chord tone already), a fall from the fourth above, and the fifth-of-the-target, which is the bass player\'s strongest word because it plays a VI cadence into whatever comes next. Loop this at a jam and you\'ve pre-learned bars 1112 of every uptown blues — the same cycle the guitar pack shells through.',
},
{
label: 'Two-beat kicks (roots and approaches)',
level: 'foundation',
feel: 'jump two-beat — root on the kick, approach right behind it; often two beats per chord',
chords: [
{
// C B♭ → A: root, then the half-step above the VI (again the I's ♭7).
pattern: [{ deg: '1', beat: 1 }, { approach: 'chrom-above', beat: 3 }],
note: 'root, then lean on the ♭7 — it drops you onto the VI',
},
{
// A C♯ → D: root, then the half-step under the ii — the VI's own 3rd.
pattern: [{ deg: '1', beat: 1 }, { approach: 'chrom-below', beat: 3 }],
note: 'the VI\'s major 3rd pushes up a half-step onto the ii',
},
{
// D A → G: root and fifth; the fifth steps down a whole step onto the V.
pattern: [{ deg: '1', beat: 1 }, { deg: '5', beat: 3 }],
note: 'rootfifth — the 5th falls a whole step onto the V',
},
{
// G B → C: root, then the leading tone (the V's 3rd) under home.
pattern: [{ deg: '1', beat: 1 }, { approach: 'chrom-below', beat: 3 }],
note: 'the V\'s 3rd is the key\'s leading tone — it hands you bar 1',
},
],
position: 'low register, short notes — leave the triplet air to the pianist',
tips: 'The minimum viable turnaround: state the root, then play ONE note that belongs to the next chord more than this one. When the band squeezes the cycle into two bars (two beats per chord — the usual jazz-blues bars 1112), this is the same pattern with the beats halved: root on the front beat, approach on the back. Notice that every back-beat note here is a chord tone of its own bar that also targets the next root — good targeting usually costs nothing.',
},
],
},
}
+80
View File
@@ -230,4 +230,84 @@ export default {
},
],
},
// Structured licks (SCHEMA.md "Licks", task P-21). Written in a home key each
// (noted per lick) but key-agnostic in spirit — chordContext names the station.
// Every pitch hand-verified: s6=E s5=A s4=D s3=G s2=B s1=e (+fret, mod 12).
licks: [
{
// In C (box at fret 8): G C D→E C A G = 5 R 9→3 R 13 5, C major pentatonic
// over the I7 — the sweet B.B. side of the coin.
id: 'blues-bb-box-sweet',
name: 'B.B. box sweet-spot phrase',
level: 'foundation',
chordContext: 'over the I7',
techniques: ['bend', 'vibrato'],
source: 'in the style of B.B. King\'s box-position fills; Guitar World "B.B. box" lessons (R-2-4-5-6 grid)',
tab: [
{ string: 2, fret: 8 }, // G — the 5th
{ string: 1, fret: 8 }, // C — root
{ string: 1, fret: 10, technique: 'bend' }, // D bent a whole step to E, the 3rd — the signature move
{ string: 1, fret: 8 }, // C
{ string: 2, fret: 10 }, // A — the 13
{ string: 2, fret: 8, technique: 'vibrato' }, // G — settle on the 5th
],
},
{
// In E, open position: ♭76–♭65 (D C♯ C B) descending on the B string
// under a high-e root pedal, resolving to the V7's root (B).
id: 'blues-open-turnaround',
name: 'Descending turnaround under a root pedal',
level: 'foundation',
chordContext: 'bars 1112: I7 walking down to the V7',
techniques: ['double-stop', 'vibrato'],
source: 'the Robert Johnson-lineage turnaround (e.g. "Kind Hearted Woman"); Fundamental Changes "Blues Turnarounds for Guitar"',
tab: [
{ string: 2, fret: 3 }, // D — ♭7
{ string: 1, fret: 0, technique: 'double-stop' }, // E pedal on top
{ string: 2, fret: 2 }, // C♯ — 6
{ string: 1, fret: 0, technique: 'double-stop' },
{ string: 2, fret: 1 }, // C — ♭6
{ string: 1, fret: 0, technique: 'double-stop' },
{ string: 2, fret: 0 }, // B — 5
{ string: 1, fret: 0, technique: 'double-stop' },
{ string: 5, fret: 2, technique: 'vibrato' }, // B — root of the V7: the landing
],
},
{
// In A, box 1: C→C♯ (♭3 hammered to the major 3) into the E+A double-stop,
// ♭7 bend, settle on the 5th — the 12/8 slow-blues answer phrase.
id: 'blues-slow-curl',
name: 'Slow-blues curl into the root double-stop',
level: 'intermediate',
chordContext: 'over the I7, 12/8 slow blues',
techniques: ['hammer-on', 'double-stop', 'bend', 'vibrato'],
source: 'stock box-1 slow-blues vocabulary (the ♭3→3 curl); TrueFire Texas-blues chord-tone lessons',
tab: [
{ string: 3, fret: 5 }, // C — ♭3
{ string: 3, fret: 6, technique: 'hammer-on' }, // C♯ — the major 3rd; the blues curl made explicit
{ string: 2, fret: 5 }, // E — 5th
{ string: 1, fret: 5, technique: 'double-stop' }, // A on top — root+5th dyad
{ string: 2, fret: 8, technique: 'bend' }, // G (♭7) bent a whole step toward the root
{ string: 2, fret: 5, technique: 'vibrato' }, // E — resolve on the 5th
],
},
{
// In A (IV = D9): the IV7's 3+♭7 tritone pair (F♯+C) slid in from one fret
// below (F+B), then the 5th on top — the Texas comping move as a lick.
id: 'blues-iv9-slide',
name: 'Tritone slide into the IV9',
level: 'intermediate',
chordContext: 'bar 5: landing on the IV7',
techniques: ['chromatic-approach', 'double-stop', 'slide', 'vibrato'],
source: 'the Texas/Freddie King 9th-grip slide-in ("Hide Away" comping vocabulary); Fundamental Changes SRV/Freddie King 9ths',
tab: [
{ string: 4, fret: 3, technique: 'chromatic-approach' }, // F — one fret below the 3rd
{ string: 3, fret: 4, technique: 'double-stop' }, // B — one fret below the ♭7
{ string: 4, fret: 4, technique: 'slide' }, // F♯ — the IV7's 3rd
{ string: 3, fret: 5, technique: 'double-stop' }, // C — the IV7's ♭7: the tritone pair lands
{ string: 1, fret: 5, technique: 'vibrato' }, // A — the IV7's 5th (the key's root)
],
},
],
}
+393
View File
@@ -0,0 +1,393 @@
// Blues piano pack (task P-31). Recipes verified by degree-spelling against
// CHORD_TYPES (src/lib/theory.js) and the validator's stacking convention
// (order inside each hand = voicing order low → high, nearest strictly above —
// documented at jazz/piano.js header). Every voice-leading/interval statement
// in notes/tips is pitch-class arithmetic, computed against the realized
// voicings (reference key C / C minor) before writing. Combined LH+RH stacks
// are kept ≤ 23 semitones so every recipe renders inside JamGuide's 36-key
// window for all 12 roots (same budget as rnb/piano.js).
// Voicings and treatments sourced from:
// pianogroove.com — Chicago Blues course ("Chicago Blues Hand Independence":
// LH shell / RH chord two-job split), "How To Count Slow Blues" & "12/8 Feel
// For Slow Blues" (four beats each split in three; rolled arrivals), "Blues
// Piano Comping Patterns & Rhythms" and "Basic Blues Voicings & Patterns"
// (shell + guide-tone comping, 9th/13th dominant colour);
// pianowithjonny.com — "Blues Chords for Piano: The Complete Guide" (9ths and
// 13ths as the bright blues extensions, ♭9/♯9/♭13 as the crunch) and "Slow
// Blues Piano for Beginners";
// piano-ology.com — "Dominant 7(♯9) Voicings" (the no-5th grip: 3–♭7–♯9,
// major-against-minor-third tension) and "Killer Blues Piano Grace Notes"
// (the ♭3→3 crush as the pianist's bend);
// Wikipedia, "Dominant seventh sharp ninth chord" (the 7♯9 codifies the blues
// scale's ♭3 sounding over a major-third dominant);
// Otis Spann (Blues Hall of Fame) — the postwar Chicago model this pack's
// two-fisted play imitates: piano as the only harmony behind voice and guitar;
// Pinetop Smith, "Pinetop's Boogie Woogie" — the rocking 5th↔6th shuffle
// left hand; pianote.com "How to Play Blues Piano" (right-hand harmony in
// sixths); Mark Levine, The Jazz Piano Book (rootless Type A/B dominants,
// 13 replacing the 5) — the uptown/band grips blues borrows from jazz.
// Pedagogy frame: docs/learn-curriculum.md — Piano pillar (shells → rootless,
// register discipline, voice-leading as hand economy).
// Reusable degree recipes. Order inside each hand = voicing order, low → high.
const LH_R = ['1'] // single bass root
const LH_R5 = ['1', '5'] // root + fifth anchor
const LH_R7 = ['1', '7'] // root + ♭7 shell — the Chicago left hand
const RH_TRIAD = ['1', '3', '5'] // plain root-position triad (the ♭7 lives downstairs)
const GT_37 = ['3', '7'] // guide tones, 3rd on the bottom
const GT_73 = ['7', '3'] // guide tones flipped, ♭7 on the bottom
const RH_9 = ['9', '3', '7'] // 9th spread: the 9 tucked under the guide tones
const RH_7TH = ['3', '5', '7'] // full seventh chord stacked above the anchor
const RH_SHARP9 = ['3', '7', '#9'] // the crying chord: 3–♭7–♯9, no 5th (piano-ology grip)
const RH_13 = ['3', '13', '7'] // 13th cluster: the 13 crushed under the ♭7
const A_DOM = ['3', '13', '7', '9'] // rootless Type A dominant (Levine: 13 for 5)
const B_DOM = ['7', '9', '3', '13'] // rootless Type B dominant
export default {
styleIntro:
'Blues piano is two instruments in one player: a left hand that keeps the shuffle honest (roots, shells, the boogie rock) and a right hand that talks back — stabs, sixths, tremolos, the crush of ♭3 into 3. Harmony is three dominant chords and everything expressive happens in how little you move between them: the whole form voice-leads by half-steps and whole steps if you let it.',
comping: [
{
label: 'Shuffle backbeat stabs',
rhythm: 'swung 8ths; right-hand chips on 2 and 4',
description:
'The Chicago comp: the left hand holds the shell (or rocks the boogie) while the right hand stabs with the snare on 2 and 4. Keep the stabs short and identical — in a Chicago band the piano is felt more than heard until the fill.',
},
{
label: 'Slow-blues 12/8 rolls',
rhythm: 'four beats to the bar, each split in three',
description:
'The slow-blues pulse: block or roll the chords into beats 1 and 3 and let the triplet grid breathe underneath. Tremolo the top of the hand at phrase ends — on a slow blues the tremolo is the horn section.',
},
{
label: 'The Pinetop rock (56 left hand)',
rhythm: 'left hand swung 8ths, rocking 5th ↔ 6th',
description:
'The boogie cell from "Pinetop\'s Boogie Woogie": the left hand rocks a whole step between the chord\'s 5th and 6th on every swung 8th, on every chord of the form. It is a drum pattern played on pitches — once it runs itself, the right hand is free.',
},
],
plays: {
'blues-12bar': [
{
label: 'Horn-section shells (jump-blues guide tones)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: GT_37 }, note: '3rd under ♭7 — the two notes that make it a dominant' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'hold — the stabs are rhythm, not new notes' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'still home; leave holes for the singer' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'last bar of home — lean on the and-of-4 into the IV' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'both voices fall a half-step: the I\'s 3rd onto this ♭7, its ♭7 onto this 3rd' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'sit' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'home — the same two half-steps, rising this time' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'hold' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'bar 9: both voices rise a half-step — the I\'s 3rd becomes this ♭7, its ♭7 this 3rd' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'V to IV: the pair slides down a whole step in parallel' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'home on half-steps again' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'bar 12 pushes: a half-step up in both voices, and the next chorus starts' },
],
register: 'LH single roots around C3; RH dyads just above middle C — horn-section territory',
tips: 'Two right-hand fingers cover the whole form, and no change moves either of them more than a whole step: into the IV both guide tones fall a half-step, into the V both rise a half-step, and V-to-IV slides a whole step in parallel. This is the jump-blues horn pad translated to the keys — play it on the shuffle backbeat and you are the brass section. When the band thins out, add the root back with the left hand; when a soloist rips, this is already everything they need from you.',
},
{
label: 'Slow blues, full hands (12/8)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'a two-hand 9th spread — root and 5th below, the 9 tucked under the guide tones above' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'hold — roll it into beat 3, or tremolo the top two notes' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'still home; answer an imaginary singer in the gaps' },
{ recipe: { LH: LH_R, RH: RH_SHARP9 }, note: 'I7♯9 — the 9 sharpens a half-step into the ♯9, which is the key\'s own ♭3: the blue note leaning into the IV' },
{ recipe: { LH: LH_R5, RH: B_DOM }, note: 'the ♯9 holds over as this chord\'s ♭7 (same key); the I\'s ♭7 falls a half-step onto this 3rd' },
{ recipe: { LH: LH_R5, RH: B_DOM }, note: 'sit on the 13 — it is the key\'s own 9th, sweet against the IV' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'the IV\'s 13 holds as this 9; its guide tones each rise a half-step home' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'hold — or thin out before the V arrives' },
{ recipe: { LH: LH_R, RH: RH_SHARP9 }, note: 'the crying chord: the key\'s ♭7 refuses to move — it was the I\'s ♭7 and stays on as this ♯9' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'the ♯9 slips a half-step onto this 3rd; the V\'s ♭7 lands in your left hand as the new root' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'the guide tones trade one last time — two half-step rises' },
{ recipe: { LH: LH_R5, RH: RH_13 }, note: 'V13 out: the I\'s 3rd holds as this 13 while its ♭7 pushes up a half-step onto the 3rd' },
],
register: 'LH around C3, RH stacks around middle C; 12/8 — every beat divides in three',
tips: 'The slow blues legitimizes both blue notes with chords: the key\'s ♭3 becomes the I7\'s ♯9 in bar 4 and then holds over as the IV7\'s ♭7 in bar 5; the key\'s ♭7 becomes the V7\'s ♯9 in bar 9. The 7♯9 grip here is the classic three-note voicing — 3rd, ♭7, ♯9, no 5th — the "minor third" slung up high, a major seventh above the major third — the whole blues argument in one hand. Roll the big chords into the beat and save the tremolo for the ends of phrases.',
},
],
'blues-quickchange': [
{
label: 'Two-fisted Chicago (Otis Spann lane)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'root + ♭7 shell below, plain triad above — the ♭7 lives downstairs' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'quick change: the I\'s root holds as this chord\'s 5th; its 3rd climbs a half-step onto the new root' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'home in bar 3 — the IV\'s root falls the same half-step back onto the 3rd' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'hold; rock the right hand in swung 8ths' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'IV again — same half-step climb as bar 2' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'sit' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'home' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'hold — bar 8 sets up the V' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'the I\'s 5th holds as the new root; the old root slips a half-step down onto the V\'s 3rd' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'the triad slides down a whole step in parallel — V to IV is the blues\' one pure parallel move' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'home' },
{ recipe: { LH: LH_R7, RH: RH_TRIAD }, note: 'V7 — kick the next chorus' },
],
register: 'LH shell around C2C3, RH triads mid-keyboard — two hands, two jobs',
tips: 'The postwar Chicago model (Otis Spann behind Muddy Waters): the piano is the only harmony instrument, so the left hand is the bass player (root + ♭7 shell, or the Pinetop 56 rock) and the right hand is the section. The right-hand triad carries no ♭7 on purpose — the shell already supplies it, so together the hands spell the full dominant without mud. The drill this progression exists for: hear bar 2 coming — the quick change is the same one-half-step move as bar 5, just three bars early.',
},
{
label: 'Uptown rootless (9s and 13s behind a band)',
level: 'intermediate',
chords: [
{ recipe: { LH: A_DOM }, note: 'Type A dominant: 313–♭79 — two colour tones per chord' },
{ recipe: { LH: B_DOM }, note: 'quick change: two names hold (the I\'s 13 and 9 become this 3rd and 13); the 3rd falls a half-step onto this ♭7, the ♭7 drops a minor third onto the 9' },
{ recipe: { LH: A_DOM }, note: 'home — the same two fingers walk back' },
{ recipe: { LH: A_DOM }, note: 'hold' },
{ recipe: { LH: B_DOM }, note: 'the bar-2 seam again — spot it faster this time' },
{ recipe: { LH: B_DOM }, note: 'sit' },
{ recipe: { LH: A_DOM }, note: 'home' },
{ recipe: { LH: A_DOM }, note: 'hold — or thin to bare 3 + ♭7 if the guitarist is busy' },
{ recipe: { LH: A_DOM }, note: 'two names hold again (the I\'s 3rd becomes this 13, its 13 this 9); the ♭7 rises a half-step onto the V\'s 3rd' },
{ recipe: { LH: B_DOM }, note: 'the V\'s 9 holds as this 3rd; its 13 falls a half-step onto this ♭7' },
{ recipe: { LH: A_DOM }, note: 'the IV\'s ♭7 rises a half-step onto this 3rd; its 3rd and 13 stay put as the 13 and 9' },
{ recipe: { LH: A_DOM }, note: 'bar 12 — same grip as bar 9; the form is a wheel' },
],
register: 'left hand alone, top note between C4 and C5 — the bassist owns the roots',
tips: 'The Levine rootless dominants moved into a blues — the uptown sound of a jump band with a bassist, where doubling roots just muddies the bottom. Every I-to-IV seam is the same physical fact: two fingers freeze while two slide, so the quick change costs exactly as much in bar 2 as in bar 5. Comp these on the backbeat and keep the top note in one narrow lane; the colour (9s and 13s everywhere) does the rest.',
},
],
'blues-8bar': [
{
label: 'Front-porch pillars (rolled 12/8)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'root and 5th below, the full seventh chord stacked above' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'the V in bar 2 — every voice by step: the 3rd and 5th fall a whole step (onto the V\'s 5th and ♭7), the ♭7 rises a half-step onto its 3rd' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'V to IV: the entire two-hand grip — roots included — slides down a whole step in parallel' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'sit on the IV — roll it' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'home: the IV\'s ♭7 rises a half-step onto the 3rd; its 3rd and 5th each fall a whole step' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'V again — bar 6, not bar 9; count the form out loud' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'home for one bar' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'V out — it hands you bar 1' },
],
register: 'LH open fifths around C3, RH sevenths around middle C; roll into beats 1 and 3',
tips: 'One two-hand shape planted on three roots — the front-porch reading of "Key to the Highway". Because the right hand is the plain 35–♭7 stack, no change in the form moves any right-hand finger more than a whole step (the left hand\'s roots do the jumping), and V-to-IV slides both hands down a whole step in parallel. That makes this the form-learning play: your hands physically feel that the V arrives in bar 2, which is exactly where 12-bar reflexes get wrong-footed.',
},
{
label: 'Parallel sixths (the fills lane)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: ['5', '3'] }, note: 'a bare sixth — the 5th with the 3rd singing a major sixth above it' },
{ recipe: { LH: LH_R, RH: ['7', '5'] }, note: 'both voices fall a whole step — the dyad is now ♭7 under 5th, still a sixth wide' },
{ recipe: { LH: LH_R, RH: ['1', '13'] }, note: 'the dyad does not move: the V\'s ♭7 and 5th are already this chord\'s root and 13 — only the bass falls' },
{ recipe: { LH: LH_R, RH: ['1', '13'] }, note: 'sit — tremolo the sixth' },
{ recipe: { LH: LH_R, RH: ['5', '3'] }, note: 'both voices climb a whole step home' },
{ recipe: { LH: LH_R, RH: ['7', '5'] }, note: 'down a whole step again — the early V, second lap' },
{ recipe: { LH: LH_R, RH: ['5', '3'] }, note: 'home' },
{ recipe: { LH: LH_R, RH: ['7', '5'] }, note: 'out — the sixth rocks down one more time and the form comes around' },
],
register: 'LH roots low; the sixths sit where a singer would — the middle of the keyboard',
tips: 'Right-hand sixths are blues piano\'s harmonized-vocal sound — two notes that move like one singer with a shadow. The whole eight bars is one dyad rocking between just two positions a whole step apart, plus one free change (into the IV, where the notes stay and only the bass moves). Decorate it the blues way: tremolo the dyad, and crush into its top note from the key a half-step below — the ♭3-into-3 crush is the pianist\'s string bend.',
},
],
'blues-minor': [
{
label: 'The Thrill pads (m9 spreads)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'm9 — the 9 tucked under the ♭3, a slow-burn spread' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'hold — tremolo, or answer yourself with a fill' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'still home; minor blues burns slower than major' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'lean into the iv' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'two names hold — the i\'s ♭3 is this ♭7, its 5th this 9; the i\'s ♭7 and 9 each fall a whole step (onto this ♭3 and 5th)' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'sit' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'the mirror: the iv\'s ♭3 and 5th climb a whole step back; its ♭7 and 9 hold' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'hold — bar 9 is coming' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'the drama: the i\'s ♭7 holds on as this chord\'s 9, and the bass 5th climbs a half-step onto the new root' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'all five voices sink a half-step together — the ♭VI was the V a half-step early' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'resolve dark: the V\'s ♭7 falls a whole step onto the ♭3; its 3rd slips a half-step back onto the ♭7' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'sit — no push; the minor blues ends its chorus at home' },
],
register: 'LH fifths around C3, RH spreads just above middle C; long tones, B.B.-band tempo',
tips: 'The lane B.B. King\'s bands live in on "The Thrill Is Gone": sustained 9th spreads, one shape for the whole form. The payoff bar is 9-into-10 — keep the identical grip on the ♭VI7 and V7 and every voice, bass included, sinks exactly a half-step: the strongest move in the style is also the easiest. (B.B.\'s recording colours the ♭VI as a maj7, as the progression card notes — this play keeps it dominant so the plane stays pure; try both.)',
},
{
label: 'After-hours dyads (two fingers and smoke)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: GT_37 }, note: '♭3 under ♭7 — a bare fifth; minor blues needs almost nothing' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'hold' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'space — the drummer is playing; you don\'t have to' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'a small push into the iv' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'the i\'s ♭3 holds as this ♭7; its ♭7 falls a whole step onto this ♭3' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'sit' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'the same two names trade straight back' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'hold' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'suddenly a tritone — the form\'s first true dominant crunch; the i\'s ♭7 climbed a whole step onto this 3rd' },
{ recipe: { LH: LH_R, RH: RH_SHARP9 }, note: 'both dyad voices fall a half-step, and the ♯9 lands on top — the i\'s own ♭7, back from its one-bar detour' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'the ♯9 keeps its key and goes back to being the ♭7; the V\'s ♭7 falls a whole step onto the ♭3' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'sit in the dark' },
],
register: 'one bass note, two (then three) right-hand notes mid-keyboard; late-night volume',
tips: 'Minor blues by subtraction: on the minor chords the 3-and-7 dyad is a hollow perfect fifth, and the moment the ♭VI7 arrives the same two degrees snap into a tritone — the form\'s harmonic drama is audible in one interval changing shape under two fingers. The V7♯9 is the only three-note chord of the night, and its ♯9 is the note the night was built on: the key\'s ♭7, recast as the scream. If it sounds empty, good — push the placement, not the note count.',
},
],
'blues-turnaround': [
{
label: 'Stormy Monday pillars (slow 12/8)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_9 }, note: '9th spread over root and 5th — uptown from the first beat' },
{ recipe: { LH: LH_R, RH: ['3', '7', 'b9'] }, note: 'VI7♭9: the I\'s ♭7 holds on as this ♭9; its 9 falls a half-step onto this 3rd; the bass drops a minor third' },
{ recipe: { LH: LH_R5, RH: RH_9 }, note: 'the ♭9 sighs a half-step down onto this chord\'s 5th; the VI\'s ♭7 falls a whole step onto this ♭3' },
{ recipe: { LH: LH_R5, RH: RH_13 }, note: 'V13: the ii\'s 9 and ♭3 hold (as this 13 and ♭7); its ♭7 falls a half-step onto this 3rd — the iiV law' },
],
register: 'LH low anchors, RH stacks around middle C; slow 12/8, roll the big ones',
tips: 'The uptown turnaround under one thread: a single key does three jobs in three bars — it starts as the I\'s ♭7, holds on as the VI7\'s ♭9, then sighs a half-step onto the ii\'s 5th. Back into bar 1 both of the V\'s guide tones fall a half-step (♭7 onto the I\'s 3rd, 3rd onto the I\'s ♭7), so the wheel never clunks. T-Bone Walker\'s "Stormy Monday" intro walks a close cousin of this cycle, as the progression card says — learn it here as hand motion and the uptown blues stops being mysterious.',
},
{
label: 'Jump kicks (two-beat shells)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'guide tones only — this cycle usually gets two beats per chord' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'the one athletic move: I and VI share no guide tones, so both voices hop up a minor third' },
{ recipe: { LH: LH_R, RH: GT_37 }, note: 'the VI\'s 3rd falls a half-step onto this ♭7; its ♭7 a whole step onto this ♭3' },
{ recipe: { LH: LH_R, RH: GT_73 }, note: 'the ii\'s ♭3 holds as this ♭7; its ♭7 falls a half-step onto this 3rd — then both voices sigh a half-step into bar 1' },
],
register: 'short stabs either side of middle C; two-beat changes, land them with the drummer',
tips: 'The turnaround at jump tempo: two-note kicks placed with the drummer, two beats per chord when the band squeezes the cycle into two bars. One lap costs one athletic move — the minor-third hop into the VI, the only seam in the loop where a voice has to leap — and after that every voice holds or resolves by half-step or whole step back to the top. Drill the lap until the hop is automatic; it is the same physical seam as bar 8 of a jazz blues.',
},
],
},
improv: {
scales: [
{
over: 'the whole form (I7IV7V7)',
scale: 'the key\'s blues scale',
why: 'One scale over all three chords is the genre\'s licence, and the chords themselves pre-clear the "wrong" notes: the scale\'s ♭3 is the I7\'s ♯9 and the IV7\'s ♭7, and its ♭7 is the V7\'s ♯9.',
},
{
over: 'I7',
scale: 'mixolydian, mixed with the blues scale',
why: 'Mixolydian supplies the chord, the blues scale the attitude — switch phrase by phrase. The ♭3→3 crush (a half-step, played as a grace note) is the pianist\'s string bend: piano can\'t bend, so it crushes.',
},
{
over: 'IV7',
scale: 'mixolydian from the IV',
why: 'Its ♭7 is the key\'s ♭3 — bar 5 re-tunes the blue note into a chord tone. Target it on the downbeat of the change and the room hears you hear the form.',
},
{
over: 'V7',
scale: 'mixolydian from the V',
why: 'And keep the key\'s ♭7 on call: over the V it becomes the ♯9, the crying note. Let it melt a half-step down onto the natural 9 — the classic slow-blues resolution.',
},
{
over: 'i7 (minor blues)',
scale: 'minor pentatonic of the key',
why: 'The minor form pre-clears everything, and it mostly survives bar 9: three of the ♭VI7\'s four chord tones already sit inside the key\'s blues scale. The one outside note is the ♭VI\'s own root — lean on it only if you want the dark.',
},
],
targetNotes:
'Land the 3rd of each chord on the downbeat of the change — bars 5, 9 and 10 are the exam. Treat the two blue notes as a budget with a schedule: the key\'s ♭3 crushes into 3 over the I and sits still as the ♭7 over the IV; the key\'s ♭7 is home over the I and becomes the ♯9 the moment the V arrives. Between phrases, silence — a blues chorus is a conversation, and the piano already talked.',
},
// Structured piano licks (SCHEMA.md "Piano licks", task P-60). Degree-based
// and key-agnostic: every deg resolves through the stated quality (all four
// licks sit on dominant stations — the blues' native chord; the pentatonic
// fall's tip notes where it survives the minor form too). Realized offsets
// in the comments use a C-rooted chord; every interval claim in notes/tips
// was recomputed from those offsets before writing (P-41 bar).
licks: [
{
// Over C7: (E♭4)E4 G4 C5 B♭4 G4 (E♭4)E4 — offsets [3]4 7 12 10 7 [3]4.
// Both crushes are the ♭3 (3) into the 3rd (4), same beat.
id: 'blues-b3-crush',
name: 'The ♭3 crush',
level: 'foundation',
chordContext: 'over the I7',
quality: 'dom7',
techniques: ['grace-note'],
source: 'the ♭3→3 crush as the pianist\'s string bend — piano-ology "Killer Blues Piano Grace Notes"',
notes: [
{ deg: 'b3', beat: 1, technique: 'grace-note' },
{ deg: '3', beat: 1 },
{ deg: '5', beat: 1.5 },
{ deg: '1', octave: 1, beat: 2 },
{ deg: '7', beat: 2.5 },
{ deg: '5', beat: 3 },
{ deg: 'b3', beat: 3.5, technique: 'grace-note' },
{ deg: '3', beat: 3.5 },
],
tips: 'Strings bend; the piano crushes. Flick the ♭3 into the 3rd almost as one gesture, walk straight up the chord (3, 5, octave root), answer back down (♭7, 5), and close with the same crush that opened the phrase — one blue note, spent twice.',
},
{
// Over C7: C5 B♭4 G4 F4 E♭4 C4 — offsets 12 10 7 5 3 0: the full
// minor pentatonic (1 ♭7 5 4 ♭3 1) falling top to bottom on the
// triplet grid, landing the low root on beat 3.
id: 'blues-penta-fall-turnaround',
name: 'Pentatonic fall (turnaround run)',
level: 'foundation',
chordContext: 'bar 11, over the I7, setting up the turnaround',
quality: 'dom7',
techniques: [],
source: 'the descending minor-pentatonic run every blues pianist keeps — stock vocabulary; see pianogroove.com\'s Chicago Blues course',
notes: [
{ deg: '1', octave: 1, beat: 1 },
{ deg: '7', beat: 1.33 },
{ deg: '5', beat: 1.67 },
{ deg: '11', beat: 2 },
{ deg: 'b3', beat: 2.33 },
{ deg: '1', beat: 3 },
],
tips: 'Top to bottom of the minor pentatonic — root, ♭7, 5, 4, ♭3, root — in one triplet gesture, with a breath before the low root lands on beat 3 so the turnaround has somewhere to kick from. Over the I7 the run\'s ♭3 is the chord\'s ♯9 and the 4 passes between the 3rd and the 5th; the same six keys survive untouched over the i7 of a minor blues.',
},
{
// Over C7, high dyads: E5+G5 ×4 (offsets 16+19, a minor third apart)
// hammered on the triplet grid, then peeling down the chord:
// C5(12) B♭4(10) G4(7).
id: 'blues-spann-hammer-dyads',
name: 'Spann hammer dyads',
level: 'intermediate',
chordContext: 'over the I7 — the high fill that cuts through a Chicago band',
quality: 'dom7',
techniques: ['double-stop'],
source: 'in the Otis Spann lane — hammered right-hand triplet dyads, the postwar Chicago fill (Blues Hall of Fame)',
notes: [
{ deg: '3', octave: 1, beat: 1 },
{ deg: '5', octave: 1, beat: 1, technique: 'double-stop' },
{ deg: '3', octave: 1, beat: 1.33 },
{ deg: '5', octave: 1, beat: 1.33, technique: 'double-stop' },
{ deg: '3', octave: 1, beat: 1.67 },
{ deg: '5', octave: 1, beat: 1.67, technique: 'double-stop' },
{ deg: '3', octave: 1, beat: 2 },
{ deg: '5', octave: 1, beat: 2, technique: 'double-stop' },
{ deg: '1', octave: 1, beat: 2.33 },
{ deg: '7', beat: 2.67 },
{ deg: '5', beat: 3 },
],
tips: 'One dyad — the 3rd with the 5th a minor third above it — hammered four times on the triplet grid like a snare press, then the line peels off down the chord: octave root, ♭7, settling on the 5th. The repetition IS the lick; on a slow blues, stretch it toward a tremolo.',
},
{
// Over C7 as the V7 (an F blues): E♭5(15) held, D5(14), B♭4(10),
// G4(7), then the crush (E♭4=3)E4(4). The ♯9→9 melt is 15→14.
id: 'blues-cry-melt-v7',
name: 'The cry and melt (V7 fill)',
level: 'intermediate',
chordContext: 'over the V7, bar 9 of a slow blues',
quality: 'dom7',
techniques: ['grace-note'],
source: 'the ♯9→9 "crying" resolution — pianogroove.com slow-blues lessons; the no-5th grip per piano-ology "Dominant 7(♯9) Voicings"',
notes: [
{ deg: '#9', octave: 1, beat: 1 },
{ deg: '9', octave: 1, beat: 2 },
{ deg: '7', beat: 2.33 },
{ deg: '5', beat: 2.67 },
{ deg: 'b3', beat: 3, technique: 'grace-note' },
{ deg: '3', beat: 3 },
],
tips: 'Lean on the ♯9 for a full beat — over the V7 it is the key\'s own ♭7, the crying note — then let it melt a half-step onto the natural 9, fall through the ♭7 and 5th, and land a ♭3 crush on the 3rd. Placement is the whole trick: bar 9 is the emotional peak of the form.',
},
],
}
+84
View File
@@ -227,4 +227,88 @@ export default {
},
],
},
// Structured licks (SCHEMA.md "Licks", task P-24). Written in a home key each
// (noted per lick) but key-agnostic in spirit — chordContext names the station.
// Every pitch hand-verified: s6=E s5=A s4=D s3=G s2=B s1=e (+fret, mod 12).
licks: [
{
// In G, open position: 2, ♭3 hammered to the 3, then 56 up to the open-G
// root landed on the downbeat. THE bluegrass phrase-ending tag.
id: 'country-flatt-g-run',
name: 'The Lester Flatt G-run',
level: 'foundation',
chordContext: 'phrase-ending tag on the I',
techniques: ['hammer-on'],
source: 'the canonical Flatt & Scruggs tag — hvbluegrass.org "The Truth About the Lester Flatt G Run"',
tab: [
{ string: 5, fret: 0 }, // A — the 2
{ string: 5, fret: 1, technique: 'hammer-on' }, // B♭ — the blue ♭3, hammered from the open string
{ string: 5, fret: 2 }, // B — the major 3: the curl resolves
{ string: 4, fret: 0 }, // D — 5
{ string: 4, fret: 2 }, // E — 6
{ string: 3, fret: 0 }, // G — root: land it ON the downbeat with the chord
],
},
{
// In A, over the I7: hybrid-picked 3rds walking up the Mixolydian —
// 3+5 (C♯+E) → 4+6 (D+F♯) → 5+♭7 (E+G) — with clucked ghost notes
// between, resolving to the root on top. Shift the hand up with each pair.
id: 'country-chicken-thirds',
name: 'Chicken-pickin\' 3rds walk-up',
level: 'intermediate',
chordContext: 'over the I7 — fills between vocal lines',
techniques: ['ghost-note', 'double-stop', 'slide', 'vibrato'],
source: 'in the style of Brent Mason\'s double-stop chicken pickin\' — Brent Mason, Nashville Chops & Western Swing Guitar (Hal Leonard); Sam Smiley\'s Brent Mason lick analyses',
tab: [
{ string: 3, fret: 5, technique: 'ghost-note' }, // muted cluck — the chicken in the pickin'
{ string: 3, fret: 6 }, // C♯ — the 3
{ string: 2, fret: 5, technique: 'double-stop' }, // E — the 5: first 3rd-pair
{ string: 3, fret: 6, technique: 'ghost-note' }, // cluck between pairs
{ string: 3, fret: 7 }, // D — the 4
{ string: 2, fret: 7, technique: 'double-stop' }, // F♯ — the 6: passing pair
{ string: 2, fret: 8, technique: 'slide' }, // G — ♭7, top voice slides up the B string
{ string: 3, fret: 9, technique: 'double-stop' }, // E — the 5: the dominant 5+♭7 pair lands
{ string: 2, fret: 10, technique: 'vibrato' }, // A — root on top: resolve
],
},
{
// In A: the classic pedal-steel move — bend the 2 (B) a whole step up to
// the 3 (C♯) on the G string and HOLD it while the 5th and then the root
// ring on top: the full triad stacks up, steel-style (an oblique bend).
id: 'country-pedal-steel-bend',
name: 'Pedal-steel bend into the 3rd',
level: 'intermediate',
chordContext: 'over the I — the money chord change',
techniques: ['bend', 'double-stop', 'vibrato'],
source: 'the oblique 2→3 steel bend — Premier Guitar "Twang 101: 6 Essential Pedal-Steel Bends"; Fundamental Changes "Country Guitar String Bending"',
tab: [
{ string: 3, fret: 2 }, // A — root pickup
{ string: 3, fret: 4, technique: 'bend' }, // B — the 2, bent a whole step up to C♯ and HELD
{ string: 2, fret: 5, technique: 'double-stop' }, // E — the 5th rings on top of the held bend
{ string: 1, fret: 5, technique: 'vibrato' }, // A — root struck next, bend still holding: the triad stack
],
},
{
// In G, open position: the banjo forward roll (thumbindexmiddle)
// crosspicked across strings 3-2-1 — root, 3rd, high root cascading in
// even 8ths. No left-hand tricks: the ringing roll IS the technique.
id: 'country-forward-roll',
name: 'Forward-roll crosspicking',
level: 'foundation',
chordContext: 'over the I — keeps time like a banjo under a vocal',
techniques: [],
source: 'the Scruggs forward roll (TIM) adapted to guitar crosspicking — Wikipedia "Banjo roll"; Deering "The Four Essential 5-String Banjo Rolls"',
tab: [
{ string: 3, fret: 0 }, // G — root (thumb)
{ string: 2, fret: 0 }, // B — the 3 (index)
{ string: 1, fret: 3 }, // G — octave root (middle)
{ string: 3, fret: 0 }, // roll it again —
{ string: 2, fret: 0 }, // even 8ths,
{ string: 1, fret: 3 }, // every note ringing into the next
{ string: 3, fret: 0 }, // G
{ string: 2, fret: 0 }, // B — hand back at the top of the roll
],
},
],
}
+82
View File
@@ -185,4 +185,86 @@ export default {
},
],
},
// Structured licks (SCHEMA.md "Licks", task P-21). Written in the style's home
// positions (E for the dominant vamps, D dorian for the minor vamps) but
// key-agnostic in spirit — chordContext names the station.
// Every pitch hand-verified: s6=E s5=A s4=D s3=G s2=B s1=e (+fret, mod 12).
licks: [
{
// In E: root, ghost, ♭3 hammered to the 3, 5, ♭7, octave root — the
// dominant arpeggio with the blues grit built in, played staccato.
id: 'funk-nine-riff',
name: 'Single-note dominant riff',
level: 'foundation',
chordContext: 'over the I9 one-chord vamp',
techniques: ['ghost-note', 'hammer-on'],
source: 'in the style of the James Brown-band single-note riffs ("Sex Machine" lineage); Fundamental Changes funk guitar lessons',
tab: [
{ string: 6, fret: 0 }, // E — root, on the One
{ string: 6, fret: 0, technique: 'ghost-note' }, // scratch — the 16th grid never stops
{ string: 6, fret: 3 }, // G — ♭3 grit
{ string: 6, fret: 4, technique: 'hammer-on' }, // G♯ — the 3: the funk curl
{ string: 5, fret: 2 }, // B — 5
{ string: 5, fret: 5 }, // D — ♭7
{ string: 5, fret: 7 }, // E — octave root; shift up to grab it
],
},
{
// In E (♭VII = D): chromatic climb DD♯–E back to the One, answered by the
// 3+♭7 tritone stab straight out of the E9 grip (G♯+D).
id: 'funk-chromatic-snapback',
name: 'Chromatic snap-back to the One',
level: 'intermediate',
chordContext: '♭VII9 → I9, landing on the One',
techniques: ['chromatic-approach', 'double-stop'],
source: 'the E9→D9 vamp move ("Papa\'s Got a Brand New Bag" lineage); Fundamental Changes JB-style accent lessons',
tab: [
{ string: 5, fret: 5 }, // D — the ♭VII's root
{ string: 5, fret: 6, technique: 'chromatic-approach' }, // D♯ — passing
{ string: 5, fret: 7 }, // E — the One
{ string: 4, fret: 6 }, // G♯ — the 3, from the 9-grip
{ string: 3, fret: 7, technique: 'double-stop' }, // D — the ♭7: tritone stab together
],
},
{
// In D dorian: the ♭3+♭7 dyad (F+C) slid in from one fret below, answered
// by the root+11 dyad (D+G) — the m11 wash as two-note stabs — and a ghost.
id: 'funk-dorian-stabs',
name: 'Dorian double-stop stabs',
level: 'foundation',
chordContext: 'over the i7/i9 Dorian vamp',
techniques: ['double-stop', 'slide', 'ghost-note'],
source: 'in the style of the Meters\' dyad stabs ("Cissy Strut" lineage) and the Jimmy Nolen scratch vocabulary',
tab: [
{ string: 2, fret: 5 }, // E — one fret below F
{ string: 3, fret: 4, technique: 'double-stop' }, // B — one fret below C (approach dyad)
{ string: 3, fret: 5, technique: 'slide' }, // C — the ♭7
{ string: 2, fret: 6, technique: 'double-stop' }, // F — the ♭3: the m7 pair lands
{ string: 3, fret: 7 }, // D — root
{ string: 2, fret: 8, technique: 'double-stop' }, // G — the 11 on top: the m11 colour
{ string: 3, fret: 7, technique: 'ghost-note' }, // scratch — keep the grid breathing
],
},
{
// In D dorian: 1 ♭3 4 5 →6 5 ♭7 1 — a single-note vamp line that leans on
// the natural 6 (B over D), the note that makes Dorian sound like funk.
id: 'funk-dorian-six-line',
name: 'Dorian line leaning on the 6',
level: 'intermediate',
chordContext: 'over the i7IV7 Dorian vamp',
techniques: ['slide', 'vibrato'],
source: 'the Dorian vamp language of "Chameleon" (Herbie Hancock) — see Ethan Hein\'s Chameleon analysis; a line in that style, not a transcription',
tab: [
{ string: 5, fret: 5 }, // D — 1
{ string: 5, fret: 8 }, // F — ♭3
{ string: 4, fret: 5 }, // G — 4
{ string: 4, fret: 7 }, // A — 5
{ string: 4, fret: 9, technique: 'slide' }, // B — the natural 6, slid into
{ string: 4, fret: 7 }, // A — 5
{ string: 3, fret: 5 }, // C — ♭7
{ string: 3, fret: 7, technique: 'vibrato' }, // D — octave home
],
},
],
}
+56 -1
View File
@@ -32,9 +32,12 @@ const SUS4_6 = { rootStr: 6, offsets: [0, 0, 'x', 'x', 0, 'x'], fingers: [1, 2,
const MAJ_6 = { rootStr: 6, offsets: [0, 2, 2, 1, 'x', 'x'], fingers: [1, 3, 4, 2, 0, 0] } // R5R3 (E-shape)
const MAJ_5 = { rootStr: 5, offsets: ['x', 0, 2, 2, 2, 'x'], fingers: [0, 1, 2, 3, 4, 0] } // R5R3 (A-shape)
// --- the passing diminished 7th (#iv°7) ---
// --- the passing diminished 7th (#iv°7 / ♯i°7 — symmetric, one grip fits both) ---
const DIM7_5 = { rootStr: 5, offsets: ['x', 0, 1, -1, 1, 'x'], fingers: [0, 2, 3, 1, 4, 0] } // R–♭5–𝄫7–♭3 (symmetric)
// --- the borrowed iv (minor 6th on the middle strings, for the tonicized Amen) ---
const MIN6_4 = { rootStr: 4, offsets: ['x', 'x', 0, -2, 0, -2], fingers: [0, 0, 3, 1, 4, 2] } // R–♭36R
export default {
styleIntro:
'Gospel guitar lives between the organ and the choir: short, voice-led grips that comp the changes without crowding the keys. The signature sounds are guide-tone shells for the moving 251 chains, 9th and add9 colour on the resting chords, sus tension in the modern praise vamp, and a single passing diminished that makes a plain hymn sound like church. Keep the fifth and often the root to the bass — your job is the 3rds, 7ths, and the colour note.',
@@ -188,6 +191,58 @@ export default {
tips: 'The two min9 chords are the identical shape a fourth apart — one of the easiest gospel moves to internalize. The maj9 resolution sounds especially plush after a back-door dominant.',
},
],
'gospel-walkup-dim': [
{
label: 'Walk-up on the A string (shells)',
level: 'intermediate',
chords: [
{ shape: SHELL_5.maj7, note: 'Imaj7 — root on the A string' },
{ shape: DIM7_5, note: '♯i°7 — one fret up: the ladder rung' },
{ shape: SHELL_5.min7, note: 'ii7 — one more fret: the bass arrived by half steps' },
{ shape: SHELL_6.dom7, note: 'V7 — turn around and climb again' },
],
tips: 'The first three roots sit on one string, one fret apart — the walk-up is literally visible under your hand. Give the diminished its full beat but keep it quieter than the chords around it: it is a passing chord, a rung, not a destination. Over it, arpeggiate its four notes (all minor 3rds apart) — the fastest route from I\'s tones to ii\'s.',
},
{
label: '9th-coloured walk-up (mixed registers)',
level: 'intermediate',
chords: [
{ shape: MAJ9_6, extensions: ['9'], note: 'Imaj9 — low root, the 9 shining on top' },
{ shape: DIM7_5, note: '♯i°7 — the diminished stays plain; its tension IS the colour' },
{ shape: MIN9_5, extensions: ['9'], note: 'ii9' },
{ shape: DOM9_5, extensions: ['9'], note: 'V9' },
],
tips: 'Same climb with the gospel shimmer on the resting chords. Remember what the ♯i°7 really is — a rootless VI7♭9 aimed at ii — but not every note climbs: only the root rises a half step into ii\'s root, while the hidden dominant\'s ♭7 and ♭9 sigh downward into the ii9. Don\'t decorate the diminished; decorate its resolution.',
},
],
'gospel-tonicized-amen': [
{
label: 'Shell tag — one finger tells the story',
level: 'intermediate',
chords: [
{ shape: SHELL_6.maj7, note: 'Imaj7 — R73' },
{ shape: SHELL_6.dom7, note: 'I7 — same grip, one finger drops a fret: the 7 falls to ♭7' },
{ shape: SHELL_5.maj7, note: 'IVmaj7 — same fret, root string up (the I7 pointed here)' },
{ shape: MIN6_4, note: 'iv6 — the borrowed minor on the middle strings' },
{ shape: SHELL_6.maj7, note: 'Imaj7 — home' },
],
tips: 'Watch the two half-step falls: the I\'s major 7 drops to ♭7 (turning I into V7/IV), then the IV\'s 3rd drops to ♭3 (the borrowed iv). Everything else holds. When soloing, target exactly those two falling voices — the ♭7 of I7 resolves into the 3rd of IV, and the iv\'s ♭3 sighs down to the 9/1 of home.',
},
{
label: '9th-coloured tag (upper register)',
level: 'intermediate',
chords: [
{ shape: MAJ9_6, extensions: ['9'], note: 'Imaj9' },
{ shape: DOM9_6, extensions: ['9'], note: 'I9 — the same one-finger drop, with the 9 held on top' },
{ shape: MAJ9_6, extensions: ['9'], note: 'IVmaj9 — identical grip five frets up' },
{ shape: MIN6_4, note: 'iv6 — drop to the plain borrowed minor; no 9 here' },
{ shape: MAJ9_6, extensions: ['9'], note: 'Imaj9 — resolve with colour' },
],
tips: 'The maj9 → dom9 move is the same story as the shells — only the D-string finger moves, 7 falling to ♭7 — but the held 9 makes the tag glow. Leave the iv6 uncoloured: after four 9th chords, the bare borrowed minor is the emotional dip that sets up the resolution.',
},
],
},
improv: {
+388
View File
@@ -0,0 +1,388 @@
// Gospel piano pack (task P-23). Recipes verified by degree-spelling against
// CHORD_TYPES (src/lib/theory.js) and the validator's stacking convention
// (order inside each hand = voicing order low → high, documented at
// jazz/piano.js header). Voicings and treatments sourced from:
// hearandplay.com — "Gospel Pianists: Don't Leave Home Without These Essential
// Chords" (root5 / octave left hands, full RH stacks), "Little known ways to
// use diminished walk-ups and walk-downs" (♯i°7/♯iv°7 as passing chords),
// "Gospel Piano Scales — 6 Different Scales That Can Work Now" (the
// pentatonic-♭3 "gospel scale"), and GospelKeys 202 (replacing plain triads
// with full-sounding 9th/6-9 voicings in worship playing);
// pianogroove.com — "Gospel Passing Chords & Substitutions", "Blues & Gospel
// Walk-Ups", "Gospel Hymn Styles" and "Gospel Time Signatures" (12/8 and 6/8
// hymn feels), "The Gospel Walk Down";
// piano.org — "Rootless Voicings: Type A and Type B (Bill Evans Style)" (the
// rootless grips contemporary gospel borrows once a bassist is present);
// pianowithjonny.com — "Play Gospel Piano: The 6-Step Beginner Guide"
// (root5 foundations, add9/6th colour); learncolorpiano.com — "Gospel
// Progression 1 | Diminished 7th Chords" (rolling the passing °7).
// Voice-leading statements in notes/tips are pitch-class arithmetic, checked
// against the realized voicings (key of C) before writing.
// Reusable degree recipes. Order inside each hand = voicing order, low → high.
const LH_R5 = ['1', '5'] // open fifth — the hymn "pillar" left hand
const LH_OCT = ['1', '1'] // root octave — gospel's bass-player left hand
const RH_7TH = ['3', '5', '7'] // root-position seventh-chord upper structure
const RH_9TH = ['3', '5', '7', '9'] // the full-sounding 9th stack (GospelKeys-style)
const RH_ADD9 = ['3', '5', '9'] // triad with the 9 on top (no 7th)
const RH_69 = ['3', '5', '6', '9'] // the 6/9 landing hand — gospel's final chord
export default {
styleIntro:
'In church the piano often IS the rhythm section: the left hand supplies the bass (roots, fifths, octaves), the right hand supplies the choir (full triads and 7ths with 9ths and 6ths stacked in), and the space between chords is filled with walk-ups and passing diminisheds. Everything is voiced full and vocal — every chord supports a singer, and every voice is always headed somewhere: to the 4, to the Amen, back home.',
comping: [
{
label: '12/8 hymn pulse',
rhythm: 'four beats to the bar, each felt in three (12/8)',
description:
'The slow-gospel foundation: block both hands on the four main beats and let the triplet subdivision breathe underneath. Roll the bigger chords bottom-to-top into beats 1 and 3 — on a hymn the roll is the ornament, not the notes.',
},
{
label: 'Walk-up into the downbeat',
rhythm: 'beats 34 walk, land on 1',
description:
'Gospel\'s transitional engine: on the last beats of the bar the left hand climbs stepwise or chromatically (often through a passing diminished) so the next chord\'s downbeat lands like an arrival. The chord change is announced before it happens.',
},
{
label: 'Shout-drive stabs',
rhythm: 'relentless on-beat quarters, both hands',
description:
'The praise-break gear: octave roots in the left hand, full stacks in the right, hammered on every beat of a fast swung 4/4. Where jazz comping avoids downbeats, shout playing owns them — the piano is driving the room, not commenting on it.',
},
],
plays: {
'gospel-cycle-251': [
{
label: 'Church pillars (root5 under stacked 9ths)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'plain minor 7 — save the colour for the chords that move' },
{ recipe: { LH: LH_R5, RH: ['3', '7', 'b9'] }, note: 'VI7♭9 — from the iii7 one RH note name holds (its ♭3 is this ♭7) and the other two each fall a half-step (5→♭9, ♭7→3)' },
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: 'the VI7\'s ♭9 just fell a half-step onto this 5th' },
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: 'two note names hold from the ii (♭3→♭7, 5→9); the ii\'s ♭7 fell a half-step onto this 3rd' },
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: 'maj9 home — the V7\'s ♭7 fell a half-step onto this 3rd' },
],
register: 'LH open fifths around C3, RH stacks just above middle C',
tips: 'Root and fifth below, four-note stack above — the full-choir sound that lets a piano carry a congregation alone. The cycle teaches one law: at every change the old ♭7 falls onto the new 3rd — a half-step when the landing chord is major or dominant (iii7→VI7, ii7→V7, V7→I), a whole step when it lands on the minor ii (VI7→ii7). Hear that thread and the whole chain plays itself.',
},
{
label: 'Rootless cascade (band setting)',
level: 'intermediate',
chords: [
{ recipe: { LH: ['3', '5', '7'] }, note: '♭35–♭7, no root — the bass player has it' },
{ recipe: { LH: ['7', 'b9', '3'] }, note: 'from the iii7: one note name holds, two fall a half-step' },
{ recipe: { LH: ['3', '5', '7', '9'] }, note: 'out of the VI7 everything sinks: two half-steps and a whole step' },
{ recipe: { LH: ['7', '9', '3', '13'] }, note: 'three note names hold from the ii (♭3→♭7, 5→9, 9→13) — only the ♭7 moves, a half-step onto this 3rd' },
{ recipe: { LH: ['3', '5', '7', '9'] }, note: 'maj9 landing — the V\'s 3rd holds over as this maj7' },
],
register: 'left hand alone, top note between C4 and C5 — right hand answers the choir',
tips: 'Contemporary gospel borrows the jazz rootless grips the moment a bassist is on the platform: doubling their root just muddies the mix. Watch the ii7→V7 seam and count what your hand does — three fingers stay on the same note names (♭3→♭7, 5→9, 9→13) and one falls a half-step. That near-stillness over a moving bass is the sound of a tight church band.',
},
],
'gospel-amen-625': [
{
label: 'Hymn pillars into the Amen',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'the turnaround starts its fall home' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'the vi\'s ♭7 fell a whole step onto this ♭3' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'the ii\'s ♭7 fell a half-step onto this 3rd' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'home — the V\'s ♭7 fell a half-step onto this 3rd' },
{ recipe: { LH: LH_R5, RH: ['3', '5', '1'] }, note: 'inverted triad, root on top — set up the Amen fall' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'Amen: all three RH voices sink — root-on-top a half-step onto the 3rd, 5th a half-step onto the maj7, 3rd a whole step onto the 5th' },
],
register: 'LH fifths around C3, RH close position around middle C; 12/8 pulse',
tips: 'The 6251 is the same falling-fifths law as any turnaround: each ♭7 falls by step onto the next chord\'s 3rd. The Amen is the payoff — voice the IV with its root on top and every right-hand voice sinks into the I (two half-steps, one whole step). That downward sigh is why plagal cadences close hymns.',
},
{
label: 'Octave bass, 6/9 colour (contemporary)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_OCT, RH: RH_ADD9 }, note: 'm9 spread — the 9 on top sings' },
{ recipe: { LH: LH_OCT, RH: RH_ADD9 }, note: 'same shape, next station of the fall' },
{ recipe: { LH: LH_OCT, RH: ['3', '7', '9'] }, note: 'V9 — its 9 will hold into the I as the 6th' },
{ recipe: { LH: LH_OCT, RH: RH_69 }, note: '6/9 instead of maj7 — the V9\'s ♭7 fell a half-step onto this 3rd, its 9 held as this 6' },
{ recipe: { LH: LH_OCT, RH: ['3', '6', '9'] }, note: 'IV as a 6/9 — every note of this hand is already a note of the I6/9' },
{ recipe: { LH: LH_OCT, RH: RH_69 }, note: 'the final chord of half the gospel repertoire: 6/9, root octave below' },
],
register: 'LH octaves around C2C3, RH between C4 and C5 — big and open',
tips: 'Swapping the maj7 for the 6/9 is the single most gospel substitution there is — the 6th and 9th colour the tonic without the maj7\'s leading-tone rub against a melody on the root. The Amen becomes pure bass motion: every note of the IV6/9 right hand is already a tone of the I6/9 (its 3, 6 and 9 are the I\'s 6, 9 and 5), so those three note names hold, the I\'s 3rd joins beneath them, and the octave bass makes the change alone.',
},
],
'gospel-iv-passing-dim': [
{
label: 'The 4–♯45 walk (dim7 into I over its 5th)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_ADD9 }, note: 'add9 home, open and ringing' },
{ recipe: { LH: ['1'], RH: ['3', '5', '1'] }, note: 'single bass note — the walk starts; root on top of the RH' },
{ recipe: { LH: ['1'], RH: RH_7TH }, note: 'two RH notes freeze (the IV\'s 3rd and 5th are this °7\'s ♭3 and ♭5); the top slips a whole step; the bass does the talking' },
{ recipe: { LH: ['5', '1'], RH: RH_ADD9 }, note: 'I over its 5th — the bass lands 4→♯4→5 while the °7\'s 𝄫7 rises a half-step onto this 3rd' },
],
register: 'bass line front and centre (C2C3); RH compact around middle C',
tips: 'The whole point is the bass: 4, ♯4, 5 — two half-steps that turn a plain IVI into church. Above it almost nothing moves: the ♯iv°7 keeps two of the IV\'s notes, and it already contains the key\'s home note (its ♭5), so the resolution is prepared before you play it. Landing on I-over-its-5th instead of root position is what makes the walk feel continuous — save root position for the phrase\'s final chord.',
},
{
label: 'Praise clusters with a rolled diminished',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_OCT, RH: ['9', '3', '5'] }, note: 'add9 cluster — 9 tucked under the 3rd, modern worship colour' },
{ recipe: { LH: LH_OCT, RH: ['9', '3', '5'] }, note: 'same grip, root a fourth up — the cluster shape carries the whole vamp' },
{ recipe: { LH: LH_OCT, RH: RH_7TH }, note: 'roll it bottom-to-top like a grace note — two of the IV\'s three cluster notes carry straight in' },
{ recipe: { LH: LH_OCT, RH: ['5', '1', '9'] }, note: 'open 519 — release after the crunch' },
],
register: 'LH octaves; RH clusters between C4 and D5; straight-16th contemporary feel',
tips: 'The 9-under-the-3rd cluster is the modern praise sound — tight, bright, no 7th. Treat the ♯iv°7 as a gesture, not a destination: roll it into the beat and let it release into the open 519 hand. One crunchy chord between two clean ones is exactly the dosage; two would be a jazz solo.',
},
],
'gospel-sus-vamp': [
{
label: 'Worship pads (one shape, four chords)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_ADD9 }, note: 'm9 pad' },
{ recipe: { LH: LH_R5, RH: RH_ADD9 }, note: 'add9 — same grip, the roots do the work' },
{ recipe: { LH: LH_R5, RH: RH_ADD9 }, note: 'the "3rd" slot is the suspended 4th — which is the key\'s home note' },
{ recipe: { LH: LH_R5, RH: RH_ADD9 }, note: 'home, still hovering on the 9' },
],
register: 'sustained, pedal down; LH fifths low, RH between C4 and C5',
tips: 'One right-hand recipe — 3(4)59 — planted on four different roots: this is how worship keyboardists play a whole set. The vamp hovers because the tonic note never leaves: it is the vi\'s ♭3, the IV\'s 5th and the Vsus\'s suspended 4th before it finally lands in the bass on the I. The Vsus\'s 9 is the vi\'s root — the loop\'s seam is sewn shut.',
},
{
label: 'Anticipated stabs (octaves + clusters)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_OCT, RH: ['3', '5', '1'] }, note: 'first-inversion shape, root on top' },
{ recipe: { LH: LH_OCT, RH: ['9', '3', '5'] }, note: '9-cluster — tight against the pad version\'s spread' },
{ recipe: { LH: LH_OCT, RH: ['3', '1', '9'] }, note: 'sus stack: 4th, root, 9 — no 3rd to resolve' },
{ recipe: { LH: LH_OCT, RH: ['5', '1', '9'] }, note: 'two of the three stab notes (the key\'s 1 and 5) carry over from the Vsus' },
],
register: 'both hands mid-keyboard, short and percussive; hit the and-of-4 and tie',
tips: 'Same four chords, opposite job: instead of pads, strike each chord an eighth early (the and-of-4) and let the tie pull the band forward. Keep the right hand to three notes — stabs live or die on rhythm, and the Vsus→I seam proves how little needs to move: two of your three notes stay on the same note names while the octave bass resolves.',
},
],
'gospel-backdoor': [
{
label: 'Pillars: the back door swings on its 9',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'soft diatonic start' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'two note names carry over: the iii\'s root becomes this chord\'s 5th, its ♭3 becomes this ♭7' },
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: '♭VII9 — the 9 of this chord is the key\'s home note; keep it on top of your ear' },
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: 'maj9 — the back door\'s ♭7 sank a half-step onto this 5th, its 5th a half-step onto this 3rd' },
],
register: 'LH fifths around C3, RH around middle C; unhurried',
tips: 'The back door earns its name in the voice leading: where V7 resolves with leading-tone pull, the ♭VII7 slides home on two half-step sighs — its ♭7 onto the I\'s 5th and its 5th onto the I\'s 3rd — while its 9 (the key\'s home note) rings through the whole change. Play the ♭VII9 slightly softer than the chords around it; the surprise chord should whisper.',
},
{
label: 'Rootless slide (band setting)',
level: 'intermediate',
chords: [
{ recipe: { LH: ['3', '5', '7'] }, note: 'three-note rootless — light' },
{ recipe: { LH: ['3', '5', '7'] }, note: 'the iii\'s ♭7 fell a whole step onto this ♭3' },
{ recipe: { LH: ['3', '13', '7', '9'] }, note: 'the vi\'s ♭3 and ♭7 are already this chord\'s 9 and 13 — two note names don\'t move' },
{ recipe: { LH: ['3', '5', '7', '9'] }, note: 'maj9 — the ♭VII\'s 13 was already this chord\'s 5th' },
],
register: 'left hand alone, top note between C4 and C5',
tips: 'The 13 is the trick: adding it to the ♭VII7 plants the I\'s 5th in your hand a bar early, and its 9 is the key\'s home note — so the "borrowed" chord is half at home before it resolves. Then the ♭7 sinks a half-step and the 3rd climbs a whole step onto the I\'s 3rd. Rootless because the bassist owns that ♭7̂ bass note — let them have the drama.',
},
],
'gospel-walkup-dim': [
{
label: 'Walk-up: the bass climbs, the hands barely move',
level: 'intermediate',
chords: [
{ recipe: { LH: ['1'], RH: ['3', '5', '1'] }, note: 'root on top — it will fall a whole step while the rest of the hand freezes' },
{ recipe: { LH: ['1'], RH: RH_7TH }, note: 'the I\'s 3rd and 5th ARE this °7\'s ♭3 and ♭5 — two RH notes don\'t move; the bass climbs a half-step' },
{ recipe: { LH: ['1'], RH: RH_7TH }, note: 'every RH note climbs a half- or whole-step; the bass takes its second half-step' },
{ recipe: { LH: ['1'], RH: RH_7TH }, note: 'the ii\'s ♭3 holds as this ♭7 (same note name); its ♭7 fell a half-step onto this 3rd' },
],
register: 'single bass notes C2C3 — the walking line is the melody; RH compact',
tips: 'A walk-up is a bass line wearing chords: 1, ♯1, 2 in the left hand while the right hand moves as little as arithmetic allows — two notes literally frozen through the first change. It works because ♯i°7 is a rootless VI7♭9 (its four notes are exactly the top four of the VI7♭9), so the ear hears a secondary dominant pointing at the ii. Practise hands separately: bass alone should already sound like gospel.',
},
{
label: 'Full-church walk-up (root5 + 9ths)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: 'maj9 — big two-hand home' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'thin to three: two RH notes freeze, the maj7 slips a half-step onto the 𝄫7, the 9 steps aside' },
{ recipe: { LH: LH_R5, RH: RH_9TH }, note: 'the whole right hand climbs by step out of the diminished — half-step, whole step, whole step — and the 9 returns on top' },
{ recipe: { LH: LH_R5, RH: ['3', '13', '7', '9'] }, note: 'V13 — three note names hold from the ii (♭3→♭7, 5→9, 9→13); only its ♭7 falls, a half-step onto this 3rd' },
],
register: 'LH fifths around C3, RH between C4 and C5; land the changes on downbeats',
tips: 'The same walk-up dressed for Sunday: open fifths under four-note stacks. Notice the diminished bar is the THIN one — dropping to three notes while the bass climbs makes the ♯i°7 feel like motion instead of mud, then the 9 coming back on the ii is the choir breathing in. The V13 grip (313–♭79) is the classic gospel dominant: learn it as one hand-shape and the ii7→V7 change costs you one finger.',
},
],
'gospel-tonicized-amen': [
{
label: 'The two sighs, voiced plain',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'home, unhurried' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'identical grip — one note changes: the 7 falls a half-step to the ♭7, and home becomes V7 of the IV' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'the ♭7 fell a half-step onto this 3rd; the I\'s 3rd holds as this maj7 (same note name)' },
{ recipe: { LH: LH_R5, RH: ['3', '5', '6'] }, note: 'iv6: the 3rd sank a half-step to ♭3, the maj7 a whole step to the 6th, the 5th held' },
{ recipe: { LH: LH_R5, RH: RH_7TH }, note: 'the iv\'s ♭3 sighs a half-step onto this 5th; its 6th rises a whole step onto this 3rd' },
],
register: 'LH fifths around C3, RH around middle C; 12/8, rolled arrivals',
tips: 'Five chords, two borrowed notes, and each borrowed note resolves down a half-step — the ♭7 (into the IV\'s 3rd) and the borrowed ♭3 (into the I\'s 5th). Keep every other voice as still as the arithmetic allows and the tag plays like a pair of sighs, which is exactly how a congregation sings it. This is the hymn-ending to have under your fingers in all twelve keys.',
},
{
label: 'Drive to the 4, land on the 6/9',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_OCT, RH: RH_ADD9 }, note: 'add9 home over octaves' },
{ recipe: { LH: LH_OCT, RH: ['3', '7', '9'] }, note: 'the drive: swap the 5 for the ♭7 — one finger hops up a minor third, the rest freeze' },
{ recipe: { LH: LH_OCT, RH: RH_ADD9 }, note: 'arrival: the ♭7 sighed a half-step onto this 3rd, the 9 fell a whole step onto this 5th' },
{ recipe: { LH: LH_OCT, RH: ['3', '6', '9'] }, note: 'iv6/9: flatten the 3rd, swap the 5 for the 6 — the 9 on top never moves' },
{ recipe: { LH: LH_OCT, RH: RH_69 }, note: 'the iv\'s 6 and 9 are already this chord\'s 9 and 5 — those note names hold; the borrowed ♭3 resolves down a half-step (♭6̂ to 5̂ of the key)' },
],
register: 'LH octaves low, RH between C4 and C5; push the I7 on the and-of-4',
tips: 'The I7 is a gesture, not a chord to sit on: strike it late in the bar (and-of-4, tied) so it shoves the music into the IV — that anticipation is the "drive to the 4" every gospel pianist leans on. Coming home, count what actually moves: two of the iv6/9\'s three notes are already tones of the I6/9, only the borrowed ♭3 resolves (down a half-step), and the I\'s 3rd slips in at the bottom of the hand. Endings this quiet are earned by voicings this shared.',
},
],
},
improv: {
scales: [
{
over: 'I / Imaj7 / Iadd9',
scale: 'major pentatonic + ♭3 (the gospel scale)',
why: '12–♭3356: major pentatonic with a ♭3 crush note (hearandplay teaches it as the pentatonic-♭3 scale). The ♭3→3 slip into a chord tone is the single most gospel ornament on the piano.',
},
{
over: 'ii7',
scale: 'dorian',
why: 'The parent major scale started from 2 — no new notes to learn, and the natural 6 keeps the ii warm instead of mournful.',
},
{
over: 'vi7 / iii7',
scale: 'the key\'s own notes (aeolian / phrygian)',
why: 'These minor chords are diatonic, so the major scale you are already in covers them — from the vi it sounds aeolian, from the iii phrygian. Aim at each chord\'s ♭3 and ♭7 rather than reaching for a new scale.',
},
{
over: 'dom7 (V7, VI7, ♭VII7)',
scale: 'mixolydian',
why: 'Mixolydian from each dominant\'s own root hands you its ♭7. Over the backdoor ♭VII7 it also supplies the key\'s borrowed flat notes — that dusky colour is the point of the chord.',
},
{
over: '♯i°7 / ♯iv°7',
scale: 'the four chord tones (°7 arpeggio)',
why: 'Passing chords last a breath — arpeggiate the °7 itself (it is symmetric, stacked minor 3rds) and resolve by step: most of its tones sit a half-step or whole step from a tone of the next chord.',
},
{
over: 'iv6',
scale: 'dorian from the iv',
why: 'Dorian\'s natural 6 IS the chord\'s 6th, so the scale bakes the borrowed-iv colour in; land on the ♭3 and let it sigh down a half-step when the I arrives.',
},
],
targetNotes:
'Land 3rds on the strong beats, then double your line in 3rds or 6ths — the harmonized run is gospel\'s signature ornament, and on piano it is one hand-shape moved up the scale. Save the ♭3→3 crush for arrivals on the I, and when a walk-up is coming, aim your right-hand line at the same downbeat the bass is walking toward.',
},
// Structured piano licks (SCHEMA.md "Piano licks", task P-61). Degree-based
// and key-agnostic: every deg resolves through the stated quality, approach
// pitches are derived from the next deg note. Realized offsets in the
// comments use a C-rooted chord for readability; every interval claim in
// notes/tips was recomputed from those offsets before writing (P-41 bar).
licks: [
{
// Over Cadd9: C4 D4 (E♭4)E4 G4 A4 C5 — offsets 0 2 [3]4 7 9 12: the
// hearandplay "gospel scale" (major pentatonic + ♭3) climbed straight
// up one octave, the ♭3 crushing a half-step into the 3rd.
id: 'gospel-scale-run',
name: 'Gospel-scale run (the ♭3→3 crush)',
level: 'foundation',
chordContext: 'over the Iadd9 — any major-tonic bar',
quality: 'add9',
techniques: ['grace-note'],
source: 'the pentatonic-♭3 "gospel scale" — hearandplay.com, "Gospel Piano Scales — 6 Different Scales That Can Work Now"',
notes: [
{ deg: '1', beat: 1 },
{ deg: '9', beat: 1.5 },
{ deg: 'b3', beat: 2, technique: 'grace-note' },
{ deg: '3', beat: 2 },
{ deg: '5', beat: 2.5 },
{ deg: '6', beat: 3 },
{ deg: '1', octave: 1, beat: 3.5 },
],
tips: 'Major pentatonic with one borrowed note: 12–♭33561, the ♭3 crushed into the 3rd almost as one gesture — gospel\'s answer to the string bend, same move the blues makes but headed somewhere brighter. Run it up one octave and stop; the restraint is what keeps it church and not cocktail.',
},
{
// Over C7 (the V7 of an F shout vamp): G4 A4 C5 D5 E5 — offsets
// 7 9 12 14 16: 56193 major pentatonic, straight-8th pickup on
// beats 34.5 landing the 3rd on beat 5 (the next downbeat).
id: 'gospel-shout-runup',
name: 'Shout run-up (pentatonic pickup)',
level: 'foundation',
chordContext: 'over the V7 — the run-up into a shout/praise-break downbeat',
quality: 'dom7',
techniques: [],
source: 'praise-break run-up vocabulary — the drive gear hearandplay teaches in GospelKeys 300 (praise songs & shouting music)',
notes: [
{ deg: '5', beat: 3 },
{ deg: '6', beat: 3.5 },
{ deg: '1', octave: 1, beat: 4 },
{ deg: '9', octave: 1, beat: 4.5 },
{ deg: '3', octave: 1, beat: 5 },
],
tips: 'A five-note ladder — 5, 6, root, 9, 3, all major pentatonic off the chord\'s root — thrown at the next bar\'s downbeat like a drummer\'s fill. The landing note is the 3rd, arriving exactly ON beat 1 with the band\'s next hit: in shout music the run exists to make the downbeat feel inevitable. Play it in octaves when the room gets loud.',
},
{
// Over Cmaj7, dyads struck together: C4+A4 → D4+B4 → E4+C5 → G4+E5 —
// offsets (0,9)(2,11)(4,12)(7,16). Every pair is a sixth (9,9,8,9
// semitones); bottom voice walks 123 then leaps a minor 3rd to 5,
// top sings 671 then leaps a major 3rd to the high 3. All eight
// notes diatonic to the root's major scale.
id: 'gospel-sixths-walkup',
name: 'Sixths walk-up (the harmonized choir line)',
level: 'intermediate',
chordContext: 'over the Imaj7, walking into the next downbeat',
quality: 'maj7',
techniques: ['double-stop'],
source: 'harmonizing the scale in 3rds and 6ths — hearandplay.com, "Harmonization Of The Major Scale Using Third And Sixth Intervals"',
notes: [
{ deg: '1', beat: 2 },
{ deg: '6', beat: 2, technique: 'double-stop' },
{ deg: '9', beat: 3 },
{ deg: '7', beat: 3, technique: 'double-stop' },
{ deg: '3', beat: 4 },
{ deg: '1', octave: 1, beat: 4, technique: 'double-stop' },
{ deg: '5', beat: 5 },
{ deg: '3', octave: 1, beat: 5, technique: 'double-stop' },
],
tips: 'One singer with a shadow: the bottom voice walks 123 up the scale while the top sings 678 a sixth above, then both voices leap a third onto 5-under-3 for the arrival. Quarter notes, landing on the next bar\'s downbeat — it is the choir\'s soprano-alto pair under your right hand, and the 3rd on top of the last dyad is the note the pack keeps telling you to land on.',
},
{
// Over a °7 (C root): C4 E♭4 G♭4 A4 C5 E♭5 G♭5 A5 — offsets
// 0 3 6 9 12 15 18 21: pure stacked minor 3rds, two full octaves of
// the symmetric chord, rolled in 16ths across beats 12.75.
id: 'gospel-dim-roll',
name: 'Diminished roll (two octaves of the passing chord)',
level: 'intermediate',
chordContext: 'over the passing diminished bar — the ♯iv°7 or ♯i°7',
quality: 'dim7',
techniques: [],
source: 'rolling the passing °7 — learncolorpiano.com "Gospel Progression 1 | Diminished 7th Chords"; hearandplay.com diminished walk-ups/walk-downs lesson',
notes: [
{ deg: '1', beat: 1 },
{ deg: 'b3', beat: 1.25 },
{ deg: 'b5', beat: 1.5 },
{ deg: '6', beat: 1.75 },
{ deg: '1', octave: 1, beat: 2 },
{ deg: 'b3', octave: 1, beat: 2.25 },
{ deg: 'b5', octave: 1, beat: 2.5 },
{ deg: '6', octave: 1, beat: 2.75 },
],
tips: 'The °7 is symmetric — minor thirds all the way up, the same four note names in every octave — so one four-note fingering (1-2-3-4, cross, repeat) sweeps two octaves without thinking. Roll it like a harp flourish inside the passing bar and let the last note hang: every tone of the chord sits a half-step or whole step from a tone of the chord you are walking into, so wherever you stop, the resolution is already prepared.',
},
],
}
+36
View File
@@ -5,6 +5,13 @@
// Wikipedia: Plagal cadence, Backdoor progression.
// Song references are kept honest: where a single definitive recording isn't
// certain, the move is described by its standard use in the tradition.
//
// Level tags + the two intermediate progressions added by task P-20.
// Walk-up/tag theory verified against: hearandplay.com ("Little known ways to
// use diminished walk-ups and walk-downs", "An In-Depth Breakdown Of The
// Classic 1-4 Walk-Up"), pianogroove.com (Gospel Walk-Ups; Gospel Passing
// Chords & Substitutions), docs/progression-repertoire.md §1 (I–♯i°–ii,
// II7IV, IVivI rows).
export default [
{
id: 'gospel-cycle-251',
@@ -16,6 +23,7 @@ export default [
mode: 'major',
songs: ['traditional gospel turnaround', 'His Eye Is on the Sparrow (reharmonized)'],
tip: 'Every root falls a fifth and the off-diatonic VI7 pushes hard to ii — chain two iiV cells back to back and the ear is dragged home. Voice-lead the 3rds and 7ths and your hand barely moves.',
level: 'intermediate',
},
{
id: 'gospel-amen-625',
@@ -27,6 +35,7 @@ export default [
mode: 'major',
songs: ['traditional hymn endings', "I'll Fly Away (turnaround/tag)"],
tip: 'The 6251 is the gospel turnaround — the extended cousin of the 251 that returns you from chorus to verse. Tag it with the plagal IVI "Amen" for the classic church ending.',
level: 'foundation',
},
{
id: 'gospel-iv-passing-dim',
@@ -38,6 +47,7 @@ export default [
mode: 'major',
songs: ['gospel hymn reharmonization', 'Amazing Grace (passing-chord arrangement)'],
tip: 'The #iv°7 is a chromatic passing chord linking IV back to I (bass walks 4 → #4 → 5/1). It is almost a signature of the gospel sound — one borrowed diminished and a plain hymn turns into church.',
level: 'intermediate',
},
{
id: 'gospel-sus-vamp',
@@ -49,6 +59,7 @@ export default [
mode: 'major',
songs: ['Every Praise — Hezekiah Walker (vamp feel)', 'contemporary gospel/CCM praise loop'],
tip: 'Contemporary gospel leans on open sus and add9 colour instead of plain triads — the suspended 4th over V never fully resolves, keeping the vamp hovering and "lifting". Loop it; the tension is the point.',
level: 'foundation',
},
{
id: 'gospel-backdoor',
@@ -60,5 +71,30 @@ export default [
mode: 'major',
songs: ['gospel/soul turnaround', 'standard back-door cadence (e.g. Tenderly, bars 57)'],
tip: 'iii→vi is a soft diatonic drop; the ♭VII7 is the "back door" — a borrowed dominant a whole step below I that resolves up by step instead of down a fifth. A warmer, less expected way home than V7.',
level: 'intermediate',
},
{
id: 'gospel-walkup-dim',
name: 'Chromatic walk-up (I–♯i°7ii7V7)',
rn: ['Imaj7', '♯i°7', 'ii7', 'V7'],
degrees: [0, 1, 2, 7],
qualities: ['maj7', 'dim7', 'min7', 'dom7'],
bars: [1, 1, 1, 1],
mode: 'major',
songs: ['traditional gospel walk-up (bass climbs 1–♯12)', 'the standard hymn-to-church reharmonization move'],
tip: 'The ♯i°7 turns the step from I to ii into two half-steps — the bass climbs while the upper voices barely move. It works because ♯i°7 is a rootless VI7♭9, the secondary dominant of ii in disguise; then the V7 launches the loop again.',
level: 'intermediate',
},
{
id: 'gospel-tonicized-amen',
name: 'Tonicized Amen (II7IVivI)',
rn: ['Imaj7', 'I7', 'IVmaj7', 'iv6', 'Imaj7'],
degrees: [0, 0, 5, 5, 0],
qualities: ['maj7', 'dom7', 'maj7', 'min6', 'maj7'],
bars: [1, 1, 1, 1, 2],
mode: 'major',
songs: ['Amazing Grace ("how sweet the sound" — the I7 pointing at IV)', 'traditional hymn tag (Amen with the borrowed iv)'],
tip: 'Two borrowed notes tell the whole story: the ♭7 that turns I into the dominant of IV (a secondary dominant, V7/IV), and the ♭3 that turns IV minor on the way home. Both fall by half step — the gospel tag is a pair of sighs.',
level: 'intermediate',
},
]
+11 -5
View File
@@ -3,9 +3,12 @@
import jazzMeta from './jazz/meta.js'
import jazzProgressions from './jazz/progressions.js'
import jazzGuitar from './jazz/guitar.js'
import jazzPiano from './jazz/piano.js'
import bluesMeta from './blues/meta.js'
import bluesProgressions from './blues/progressions.js'
import bluesGuitar from './blues/guitar.js'
import bluesPiano from './blues/piano.js'
import bluesBass from './blues/bass.js'
import rockMeta from './rock/meta.js'
import rockProgressions from './rock/progressions.js'
import rockGuitar from './rock/guitar.js'
@@ -24,23 +27,26 @@ import countryGuitar from './country/guitar.js'
import rnbMeta from './rnb/meta.js'
import rnbProgressions from './rnb/progressions.js'
import rnbGuitar from './rnb/guitar.js'
import rnbPiano from './rnb/piano.js'
import gospelMeta from './gospel/meta.js'
import gospelProgressions from './gospel/progressions.js'
import gospelGuitar from './gospel/guitar.js'
import gospelPiano from './gospel/piano.js'
import popMeta from './pop/meta.js'
import popProgressions from './pop/progressions.js'
import popGuitar from './pop/guitar.js'
import popPiano from './pop/piano.js'
export default {
jazz: {
meta: jazzMeta,
progressions: jazzProgressions,
instruments: { guitar: jazzGuitar },
instruments: { guitar: jazzGuitar, piano: jazzPiano },
},
blues: {
meta: bluesMeta,
progressions: bluesProgressions,
instruments: { guitar: bluesGuitar },
instruments: { guitar: bluesGuitar, piano: bluesPiano, bass: bluesBass },
},
rock: {
meta: rockMeta,
@@ -70,16 +76,16 @@ export default {
rnb: {
meta: rnbMeta,
progressions: rnbProgressions,
instruments: { guitar: rnbGuitar },
instruments: { guitar: rnbGuitar, piano: rnbPiano },
},
gospel: {
meta: gospelMeta,
progressions: gospelProgressions,
instruments: { guitar: gospelGuitar },
instruments: { guitar: gospelGuitar, piano: gospelPiano },
},
pop: {
meta: popMeta,
progressions: popProgressions,
instruments: { guitar: popGuitar },
instruments: { guitar: popGuitar, piano: popPiano },
},
}
+134
View File
@@ -146,6 +146,54 @@ export default {
},
],
'jazz-tritone-sub': [
{
label: 'Shells down one string (chromatic slide)',
level: 'intermediate',
chords: [
{ shape: SHELL_5.min7, note: 'ii7 — root on the A string' },
{ shape: SHELL_5.dom7, note: '♭II7 — two fingers drop a fret; the guide-tone finger stays put' },
{ shape: SHELL_5.maj7, note: 'Imaj7 — one more fret down: home' },
],
tips: 'The tritone sub turns the iiVI bass into a one-string chromatic slide: 2 → ♭2 → 1, one fret per chord. It works because ♭II7 and V7 share their guide tones — the 3rd and ♭7 swap names (in C: Db7 has F and B, exactly G7\'s B and F). Target the ♭II7\'s 3rd when soloing; it is the old V7\'s ♭7.',
},
{
label: 'Drop-2 slide, top four strings',
level: 'intermediate',
chords: [
{ shape: DROP2.min7Root, note: 'ii7 — root position, root on the D string' },
{ shape: DROP2.dom7Root, note: '♭II7 — same architecture, one fret down' },
{ shape: DROP2.maj7Root, note: 'Imaj7 — one more fret down: three voices fall a half step, one holds' },
],
tips: 'The upper-register version: three root-position drop-2 grips, roots falling a fret at a time. Each change is three voices dropping a half step around one common tone — the ii7\'s ♭3 is held to become the ♭II7\'s 3rd, then the ♭II7\'s ♭7 is held to become the Imaj7\'s 7. High and thin, it stays out of the piano\'s way, and the top string sings the guide-tone line: held into the ♭II7, falling a half step into home.',
},
],
'jazz-rhythm-bridge': [
{
label: 'Shells around the circle',
level: 'intermediate',
chords: [
{ shape: SHELL_6.dom7, note: 'III7 — V7 of vi, the first domino' },
{ shape: SHELL_5.dom7, note: 'VI7 — root string up, nearly the same fret' },
{ shape: SHELL_6.dom7, note: 'II7 — the pattern repeats a whole step down' },
{ shape: SHELL_5.dom7, note: 'V7 — hands you back the A section' },
],
tips: 'One grip pair, four chords: roots falling in fifths alternate 6th → 5th string at almost the same fret, so the whole bridge sits in one position. Each chord is the V of the next — comp two bars each and voice-lead the ♭7 falling a half step onto the next chord\'s 3rd.',
},
{
label: 'Drop-2, alternating inversions (top four strings)',
level: 'intermediate',
chords: [
{ shape: DROP2.dom7Inv2, note: 'III7 — 3rd in the bass voice' },
{ shape: DROP2.dom7Root, note: 'VI7 — nearest root-position grip' },
{ shape: DROP2.dom7Inv2, note: 'II7 — back to the inversion' },
{ shape: DROP2.dom7Root, note: 'V7 — root position into the turnaround' },
],
tips: 'Alternating the 3rd-in-the-bass grip with root-position drop-2 keeps every change a short hop — root-position-only would force five-fret jumps around this circle. Two bars per chord is room to decorate: restrike on the Charleston, or walk the top voice.',
},
],
'jazz-blues': [
{
label: 'Shells through the form',
@@ -213,4 +261,90 @@ export default {
},
],
},
// Structured licks (SCHEMA.md "Licks", task P-21). Written over a iiVI in C
// (Dm7G7Cmaj7) but key-agnostic in spirit — chordContext names the station.
// Every pitch hand-verified: s6=E s5=A s4=D s3=G s2=B s1=e (+fret, mod 12).
licks: [
{
// In D dorian: D E F G E C D — degrees 1 2 ♭3 4 2 ♭7 1 of the ii7.
id: 'jazz-the-lick',
name: 'The Lick',
level: 'foundation',
chordContext: 'over the ii7',
techniques: ['vibrato'],
source: 'the most famous ii-chord cliché in jazz — Wikipedia "The Lick"; Alex Heitlinger\'s 2011 supercut',
tab: [
{ string: 5, fret: 5 }, // D — 1
{ string: 4, fret: 2 }, // E — 2
{ string: 4, fret: 3 }, // F — ♭3
{ string: 4, fret: 5 }, // G — 4
{ string: 4, fret: 2 }, // E — 2
{ string: 5, fret: 3 }, // C — ♭7
{ string: 5, fret: 5, technique: 'vibrato' }, // D — home
],
},
{
// In C: Dm7 arpeggio (D F A C), G7 guide tones (B F), then the bebop
// enclosure FD♯–E — above diatonically, below chromatically — onto the
// Imaj7's 3rd on the downbeat.
id: 'jazz-enclosure-251',
name: 'iiVI enclosure into the 3rd',
level: 'intermediate',
chordContext: 'ii7 → V7 → Imaj7',
techniques: ['chromatic-approach', 'vibrato'],
source: 'in the style of bebop enclosure exercises — David Baker, How to Play Bebop Vol. 1; jazzguitar.be enclosure lessons',
tab: [
{ string: 5, fret: 5 }, // D — ii7 root
{ string: 4, fret: 3 }, // F — ♭3
{ string: 3, fret: 2 }, // A — 5
{ string: 3, fret: 5 }, // C — ♭7
{ string: 3, fret: 4 }, // B — the V7's 3rd, right at the change
{ string: 2, fret: 6 }, // F — the V7's ♭7 (upper neighbour of the target)
{ string: 2, fret: 4, technique: 'chromatic-approach' }, // D♯ — chromatic from below
{ string: 2, fret: 5, technique: 'vibrato' }, // E — the Imaj7's 3rd: enclosed and landed
],
},
{
// Descending G bebop dominant from the root: G F♯ F E D C B A G —
// Mixolydian plus the chromatic passing 7 so chord tones fall on strong
// beats in straight eighths.
id: 'jazz-bebop-dom-descent',
name: 'Bebop dominant descent',
level: 'intermediate',
chordContext: 'dom7 — e.g. the V7',
techniques: ['chromatic-approach', 'vibrato'],
source: 'the bebop dominant scale — David Baker, How to Play Bebop Vol. 1',
tab: [
{ string: 1, fret: 3 }, // G — root
{ string: 1, fret: 2, technique: 'chromatic-approach' }, // F♯ — the added passing tone
{ string: 1, fret: 1 }, // F — ♭7
{ string: 1, fret: 0 }, // E — 13
{ string: 2, fret: 3 }, // D — 5
{ string: 2, fret: 1 }, // C — passing 11
{ string: 3, fret: 4 }, // B — 3
{ string: 3, fret: 2 }, // A — 9
{ string: 4, fret: 5, technique: 'vibrato' }, // G — root, an octave down
],
},
{
// In C, as dyads: Dm7's ♭3+♭7 (F+C) → the ♭7 falls a half step to the
// V7's 3rd (B, F holds) → the held F falls a half step to the Imaj7's
// 3rd (E, B holds as the 7). The 7→3 rails, played literally.
id: 'jazz-guide-tone-rail',
name: 'Guide-tone rail (7 falls to 3)',
level: 'intermediate',
chordContext: 'ii7 → V7 → Imaj7 guide tones',
techniques: ['double-stop', 'slide'],
source: 'guide-tone comping lines — jazzguitar.be guide-tone lessons; Jens Larsen voice-leading studies',
tab: [
{ string: 2, fret: 6 }, // F — the ii7's ♭3
{ string: 3, fret: 5, technique: 'double-stop' }, // C — the ii7's ♭7 (dyad)
{ string: 3, fret: 4, technique: 'slide' }, // B — C falls a half step: the V7's 3rd
{ string: 2, fret: 6, technique: 'double-stop' }, // F — held, renamed the V7's ♭7
{ string: 2, fret: 5, technique: 'slide' }, // E — F falls a half step: the Imaj7's 3rd
{ string: 3, fret: 4, technique: 'double-stop' }, // B — held, now the Imaj7's 7
],
},
],
}
+351
View File
@@ -0,0 +1,351 @@
// Jazz piano pack — first authored piano cell (task P-22). Recipes verified by
// degree-spelling against CHORD_TYPES (src/lib/theory.js) and SCHEMA.md's
// resolveDegree contract. Voicings sourced from: Mark Levine, The Jazz Piano
// Book (three-note "Bud Powell" shells; rootless left-hand voicings; altered
// dominants in minor); learnjazzstandards.com "Left-Hand Piano Voicings for
// ii-V7-Is" (the middle-C position set F-A-C-E / F-A-B-E / E-G-B-D);
// piano.org "Rootless Voicings: Type A and Type B (Bill Evans Style)"
// (A = 3rd on the bottom 3-5-7-9, B = 7th on the bottom 7-9-3-5, dominants
// swap the 5 for the 13); pianogroove.com (minor ii-V-i, ø11 colour);
// jazz-library.com/articles/comping (Charleston; Red Garland offbeats).
// Pedagogy frame: docs/learn-curriculum.md — Piano pillar (shells → rootless,
// register discipline, "rule of 1").
// Reusable degree recipes. Order inside each hand = voicing order, low → high.
const SHELL_R7 = { LH: ['1', '7'] } // Bud Powell shell: root + 7th
const SHELL_R3 = { LH: ['1', '3'] } // Bud Powell shell: root + 3rd
const A_FORM = { LH: ['3', '5', '7', '9'] } // rootless Type A (3rd on bottom)
const B_FORM = { LH: ['7', '9', '3', '5'] } // rootless Type B (7th on bottom)
const A_FORM_DOM = { LH: ['3', '13', '7', '9'] } // dominant Type A: 5 → 13
const B_FORM_DOM = { LH: ['7', '9', '3', '13'] } // dominant Type B: 5 → 13
export default {
styleIntro:
'In a jazz rhythm section the piano is a commentator, not a metronome: short voicings placed around the soloist, roots left to the bassist, colour tones (9ths, 13ths) doing the talking. Left hand learns two grips per chord — a shell and a rootless voicing — and the music comes from where you place them in time.',
comping: [
{
label: 'Charleston',
rhythm: '♩. + "and of 2"',
description: 'Chord on beat 1 (held) plus a stab on the and-of-2 — the foundational syncopated comping cell. Displace it around the bar once it is automatic; comping failure in jams is usually rhythmic, not harmonic.',
},
{
label: 'Red Garland offbeats',
rhythm: '"and of 2" + "and of 4"',
description: 'Both hits off the beat — the Miles Davis quintet sound. The bassist and drummer own the downbeats; you answer them. Keep the voicings short and identical so only the rhythm speaks.',
},
{
label: 'The push (anticipated and-of-4)',
rhythm: 'tied from "and of 4"',
description: 'Strike the next bar\'s chord an eighth note early and hold it over the barline. Telegraphs the change to the whole band — use it going into bar 1 of the form.',
},
],
plays: {
'jazz-251-major': [
{
label: 'Bud Powell shells (LH 17 / 13)',
level: 'intermediate',
chords: [
{ recipe: SHELL_R7, note: 'root + ♭7 — the lightest possible ii chord' },
{ recipe: SHELL_R3, note: 'the ii\'s ♭7 just fell a half-step to become this 3rd' },
{ recipe: SHELL_R7, note: 'the V\'s 3rd holds over as the maj7 — one finger stays put' },
],
register: 'LH around C3; keep the right hand free for melody or answers',
tips: 'Alternating 17 and 13 shells is the whole voice-leading engine: the top note either holds or falls a half-step, never jumps. Two notes is not "beginner" — it is what Bud Powell played behind Charlie Parker. In a duo the root matters; once a bassist arrives, graduate to the rootless play below.',
},
{
label: 'Rootless ABA (Bill Evans left hand)',
level: 'intermediate',
chords: [
{ recipe: A_FORM, note: 'Type A: ♭35–♭79, 3rd on the bottom' },
{ recipe: B_FORM_DOM, note: 'Type B: ♭79313 — only one finger moves from the ii' },
{ recipe: A_FORM, note: 'back to Type A: 3579, a maj9 sound' },
],
register: 'top note between C4 and C5; the bassist owns everything below G3',
tips: 'A on the ii, B on the V, A on the I: alternate the two types and the hand barely moves — that is the entire point of the system. No roots anywhere: that is the bassist\'s lane, and doubling it muddies the band. Practise the pair in all 12 keys around the circle of fifths.',
},
],
'jazz-251-minor': [
{
label: 'Shells with the colour on top',
level: 'intermediate',
chords: [
{ recipe: { LH: ['1', '7'], RH: ['3', '5'] }, note: 'RH ♭3 + ♭5 — the ø colour; don\'t skip the ♭5' },
{ recipe: { LH: ['1', '7'], RH: ['3', 'b9'] }, note: 'the ♭9 is the same key the iiø7\'s ♭5 just was — hold it' },
{ recipe: { LH: ['1', '7'], RH: ['3', '5'] }, note: 'home — resolve and get light' },
],
register: 'LH shells around C3, RH colour tones just above middle C',
tips: 'Hand-role splitting in miniature: LH anchors root + 7th, RH carries the two notes that make the minor iiV dark. The physical lesson is the shared key: the iiø7\'s ♭5 and the V7\'s ♭9 are the same pitch reinterpreted — find it once and keep the finger there through both chords.',
},
{
label: 'Rootless with the altered V',
level: 'intermediate',
chords: [
{ recipe: { LH: ['3', '5', '7', '11'] }, note: '♭3–♭5–♭711 — the 11 is the classic colour on ø chords' },
{ recipe: { LH: ['7', 'b9', '3', 'b13'] }, note: '♭7–♭93–♭13: the altered dominant that minor keys demand' },
{ recipe: A_FORM, note: '♭35–♭79 — a m9 sound; resolved but still coloured' },
],
register: 'top note between C4 and C5',
tips: 'Same A/B logic as the major iiVI, darker fuel: the V7 swaps its 9 and 13 for ♭9 and ♭13 (both live in the key\'s harmonic minor). If the four-note ø voicing feels crunchy, drop the 11 and play the three-note core ♭3–♭5–♭7 — the shells play above is the easier road into this one.',
},
],
'jazz-rhythm-a': [
{
label: 'Shells on the Charleston',
level: 'intermediate',
chords: [
{ recipe: SHELL_R7, note: 'maj7 shell — root + 7' },
{ recipe: SHELL_R3, note: 'the I\'s 7th steps up a half-step to the vi\'s ♭3' },
{ recipe: SHELL_R7, note: 'the vi\'s ♭3 holds over as the ii\'s ♭7 — same key' },
{ recipe: SHELL_R3, note: 'falls a half-step onto the V\'s 3rd, which leads back to bar 1' },
],
register: 'LH around C3; Charleston rhythm, one cell per bar',
tips: 'One chord per bar at rhythm-changes tempo — the two-note grips are the only ones that keep up. Learn the top-voice thread as a loop: hold, half-step, hold, half-step, forever. Rhythm first: put the metronome on 2 and 4 and drill the Charleston until the hands stop negotiating.',
},
{
label: 'Rootless turnaround in one hand position',
level: 'intermediate',
chords: [
{ recipe: A_FORM, note: 'Type A on the I' },
{ recipe: B_FORM, note: 'Type B on the vi — two fingers move, two hold' },
{ recipe: A_FORM, note: 'Type A on the ii' },
{ recipe: B_FORM_DOM, note: 'Type B on the V — one finger moves; bar 4 feeds bar 1' },
],
register: 'top note between C4 and C5',
tips: 'ABAB around the loop keeps most changes to a finger or two — two keys hold into the vi and again into the ii, and only the seam back into bar 1 re-sets three fingers, each by a whole step or less. This is the "rule of 1" made physical: in a five-piece band you supply one fifth of the music, and identical small voicings placed on Red Garland offbeats are exactly that fifth.',
},
],
'jazz-625': [
{
label: 'Shells falling in fifths',
level: 'intermediate',
chords: [
{ recipe: SHELL_R7, note: 'vi — root + ♭7' },
{ recipe: SHELL_R3, note: 'the vi\'s ♭7 falls a whole step onto the ii\'s ♭3' },
{ recipe: SHELL_R7, note: 'ii\'s ♭3 holds over as the V\'s ♭7' },
{ recipe: SHELL_R3, note: 'half-step fall onto the I\'s 3rd — journey over' },
],
register: 'LH around C3',
tips: 'Pure circle-of-fifths motion: alternating 17 / 13 shells was built for exactly this — every root falls a fifth while the top voice walks down by step. Sing the top voice while you play; if you can hear this two-note line, you can predict half the jazz repertoire.',
},
{
label: 'Rootless BABA circle',
level: 'intermediate',
chords: [
{ recipe: B_FORM, note: 'Type B on the vi — ♭7 on the bottom' },
{ recipe: A_FORM, note: 'Type A on the ii — two voices fall a step, two hold' },
{ recipe: B_FORM_DOM, note: 'Type B on the V — a single half-step move' },
{ recipe: A_FORM, note: 'Type A on the I — maj9 landing' },
],
register: 'top note between C4 and C5',
tips: 'Starting on the B form instead of A puts the whole circle a fourth away — same alternation, different lane. Learn both start positions so you can pick whichever keeps the top note between C4 and C5 in the key of the night; that window sits above the bass and below the soloist.',
},
],
'jazz-blues': [
{
label: 'Shells through the form',
level: 'intermediate',
chords: [
{ recipe: SHELL_R7, note: 'I7 — root + ♭7' },
{ recipe: SHELL_R3, note: 'IV7 — the I\'s ♭7 falls a half-step to this 3rd' },
{ recipe: SHELL_R7, note: 'back home' },
{ recipe: SHELL_R7, note: 'hold — or restrike on the and-of-2' },
{ recipe: SHELL_R3, note: 'IV7 again — same half-step fall' },
{ recipe: SHELL_R3, note: 'sit on it' },
{ recipe: SHELL_R7, note: 'home' },
{ recipe: SHELL_R3, note: 'VI7 — the jazz move; hear bar 8 coming' },
{ recipe: SHELL_R7, note: 'ii7 of the turnaround' },
{ recipe: SHELL_R3, note: 'V7 — the ii\'s ♭7 falls a half-step onto this 3rd' },
{ recipe: SHELL_R7, note: 'home' },
{ recipe: SHELL_R3, note: 'V7 pickup into the next chorus' },
],
register: 'LH around C3; RH free for blues fills between phrases',
tips: 'Most of the form runs on one alternation: 17 on the I, 13 on the chord it falls into — those tops arrive by half-step. Bar 8\'s VI7 is the one real reach in the chorus; aim for it early. Fill with the right hand only in the gaps the soloist leaves (rule of 1).',
},
{
label: 'Rootless blues (Wynton Kelly lane)',
level: 'intermediate',
chords: [
{ recipe: A_FORM_DOM, note: 'Type A dominant: 313–♭79' },
{ recipe: B_FORM_DOM, note: 'Type B on the IV7 — two fingers slide, two hold' },
{ recipe: A_FORM_DOM, note: '' },
{ recipe: A_FORM_DOM, note: 'thin it to just 3 + ♭7 if the band is loud' },
{ recipe: B_FORM_DOM, note: '' },
{ recipe: B_FORM_DOM, note: '' },
{ recipe: A_FORM_DOM, note: '' },
{ recipe: { LH: ['3', '7', 'b9'] }, note: 'VI7♭9 — the V-of-ii sound; the ♭9 pulls into the next bar' },
{ recipe: A_FORM, note: 'ii7 — Type A minor' },
{ recipe: B_FORM_DOM, note: 'V7 — Type B, one finger from the ii' },
{ recipe: A_FORM_DOM, note: 'home' },
{ recipe: B_FORM_DOM, note: 'V7 — hands you the next chorus' },
],
register: 'top note between C4 and C5; comp Red Garland offbeats',
tips: 'Dominant rootless voicings carry two colour tones each (9 and 13) — that is why a jazz blues sounds like a suit, not overalls. Between I7 and IV7 the A/B alternation trades like this: two keys hold while swapping names, one voice slips a half-step (the 3↔♭7 trade), and one finger hops a minor third. Bar 8\'s ♭9 is the one dark note in the form: let it ring into the ii.',
},
],
'jazz-tritone-sub': [
{
label: 'Guide tones over the chromatic bass',
level: 'intermediate',
chords: [
{ recipe: { LH: ['1'], RH: ['3', '7'] }, note: 'ii7 — bass on 2, guide tones ♭3 + ♭7 on top' },
{ recipe: { LH: ['1'], RH: ['3', '7'] }, note: '♭II7 — bass slides to ♭2; the ii\'s ♭3 holds as this 3rd' },
{ recipe: { LH: ['1'], RH: ['3', '7'] }, note: 'Imaj7 — bass lands on 1; the ♭II7\'s ♭7 holds as this 7' },
],
register: 'LH single bass notes around C3, RH guide tones just above middle C',
tips: 'The sub turns the bass line into a chromatic slide — 2, ♭2, 1 — while the right hand proves *why* it works: at every change one guide tone holds and the other falls a half-step, because ♭II7 and V7 share the same tritone (the 3rd and ♭7 simply trade names). Play it slow and listen for the two threads.',
},
{
label: 'Rootless: the ♭II7 is a free altered V7',
level: 'intermediate',
chords: [
{ recipe: A_FORM, note: 'ii7 — Type A' },
{ recipe: A_FORM_DOM, note: '♭II7 Type A — read from the old V7\'s root, this exact hand spells ♭7–♯93–♭13: a V7alt for free' },
{ recipe: A_FORM, note: 'Imaj7 — Type A; the ♭II7\'s ♭7 holds over as your maj7' },
],
register: 'top note between C4 and C5',
tips: 'This is the deepest lesson in the substitution: a plain 9/13 rootless voicing on the ♭II7 contains, note for note, the altered voicing of the V7 it replaced — ♭9s and ♭13s appear without you learning a single new grip. Into the ♭II7 every voice holds or moves a half-step — that slide is the sub\'s whole sales pitch. Coming home, three voices resolve the same way while one finger (the sub\'s 13) drops a third onto the I\'s 5th.',
},
],
'jazz-rhythm-bridge': [
{
label: 'Shells around the circle of dominants',
level: 'intermediate',
chords: [
{ recipe: SHELL_R7, note: 'III7 — the first domino; two bars to sit on it' },
{ recipe: SHELL_R3, note: 'VI7 — the III7\'s ♭7 fell a half-step onto this 3rd' },
{ recipe: SHELL_R7, note: 'II7 — the pattern repeats a whole step down' },
{ recipe: SHELL_R3, note: 'V7 — one more half-step fall, then the A section' },
],
register: 'LH around C3; two bars per chord — leave space',
tips: 'Each chord is the V of the next, so the same two-grip alternation from the iiVI walks the whole bridge: ♭7 falls a half-step onto the next 3rd, four times in a row. That chromatic thread in your top voice is also the soloist\'s map — comp it clearly and you are conducting.',
},
{
label: 'Rootless dominants, alternating types',
level: 'intermediate',
chords: [
{ recipe: A_FORM_DOM, note: 'III7 — Type A: 313–♭79' },
{ recipe: B_FORM_DOM, note: 'VI7 — Type B: two keys hold, the old 3rd falls a half-step, the old ♭7 drops a third onto the 9' },
{ recipe: A_FORM_DOM, note: 'II7 — back to Type A' },
{ recipe: B_FORM_DOM, note: 'V7 — Type B hands you the A section' },
],
register: 'top note between C4 and C5',
tips: 'Around a circle of dominants the A/B alternation keeps each step compact: at least one key holds, the old 3rd falls a half-step onto the new ♭7, and nothing moves more than a minor third. Two bars per chord is room to decorate — restrike the same voicing on the Charleston, or walk the top finger up to the 13 and back rather than reaching for a new chord.',
},
],
},
improv: {
scales: [
{ over: 'ii7', scale: 'dorian', why: 'Minor 7 chords in a major key take Dorian — the natural 6 keeps it from sounding sad. On piano it is the parent major scale started from 2: no new fingering.' },
{ over: 'V7', scale: 'mixolydian', why: 'The ♭7 is built in. In minor keys use Phrygian dominant (harmonic minor from the V) — it hands you the ♭9 and ♭13 your left hand is already voicing.' },
{ over: 'Imaj7', scale: 'major', why: 'Plain major works; avoid sitting on the 4th over the maj7 — it rubs against the 3rd a half-step below.' },
{ over: 'I7 (blues)', scale: 'mixolydian', why: 'Mixolydian for the changes, blues scale for the attitude — mix them phrase by phrase, not note by note.' },
{ over: 'iiø7', scale: 'locrian', why: 'Target the ♭3 or ♭5; the ♭5 becomes the ♭9 of the next V7 — the same pivot key your comping hand holds.' },
],
targetNotes:
'Land the 3rd of each chord on the downbeat of the change — your left hand is already holding it, so the ear-check is built in. In any iiVI the 7th of one chord falls a half-step to the 3rd of the next; play that two-note rail as a whole-note chorus before you play eighth notes.',
},
// Structured piano licks (SCHEMA.md "Piano licks", task P-60). Degree-based
// and key-agnostic: every deg resolves through the stated quality, approach
// pitches are derived from the next deg note. Realized offsets in the
// comments use a C-rooted chord for readability; every interval claim in
// notes/tips was recomputed from those offsets before writing (P-41 bar).
licks: [
{
// Over Cm7: C5 B♭4 G4 (E4) (D4) E♭4 — offsets 12 10 7 [4] [2] 3. The
// approaches derive from the ♭3 target: above = 4 (the major 3rd, the
// outside note), below = 2 (the 9). Triplet pickup into beat 3.
id: 'jazz-enclosure-b3',
name: 'Enclosure into the ♭3',
level: 'intermediate',
chordContext: 'over the ii7',
quality: 'min7',
techniques: [],
source: 'the bebop enclosure — Barry Harris workshop vocabulary; David Baker, How to Play Bebop Vol. 1',
notes: [
{ deg: '1', octave: 1, beat: 1 },
{ deg: '7', beat: 1.5 },
{ deg: '5', beat: 2 },
{ approach: 'chrom-above', beat: 2.33 },
{ approach: 'chrom-below', beat: 2.67 },
{ deg: '3', beat: 3 },
],
tips: 'The line falls down the chord — octave root, ♭7, 5th — then the enclosure frames the ♭3 from a half-step either side: the upper neighbour is the major 3rd (deliberately outside on a minor chord), the lower is the 9. Land the target on a strong beat; the two "wrong" notes are what make the right one land.',
},
{
// Over C7: E4 G4 B♭4 D♭5 C5 — offsets 4 7 10 13 12: stacked minor
// thirds 4→7→10→13 (the dim7 arpeggio off the 3rd), then the ♭9
// falling a half-step onto the octave root.
id: 'jazz-dim-flip-v7',
name: '3–♭9 arpeggio over the V7',
level: 'foundation',
chordContext: 'over the V7, resolving to the I',
quality: 'dom7',
techniques: [],
source: 'the 35–♭7–♭9 diminished arpeggio — David Baker, How to Play Bebop Vol. 1',
notes: [
{ deg: '3', beat: 1 },
{ deg: '5', beat: 1.5 },
{ deg: '7', beat: 2 },
{ deg: 'b9', octave: 1, beat: 2.5 },
{ deg: '1', octave: 1, beat: 3 },
],
tips: 'From the 3rd it is minor thirds all the way up — 3, 5, ♭7, ♭9 spell the diminished seventh chord that lives inside every dominant — and the ♭9 sighs a half-step back onto the octave root. When the chord changes, that landing note is renamed the I\'s 5th, so the lick resolves itself.',
},
{
// Over Cmaj7: C4 (E♭4) E4 G4 B4 D5 C5 — offsets 0 [3] 4 7 11 14 12.
// The chromatic slip derives from the 3rd (41=3); thirds 4→7→11→14;
// the 9 settles a whole step onto the octave root.
id: 'jazz-powell-ascent',
name: 'Powell ascent to the 9th',
level: 'intermediate',
chordContext: 'over the Imaj7',
quality: 'maj7',
techniques: [],
source: 'in the style of Bud Powell\'s right-hand arpeggio runs — Mark Levine, The Jazz Piano Book',
notes: [
{ deg: '1', beat: 1 },
{ approach: 'chrom-below', beat: 1.5 },
{ deg: '3', beat: 2 },
{ deg: '5', beat: 2.5 },
{ deg: '7', beat: 3 },
{ deg: '9', octave: 1, beat: 3.5 },
{ deg: '1', octave: 1, beat: 4 },
],
tips: 'One chromatic slip between the root and the 3rd, then nothing but thirds: 3579 climbs the chord to the colour tone before the 9 relaxes a whole step onto the octave root. Arpeggiate to the 9th, not the root — the top of the line is where the chord gets its shine.',
},
{
// Over C7, dyads low+high struck together: B♭4+D5 → A4+C5 → G4+B♭4 →
// E4+G4 — offsets (10,14)(9,12)(7,10)(4,7). Every pair is a third
// (4,3,3,3 semitones); top voice 14→12→10→7, bottom 10→9→7→4; all
// eight notes diatonic to the dominant (Mixolydian) scale.
id: 'jazz-thirds-fall-dom',
name: 'Dominant thirds fall',
level: 'intermediate',
chordContext: 'over the V7, or any dominant bar of a jazz blues',
quality: 'dom7',
techniques: ['double-stop'],
source: 'the dominant scale in diatonic thirds — Barry Harris workshop vocabulary; placed like Red Garland\'s offbeat fills',
notes: [
{ deg: '7', beat: 1 },
{ deg: '9', octave: 1, beat: 1, technique: 'double-stop' },
{ deg: '13', beat: 1.5 },
{ deg: '1', octave: 1, beat: 1.5, technique: 'double-stop' },
{ deg: '5', beat: 2 },
{ deg: '7', beat: 2, technique: 'double-stop' },
{ deg: '3', beat: 2.5 },
{ deg: '5', beat: 2.5, technique: 'double-stop' },
],
tips: 'Four dyads, each one a third: the top voice walks 9root–♭75 (two whole steps, then a skip) while the bottom answers ♭71353 (a half-step, a whole step, then a skip), landing on the chord\'s 3rd-plus-5th. No finger travels more than a minor third between hits. Played short on the offbeats it is comping; let it ring on the beat and it is a fill — same four grips.',
},
],
}
+34
View File
@@ -1,3 +1,8 @@
// Level tags + the two intermediate progressions added by task P-20.
// Intermediate-entry theory verified against: musictheorymanual.com &
// learnjazzstandards.com (Girl from Ipanema tritone sub, ii–♭II7I),
// pianogroove.com (Ipanema harmony/comping analysis), Wikipedia: Rhythm changes
// (bridge = III7VI7II7V7 circle of dominants), docs/progression-repertoire.md §1.
export default [
{
id: 'jazz-251-major',
@@ -9,6 +14,7 @@ export default [
mode: 'major',
songs: ['All The Things You Are', 'Tune Up — Miles Davis', 'Honeysuckle Rose'],
tip: 'The 7th of each chord resolves down a half-step to the 3rd of the next — that two-note thread is the whole progression.',
level: 'foundation',
},
{
id: 'jazz-251-minor',
@@ -20,6 +26,7 @@ export default [
mode: 'minor',
songs: ['Autumn Leaves (bridge)', 'Blue Bossa', 'Beautiful Love'],
tip: 'Same engine as the major iiVI, darker fuel: the ♭5 of the iiø7 is the ♭9 colour waiting to happen on the V7.',
level: 'foundation',
},
{
id: 'jazz-rhythm-a',
@@ -31,6 +38,7 @@ export default [
mode: 'major',
songs: ['I Got Rhythm — Gershwin', 'Oleo — Sonny Rollins', 'Blue Moon'],
tip: 'A loop, not a line — bar 4 hands you straight back to bar 1. Learn it as one circular shape your hands repeat.',
level: 'foundation',
},
{
id: 'jazz-625',
@@ -42,6 +50,7 @@ export default [
mode: 'major',
songs: ['Fly Me to the Moon', 'Autumn Leaves (A section, relative view)'],
tip: 'Pure circle-of-fifths motion: every root falls a fifth. If you can hear this one, you can predict half the jazz repertoire.',
level: 'foundation',
},
{
id: 'jazz-blues',
@@ -53,5 +62,30 @@ export default [
mode: 'major',
songs: ["Billie's Bounce — Charlie Parker", "Now's the Time — Charlie Parker", 'Tenor Madness — Sonny Rollins'],
tip: 'A 12-bar blues wearing a suit: bars 8-10 swap the plain V-IV for a VI7 → iiV turnaround. Hear bar 8 coming and you sound like a jazz player.',
level: 'foundation',
},
{
id: 'jazz-tritone-sub',
name: 'Tritone-sub cadence (ii–♭II7I)',
rn: ['ii7', '♭II7', 'Imaj7'],
degrees: [2, 1, 0],
qualities: ['min7', 'dom7', 'maj7'],
bars: [1, 1, 2],
mode: 'major',
songs: ['The Girl from Ipanema — Jobim (ii–♭II7I in the A section)', 'standard substitute for any V7 in any tune'],
tip: 'The ♭II7 replaces V7 because they share the same tritone — the 3rd and ♭7 simply trade names. What changes is the bass: 2–♭21, a chromatic slide instead of a fifth-fall. Your old iiV line still works over it.',
level: 'intermediate',
},
{
id: 'jazz-rhythm-bridge',
name: 'Rhythm changes bridge (circle of dominants)',
rn: ['III7', 'VI7', 'II7', 'V7'],
degrees: [4, 9, 2, 7],
qualities: ['dom7', 'dom7', 'dom7', 'dom7'],
bars: [2, 2, 2, 2],
mode: 'major',
songs: ['I Got Rhythm — Gershwin (bridge)', 'Oleo — Sonny Rollins (bridge)', 'Anthropology — Parker/Gillespie (bridge)'],
tip: 'Four dominants, each the V of the next — the bridge leaves home and falls back in fifths until it hands you the A section. Follow the ♭7 of each chord dropping a half step onto the 3rd of the next; that chromatic thread is your solo map.',
level: 'intermediate',
},
]
+246
View File
@@ -0,0 +1,246 @@
// Pop piano pack (task P-62). Recipes verified by degree-spelling against
// CHORD_TYPES (src/lib/theory.js) and the validator's stacking convention
// (order inside each hand = voicing order low → high, nearest strictly above —
// documented at jazz/piano.js header). Every voice-leading claim in notes/tips
// is pitch-class arithmetic, computed and checked against the realized
// voicings (key of C for the major loops, E minor for the minor loop) before
// writing. Max combined stack in this pack: 19 semitones (renders for all 12
// roots inside the 36-key MiniPiano window).
//
// Pop piano is deliberately NOT jazz: plain triads and inversions, sus4 pulls
// and one add9 shimmer where the songs themselves put it — no 7ths or 13ths
// bolted on. Patterns and treatments sourced from:
// pianote.com — "Someone Like You" tutorial (the broken bottommiddletop
// middle roll over AEF♯mD, i.e. the axis) and "How To Make Your Left Hand
// Sound Awesome" / "3 Left Hand Piano Patterns" (the root5thoctave "158"
// pop anchor); pianowithjonny.com — "Rock and Roll Piano Chords and
// Accompaniment" (the '50s triplet pump) and "Pop Piano Accompaniment:
// Popstinatos" (repeated-figure pop comping); 500songs.com episode 25 —
// "Earth Angel" (piano triplets as the doo-wop signature, on the record
// itself); en.wikipedia.org/wiki/Pachelbel's_Canon and /wiki/'50s_progression
// (the descending first-inversion bass stair; the ice-cream changes); and the
// records the progressions.js songs list names: Let It Be (quarter-note block
// chords), Graduation — Vitamin C (Canon changes as straight-8th piano pulse),
// Numb — Linkin Park (8th-note octave pulse), Royals — Lorde (sparse pads,
// the ♭VII shimmer). Pedagogy frame: docs/learn-curriculum.md — Piano pillar
// (register discipline; voice-leading as hand economy).
// Reusable degree recipes. Order inside each hand = voicing order, low → high.
const LH_R = ['1'] // single bass root
const LH_R5 = ['1', '5'] // root + fifth anchor
const LH_OCT = ['1', '1'] // pumping octaves (the rock-piano kick drum)
const LH_STACK = ['1', '5', '1'] // root5thoctave: the pianote "158" pop anchor
const RH_ROOT = ['1', '3', '5'] // root-position triad
const RH_INV1 = ['3', '5', '1'] // first inversion (root on top)
const RH_INV2 = ['5', '1', '3'] // second inversion (3rd on top)
const RH_35 = ['3', '5'] // bare 3rd + 5th dyad
export default {
styleIntro:
'Pop piano is the whole arrangement in one instrument: the left hand plays the bass part (roots, fifths, octaves), the right hand stacks plain triads, and the rhythm — pillars, pulses, rolls, triplets — is what changes between songs, not the harmony. Voice-lead the inversions so the top note barely moves, and spend your one colour (a sus4 pull, an add9 shimmer) where the record spends it.',
comping: [
{
label: 'Quarter-note pillars',
rhythm: 'four even quarter-note chords per bar',
description:
'The Let It Be pulse: block the chord on every beat, straight and unhurried, and let the sustain pedal glue the changes. The steadiness is the point — the vocal supplies all the motion.',
},
{
label: 'Driving eighths',
rhythm: 'straight 8ths, accents on 2 and 4',
description:
'Eight even strokes a bar, the piano as rhythm guitar. Verse quiet, chorus loud — in pop the dynamic jump IS the arrangement, so resist adding notes and add weight instead.',
},
{
label: "'50s triplets",
rhythm: '12/8 — three strokes per beat',
description:
'Twelve even triplet chords a bar, the sound of every slow dance since Earth Angel. Keep them soft and metronomic; accent beats 2 and 4 and the whole band swings around you.',
},
{
label: 'The ballad roll',
rhythm: 'broken-chord 16ths: bottommiddletopmiddle',
description:
'Never block the chord — roll it, low to high to low, in an even stream (the Someone Like You engine). One dynamic swell per phrase, pedal through each change.',
},
],
plays: {
'pop-axis': [
{
label: 'The ballad roll (Someone Like You bed)',
level: 'foundation',
chords: [
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'anchor 15 low, roll the triad above: bottommiddletopmiddle in even 16ths' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'the I\'s 5th is this chord\'s root — the whole pattern just slides down a fourth' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'nothing carries over from the V — the total change is why the relative-minor drop lands' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'two names return: the vi\'s root and ♭3 are this chord\'s 3rd and 5th' },
],
register: 'LH fifths around C3, RH roll around middle C',
tips: 'The piano-ballad axis is a texture, not a chord trick: keep the 16ths rolling (the literal Someone Like You verse figure) and let the pedal connect the bars. Know the loop\'s one seam with zero shared notes — V into vi — and lean into it; every other change hands you at least one common tone for free.',
},
{
label: 'Let It Be pillars (voice-led quarters)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: RH_INV1 }, note: 'first inversion — the key\'s home note on top' },
{ recipe: { LH: LH_R, RH: RH_INV2 }, note: 'the G holds; the other two fall by step (top C→B a half-step, E→D a whole)' },
{ recipe: { LH: LH_R, RH: RH_INV2 }, note: 'all three voices rise by step: D→E and G→A whole steps, B→C the half-step' },
{ recipe: { LH: LH_R, RH: RH_ROOT }, note: 'two keys hold (A and C); one finger moves — E up a half-step to F' },
],
register: 'RH pillars around middle C, LH single roots an octave and more below',
tips: 'Four even quarters per bar — the Let It Be pulse — with inversions chosen so the top note only ever leaves the tonic for its neighbour a half-step below (C…B…C…C in the reference key). No right-hand finger moves more than a whole step anywhere in the loop, and the seam home is almost free: the top C holds while F and A fall by step onto E and G.',
},
],
'pop-50s-doowop': [
{
label: 'Earth Angel triplets',
level: 'foundation',
chords: [
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'root-position triad over the 15 anchor — pump it in triplets' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'two names survive the wistful drop: the I\'s root and 3rd are this chord\'s ♭3 and 5th' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'two survive again: the vi\'s root and ♭3 become this chord\'s 3rd and 5th' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'nothing survives — the whole triad steps up a whole step in parallel: the turn home' },
],
register: 'LH around C3, RH triads just above middle C',
tips: 'Twelve even triplet strokes a bar — the doo-wop engine on the Earth Angel record itself. Root positions on purpose: the pump, not the voice leading, is the part. Play them soft and metronomic, accent 2 and 4, and give the singer the whole top of the keyboard.',
},
{
label: 'Wedding-band walk (one-finger changes)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: RH_INV2 }, note: 'second inversion — GCE, the 3rd on top' },
{ recipe: { LH: LH_R, RH: RH_ROOT }, note: 'one finger: the bottom G rises a whole step to A; C and E hold, re-named from root+3rd to ♭3+5th' },
{ recipe: { LH: LH_R, RH: RH_INV1 }, note: 'one finger again: E rises a half-step to F; A and C hold' },
{ recipe: { LH: LH_R, RH: RH_INV1 }, note: 'the whole hand lifts a whole step — A→B, C→D, F→G' },
],
register: 'RH close position around middle C, LH roots below; sustained halves and wholes',
tips: 'The same four chords as the triplet play, reorganised so the first two changes cost exactly one finger each. The seam home is the lesson: the G stays under your hand (top of the V, bottom of the I) while B and D resolve up by step onto C and E. This is the slow-set reading; the triplets play is the dance-set one.',
},
],
'pop-canon': [
{
label: 'The Pachelbel stair (first-inversion walk)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: RH_INV1 }, note: 'root in the bass — the stair starts on 1' },
{ recipe: { LH: ['3'], RH: RH_INV2 }, note: 'LH plays the 3rd, not the root: the bass steps down a half-step onto the key\'s 7th; above, G holds while E→D and C→B fall by step' },
{ recipe: { LH: LH_R, RH: RH_INV2 }, note: 'bass falls a whole step to 6; every right-hand voice rises by step (D→E, G→A, B→C)' },
{ recipe: { LH: ['3'], RH: RH_INV2 }, note: 'LH takes the ♭3: the bass stair falls another whole step onto the key\'s 5th; E holds while A→G and C→B fall' },
{ recipe: { LH: LH_R, RH: RH_INV2 }, note: 'bass reaches 4, one more whole step down; all three voices rise (B→C and E→F by half-step, G→A by whole)' },
],
register: 'LH bass line around C3, RH close voicings just above middle C',
tips: 'The whole trick is two first inversions: put the V and iii over their own 3rds and the left hand walks 17654 — a half-step then three whole steps, the "classical" stair under Memories and Don\'t Look Back in Anger. The right hand alternates fall, rise, fall, rise so no voice ever leaps; at the loop seam the C holds while F and A fall by step.',
},
{
label: 'Graduation pulse (root-position eighths)',
level: 'foundation',
chords: [
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'straight-eighth root positions — the school-assembly reading' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'the bass drops a fourth; the right hand just re-plants the same grip' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'bass up a whole step' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'down a fourth again' },
{ recipe: { LH: LH_R5, RH: RH_ROOT }, note: 'up a half-step — then the loop falls a fourth home' },
],
register: 'both hands mid-low; eight even strokes a bar',
tips: 'Graduation (Friends Forever) plays the Canon changes exactly like this: every chord root position, eight even eighths, zero negotiation in the right hand. Let the left hand tell the story instead — down a fourth, up a step, down a fourth, up a half-step, and a fourth drop home. The stair play is what to graduate to once this grooves.',
},
],
'pop-mixo-bVII': [
{
label: 'The tonic drone (pad voicings)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: RH_INV1 }, note: 'the key\'s home note on top for the two tonic bars' },
{ recipe: { LH: LH_R, RH: ['3', '5', '9'] }, note: 'the top note refuses to move — over the ♭VII it becomes the 9, an add9 shimmer; the two voices under it each fall a whole step (E→D, G→F)' },
{ recipe: { LH: LH_R, RH: RH_ROOT }, note: 'two keys stay down (the ♭VII\'s 5th is this root, its 9 this 5th); only the 3rd moves, leaping a fifth up onto the IV\'s 3rd' },
],
register: 'RH just above middle C; long sustains, pedal through each chord',
tips: 'One key — the key\'s tonic — is physically held down for the entire loop: root of the I, 9 of the ♭VII, 5th of the IV. That drone is the piano translation of the guitar pack\'s ringing open strings, and the 9 it creates on the ♭VII is honest pop colour (Royals hangs its verse on exactly this shimmer). At the seam home the tonic holds again while F and A fall by step onto E and G.',
},
{
label: 'Stadium pulse with the sus pull',
level: 'foundation',
chords: [
{ recipe: { LH: LH_STACK, RH: RH_35 }, note: 'root5thoctave low, bare 35 above; across the two bars lift the 3rd a half-step to the 4th and drop it back — the sus4 pull' },
{ recipe: { LH: LH_STACK, RH: RH_35 }, note: 'the whole five-note stack slides down a whole step in parallel' },
{ recipe: { LH: LH_STACK, RH: RH_35 }, note: 'up a fifth (or feel it as down a fourth) — same grip, third station' },
],
register: 'LH stack from around C2, RH dyad just above middle C — big and low',
tips: 'The piano as rhythm guitar: the 158 left hand is the pop anchor pianote teaches, the two-finger right hand keeps the mid-range clear for the vocal, and dynamics — not new chords — make the chorus. The sus4 pull on the long I bar is the keys version of the guitar pack\'s hammer-on wiggle: 3rd up a half-step, back down, harmony never changes.',
},
],
'pop-minor-loop': [
{
label: 'Dark pads (voice-led)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: RH_ROOT }, note: 'root-position minor — state the lone i plainly' },
{ recipe: { LH: LH_R, RH: RH_INV1 }, note: 'one finger: the i\'s 5th rises a half-step onto this root (on top); the other two hold, re-named as the ♭VI\'s 3rd and 5th' },
{ recipe: { LH: LH_R, RH: RH_INV2 }, note: 'the ♭VI\'s 5th holds as this root; E→D a whole step, C→B a half-step (reference key E minor)' },
{ recipe: { LH: LH_R, RH: RH_ROOT }, note: 'the ♭III\'s 5th holds as this root; G→F♯ a half-step, B→A a whole step' },
],
register: 'RH around middle C, LH roots below; sustained wholes',
tips: 'Three of the four changes cost a finger or two; the seam home costs everything — the ♭VII and the i share no notes at all, so all three voices rise by step together (D→E and A→B whole steps, F♯→G the half-step). That full-hand climb is why the loop feels like it leans back into the minor i. Practise the seam alone until the climb is one gesture.',
},
{
label: 'Octave drive (Numb pulse)',
level: 'foundation',
chords: [
{ recipe: { LH: LH_OCT, RH: RH_35 }, note: 'left-hand octaves hammer the root; the right hand is just ♭3+5 — thin on purpose' },
{ recipe: { LH: LH_OCT, RH: RH_35 }, note: 'same grip on the major: the dyad narrows by one key (♭35 is four semitones, 35 is three)' },
{ recipe: { LH: LH_OCT, RH: RH_35 }, note: 'keep the eighths even; accent 2 and 4' },
{ recipe: { LH: LH_OCT, RH: RH_35 }, note: 'last bar — lean the crescendo into the climb back to the i' },
],
register: 'LH octaves around C2C3, RH dyad mid-keyboard; straight eighths throughout',
tips: 'The rock-piano reading (Numb\'s pulse): octaves are the kick drum, the two-note right hand stays out of the vocal\'s way, and the chorus is a dynamic, not a chord. The one theory note worth keeping: the dyad is four semitones wide on the minor i and three on the majors — one key narrower every time the loop brightens.',
},
],
},
improv: {
scales: [
{
over: 'the major loops (axis, doo-wop, Canon)',
scale: 'major pentatonic',
why: 'Pop toplines are mostly pentatonic: five notes with no avoid tone over any chord in the loop. Add the full major scale for passing notes between phrases.',
},
{
over: 'vi (and the minor loop\'s i)',
scale: 'minor',
why: 'Natural minor of the vi is the same keys as the parent major — identical fingering, darker targets. Minor pentatonic when in doubt; every chord of the minor loop is diatonic to it.',
},
{
over: 'I–♭VIIIV',
scale: 'mixolydian',
why: 'The ♭VII is built from the key\'s ♭7, so Mixolydian covers the whole vamp with one scale — the same call the guitar pack makes.',
},
{
over: 'V (doo-wop, Canon)',
scale: 'major',
why: 'Stay in the parent major; land on the V\'s 3rd — the key\'s leading tone — when you want the turn home to bite.',
},
],
targetNotes:
'Pop fills live between vocal phrases, not over them. Find the note the whole loop shares — the tonic-drone play makes it physical — and hang fills off it, landing phrase endings on the current chord\'s 3rd. The 9 is pop\'s one free colour: a whole step above any root, it reads as shimmer, never as jazz.',
licks: [
{
over: 'pop-axis',
description:
'The roll figure is itself the fill: when the vocal rests, take the right-hand bottommiddletopmiddle broken pattern up an octave for two beats and come back down — motion without a single new note. This is how the Someone Like You verse breathes.',
source: 'pianote.com — "Someone Like You" piano tutorial (the broken-chord verse figure)',
},
{
over: 'pop-mixo-bVII',
description:
'The sus4 pull as a fill: over the held I, alternate the 3rd and 4th in even eighths (343, harmony unchanged) — the keyboard translation of the guitar sus hammer-on that fills long tonic bars in pop-rock loops.',
source: 'the guitar pack\'s sus figure (fretjam.com / guitar.com sus embellishments), translated per pianowithjonny.com pop accompaniment patterns',
},
],
},
}
+66
View File
@@ -179,4 +179,70 @@ export default {
},
],
},
// Structured licks (SCHEMA.md "Licks", task P-24). Written in a home key each
// (noted per lick) but key-agnostic in spirit — chordContext names the station.
// Every pitch hand-verified: s6=E s5=A s4=D s3=G s2=B s1=e (+fret, mod 12).
licks: [
{
// In A minor (i–♭VII = AmG): the skank chords answered as a fill —
// the i's ♭3+5 pair (C+E), the ♭VII's 3+5 pair (B+D) two frets down,
// back home, root on top. Strictly in the vocal gaps.
id: 'reggae-skank-answer',
name: 'Skank-answer double-stop fill',
level: 'foundation',
chordContext: 'answer fill over the i–♭VII vamp, in the vocal gaps',
techniques: ['double-stop', 'vibrato'],
source: 'call-and-response fills in the Wailers style — Guitar World\'s Bob Marley rhythm-guitar lesson',
tab: [
{ string: 3, fret: 5 }, // C — the i's ♭3
{ string: 2, fret: 5, technique: 'double-stop' }, // E — the i's 5: the minor pair
{ string: 3, fret: 4 }, // B — the ♭VII's 3, two frets down
{ string: 2, fret: 3, technique: 'double-stop' }, // D — the ♭VII's 5: the pair moves with the chord
{ string: 3, fret: 5 }, // C — back home
{ string: 2, fret: 5, technique: 'double-stop' }, // E
{ string: 1, fret: 5, technique: 'vibrato' }, // A — the root caps the answer
],
},
{
// In A minor, low register, palm-muted throughout: a minor-pentatonic
// line doubling the bassline in unison — the Lynn Taitt second-guitar
// job. Dull attack, locked exactly with the bass, never approximately.
id: 'reggae-bass-double',
name: 'Muted bass-doubling riddim line',
level: 'foundation',
chordContext: 'over the i — unison with the bassline',
techniques: ['ghost-note'],
source: 'the rocksteady bass-doubling role in Lynn Taitt\'s muted picking style — Wikipedia "Rocksteady"; Brian Keyo\'s Taitt tribute (tallawah.com)',
tab: [
{ string: 6, fret: 5 }, // A — root, palm-muted like everything here
{ string: 6, fret: 5, technique: 'ghost-note' }, // muted pluck — the fluttering Taitt attack
{ string: 6, fret: 8 }, // C — ♭3
{ string: 5, fret: 5 }, // D — 4
{ string: 5, fret: 7 }, // E — 5
{ string: 5, fret: 5 }, // D — 4
{ string: 6, fret: 8 }, // C — ♭3
{ string: 6, fret: 5 }, // A — home; keep the attack dull to the end
],
},
{
// In A: chromatic walk-up 6–♭77 into the root, timed so the root lands
// with the drum's drop (beat 3 of the one drop — beat 1 stays sacred and
// silent), answered by the 3+5 chop up top on the offbeat.
id: 'reggae-walkup-drop',
name: 'Chromatic walk into the one drop',
level: 'intermediate',
chordContext: 'pickup into the I — the root lands on the drop (beat 3)',
techniques: ['chromatic-approach', 'double-stop'],
source: 'in the style of rocksteady/early-reggae walk-ups (the Lynn Taitt-era bass-and-guitar lines — Wikipedia "Rocksteady", "One drop rhythm")',
tab: [
{ string: 6, fret: 2 }, // F♯ — the 6
{ string: 6, fret: 3, technique: 'chromatic-approach' }, // G — ♭7, passing
{ string: 6, fret: 4, technique: 'chromatic-approach' }, // G♯ — 7, passing
{ string: 6, fret: 5 }, // A — root, landing WITH the drop
{ string: 3, fret: 6 }, // C♯ — the 3: jump up for the answer chop
{ string: 2, fret: 5, technique: 'double-stop' }, // E — the 5: the skank answers on the offbeat
],
},
],
}
+52
View File
@@ -169,6 +169,58 @@ export default {
tips: 'For the gospel walk, insert a passing diminished between any two diatonic chords a step apart (I→♯i°→ii) — same borrowed-from-the-choir logic as the iv.',
},
],
'rnb-justthetwo': [
{
label: 'Smooth-soul 9ths and the 13',
level: 'intermediate',
chords: [
{ shape: MAJ9_5, extensions: ['9'], note: '♭VImaj9 — the lush opener' },
{ shape: DOM13_6, extensions: ['13'], note: 'V13 — dominant colour without the bark' },
{ shape: M9_5, extensions: ['9'], note: 'i9 — home, briefly' },
{ shape: M9_5, extensions: ['9'], note: '♭vii9 — same grip, two frets down' },
{ shape: DOM9_5, extensions: ['9'], note: '♭III9 — the V of ♭VI: the loop re-arms itself' },
],
tips: 'Treat the last two chords as one gesture — a iiV pointing at the ♭VImaj9 that starts the next lap (in the original they share a single bar). Solo target: the major 7 of ♭VI is the sweetest note in the loop, and the ♭III9\'s ♭7 falls a half step onto it.',
},
{
label: 'Leaner set with the altered V',
level: 'intermediate',
chords: [
{ shape: MAJ7_5, note: '♭VImaj7 — plainer, room for the vocal' },
{ shape: HENDRIX, extensions: ['#9'], note: 'V7♯9 — the minor-key dominant with grit, one fret below ♭VI' },
{ shape: M11_C, extensions: ['11'], note: 'i11 — dark and hollow' },
{ shape: M9_6, extensions: ['9'], note: '♭vii9 — low root, 9 on top' },
{ shape: DOM13_6, extensions: ['13'], note: '♭III13' },
],
tips: 'The verse-register version: fewer notes, lower voicings, and the ♯9 on the V because in a minor key the dominant wants tension. Save the first play\'s glossy 9ths for the hook — the contrast between the two sets is the arrangement.',
},
],
'rnb-chromatic-vi': [
{
label: 'Chromatic descent on the A string',
level: 'intermediate',
chords: [
{ shape: SIX9_5, extensions: ['6', '9'], note: 'I6/9 — Motown sunshine on the tonic' },
{ shape: M9_5, extensions: ['9'], note: 'vi9 — root high on the A string' },
{ shape: DOM9_5, extensions: ['9'], note: '♭VI9 — the borrowed dominant, one fret down' },
{ shape: DOM9_5, extensions: ['9'], note: 'V9 — one more fret: the slide lands' },
],
tips: 'The last three roots fall one fret at a time down a single string — vi, ♭VI7, V is chromatic planing, the same trick as the jazz tritone sub seen from above (♭VI7 subs for II7). Target the ♭VI7\'s 3rd: it slides a half step down onto the 3rd of V.',
},
{
label: 'Low-string 13th descent, triad on top',
level: 'intermediate',
chords: [
{ shape: TOP3_MAJ, note: 'I — a bare high triad; let the bass state the root' },
{ shape: M9_6, extensions: ['9'], note: 'vi9 — drop to the low-E root' },
{ shape: DOM13_6, extensions: ['13'], note: '♭VI13 — one fret down, horn-section colour' },
{ shape: DOM13_6, extensions: ['13'], note: 'V13 — one more fret; hold it for the horn hit' },
],
tips: 'The register story: start thin and high, then walk the low E string down in half steps with big 13th colour — the guitar plays the horn line. Punch the two 13ths on the beat and mute instantly; Sir Duke swings because of the silence between hits.',
},
],
},
improv: {
+374
View File
@@ -0,0 +1,374 @@
// R&B / Neo-soul piano pack (task P-30). Recipes verified by degree-spelling
// against CHORD_TYPES (src/lib/theory.js) and the validator's stacking
// convention (order inside each hand = voicing order low → high, nearest
// strictly above — documented at jazz/piano.js header). Every voice-leading
// statement in notes/tips is pitch-class arithmetic, computed and checked
// against the realized voicings (key of C) before writing.
// Voicings and treatments sourced from:
// pianowithjonny.com — "4 Steps to Play Neo Soul Chords on Piano" (maj7/min7
// as the base colour, the common-tone voicing rule, Rhodes as the idiomatic
// sound); hearandplay.com — "Neo Soul Chords: Exploring Extended Minor Chords"
// (the m11 voiced as a major triad on the ♭7 over the minor shell);
// pianogroove.com — "'So What' Chord Voicing" (the 111–♭7–♭35 stack: three
// perfect fourths capped by a major third; Bill Evans via the Miles Davis
// session) and "Quartal Comping Voicings for Jazz Piano" (fourths as planeable,
// harmonically ambiguous grips — the Robert Glasper-school texture);
// Mark Levine, The Jazz Piano Book (rootless left-hand voicings Type A/B,
// dominants swapping 5 for 13; sus voicings as a major triad off the ♭7);
// piano.org — "Rootless Voicings: Type A and Type B (Bill Evans Style)";
// freejazzlessons.com & jazzpianoblog.com — "Isn't She Lovely" piano analyses
// (the II9 → V9sus cadence treatment); musicradar.com — D'Angelo "Brown Sugar"
// breakdown & brltheory.com — the Dilla feel (both already cited by
// rnb/guitar.js). Pedagogy frame: docs/learn-curriculum.md — Piano pillar
// (shells → rootless, register discipline, voice-leading as hand economy).
// Reusable degree recipes. Order inside each hand = voicing order, low → high.
const LH_R5 = ['1', '5'] // root + fifth anchor
const LH_R = ['1'] // single bass note
const RH_SPREAD9 = ['9', '3', '7'] // the neo-soul default hand: 9 tucked under the 3rd, 7th on top
const RH_69 = ['6', '9', '3'] // the 6/9 hand: 6 above the LH fifth, 3rd on top
const A_FORM = ['3', '5', '7', '9'] // rootless Type A (3rd on the bottom)
const A_FORM_DOM = ['3', '13', '7', '9'] // dominant Type A: 5 → 13
const B_FORM = ['7', '9', '3', '5'] // rootless Type B (7th on the bottom)
const B_FORM_DOM = ['7', '9', '3', '13'] // dominant Type B: 5 → 13
const SO_WHAT_LH = ['1', '11'] // So What bottom: two of the stacked fourths
const SO_WHAT_RH = ['7', '3', '5'] // So What top: ♭7–♭3 fourth + major-3rd cap
export default {
styleIntro:
'On a neo-soul record the keyboard is the harmonic centre of gravity: Rhodes pads voiced in 9ths and 11ths, roots ceded to the bass player, every change placed a breath behind the drums. The left hand plays anchors (a root, a fifth) or vacates entirely; the right hand carries the colour — and the colour, not the changes, is the song.',
comping: [
{
label: 'Rhodes pads',
rhythm: 'whole- and half-note sustains, soft attack',
description:
'Lay the voicing down and leave it: neo-soul keys breathe in long tones while the drums chop 16ths underneath. Voice-lead so the top note barely moves between chords, and let the Rhodes tremolo (or the piano pedal) do the animating.',
},
{
label: 'Behind-the-beat stabs (the Dilla pocket)',
rhythm: '16th-note stabs, dragged a hair late',
description:
'Short chords placed just behind the drum grid — deliberately, consistently late. Practise with the metronome ON the 16ths and aim to feel lazy without slowing down: the drag is a placement, not a tempo.',
},
{
label: 'The half-step slip',
rhythm: 'grace-note crush into the beat',
description:
'Form the whole grip a half-step below the target, brush it as a grace note, and place the real chord on the beat. The keys translation of the neo-soul guitar slide — most at home on the m9 and maj9 grips.',
},
],
plays: {
'rnb-mediant-circle': [
{
label: 'm9 spreads on the Rhodes',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'm9 planed — even on the iii, where the 9 leans outside the key; the parallel colour is the point' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the iii\'s ♭3 holds over as this ♭7 (same key); its ♭7 falls a whole step onto this ♭3' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the same trade again — the circle\'s law, one station later' },
{ recipe: { LH: LH_R, RH: ['3', '13', '7', '9'] }, note: 'V13 — two note names hold from the ii (♭3→♭7, 9→13); its ♭7 falls a half-step onto this 3rd' },
],
register: 'LH anchors around C3, RH spreads just above middle C; let the Rhodes bark soften the 9s',
tips: 'Three m9s falling in fifths, then the V13. At every change the old ♭3 keeps its key and becomes the new ♭7, while the old ♭7 falls by step — a whole step into a minor chord, a half-step into the dominant. Place every chord a hair behind the drums; the Dilla feel is placement, not extra notes.',
},
{
label: 'So What fourths (quartal planing)',
level: 'intermediate',
chords: [
{ recipe: { LH: SO_WHAT_LH, RH: SO_WHAT_RH }, note: 'the So What chord: 111–♭7–♭35, three perfect fourths capped by a major third' },
{ recipe: { LH: SO_WHAT_LH, RH: SO_WHAT_RH }, note: 'the same five-finger grip planed down a fifth — nothing to re-finger' },
{ recipe: { LH: SO_WHAT_LH, RH: SO_WHAT_RH }, note: 'third station on the circle; the fourths keep it airy and unresolved' },
{ recipe: { LH: LH_R, RH: ['3', '13', '9'] }, note: 'quartal V13: the right hand stacks two perfect fourths (3139) over the bare root; two of the ii\'s note names are already here — its 11 is this root, its 5th this 9' },
],
register: 'both hands close together, mid-keyboard — the five So What notes span a twelfth',
tips: 'This is the Bill Evans "So What" grip that the Glasper school planes shamelessly: fourths are harmonically ambiguous, so one hand-shape covers every m7 on the circle — you slide, the drums swing, nobody asks questions. Save the stacked-third m9 play for hooks; fourths are verse texture.',
},
],
'rnb-6251': [
{
label: 'Stevie hands (the full cadence)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'm9 spread to start the fall home' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the dominant II: the vi\'s ♭3 holds as this ♭7 — and that note is the key\'s tonic; its ♭7 falls a half-step onto this 3rd' },
{ recipe: { LH: LH_R5, RH: ['b7', '9', '3'] }, note: '9sus: the right hand is a plain major triad built on the ♭7 — the II\'s 3rd just fell a half-step into it' },
{ recipe: { LH: LH_R5, RH: RH_69 }, note: '6/9 instead of a plain triad — the sus ♭7 fell a half-step onto this 3rd, its 9 held over as this 6' },
],
register: 'LH fifths around C3, RH around middle C; unhurried, let the sus ring',
tips: 'The cadence never plays a plain dominant: the II is a 9, the V is a 9sus that melts rather than resolves, and home is a 6/9. Track the key\'s home note through the middle of it — it is the II9\'s ♭7, then the sus chord\'s suspended 4th, before it finally lands in your left hand on the I.',
},
{
label: 'Rootless (Levine grips behind a bassist)',
level: 'intermediate',
chords: [
{ recipe: { LH: A_FORM }, note: 'Type A rootless: ♭35–♭79' },
{ recipe: { LH: A_FORM_DOM }, note: 'three note names hold (♭3→♭7, 5→9, 9→13); only the ♭7 moves, a half-step onto this 3rd' },
{ recipe: { LH: ['3', '13', 'b7', '9'] }, note: '13sus — the dominant Type A shape with the 4th where the 3rd was; two names hold from the II (♭7→4, 9→13), the 3rd falls a half-step onto this ♭7, the 13 a whole step onto this 9' },
{ recipe: { LH: ['3', '5', '6', '9'] }, note: '6/9 landing: the sus 13 was already this 3rd, its 9 this 6th — those hold; the 4th and ♭7 each rise a whole step (onto the 9 and the 5th)' },
],
register: 'left hand alone, top note between C4 and C5 — the bassist owns the roots',
tips: 'The vi→II seam is the same physical move as any iiV — three fingers hold, one falls — even though the II is a secondary dominant; your hand doesn\'t care about the theory. The 13sus is the modern-soul V: as a shape it is your dominant Type A with the bottom note a half-step up, and it never fully commits to dominant. That non-commitment IS the Stevie sound.',
},
],
'rnb-maj7-vamp': [
{
label: 'maj9 pads',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'maj9 spread — the 9 tucked in above the anchor, 3rd and maj7 closing the hand' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the I\'s 3rd holds over as this maj7 (same note name); its maj7 falls a whole step onto this 3rd' },
],
register: 'wide and sustained; pedal through each two-bar chord',
tips: 'Two chords, one hinge: the I\'s 3rd and the IV\'s maj7 are the same note name — keep it in your voicing all night and float the rest around it (the common-tone rule pianowithjonny builds the whole style on). Colour each repeat differently — add the 9, thin to a bare 37, restrike on the and-of-2 — instead of changing chords.',
},
{
label: 'Quartal drift (Glasper pads)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: ['7', '3', '13'] }, note: 'fourths off the maj7: 7313, two perfect fourths — lush but weightless over the bare bass note' },
{ recipe: { LH: LH_R, RH: ['7', '3', '13'] }, note: 'same shape on the new root — two of its three note names were already sounding (the I\'s 3rd is this maj7, its 13 this 3rd)' },
],
register: 'single bass notes low, the fourths around middle C; let everything ring into everything',
tips: 'Every note both chords use comes from one parent scale, which is why this vamp can loop for six minutes without leaving home. The fourth-stack keeps the maj7 from sounding like a piano-bar ballad — same colour tones, none of the syrup. Vary the attack point (bar 2, the and-of-3) rather than the harmony.',
},
],
'rnb-dorian': [
{
label: 'm11 haze (Voodoo pads)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: ['7', '9', '11'] }, note: 'm11: the right hand is a major triad built on the ♭7 — the hearandplay neo-soul grip' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'every right-hand voice moves by a step and no further: the ♭7 falls a half-step onto this 3rd, the 9 rises a half-step onto this ♭7, the 11 rises a whole step onto this 9' },
],
register: 'low fifths, right hand clustered just above middle C; 70 BPM, pedal-blurred',
tips: 'The whole haze is two steps wide — at the change every voice moves by a step and the grip re-forms. The IV9\'s major 3rd is Dorian\'s raised 6th, the one note separating this from plain sad minor: it is what tells the room this is D\'Angelo. Let it arrive slightly late.',
},
{
label: 'Voodoo minimal (two-finger stabs)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: ['b3', '11'] }, note: 'a bare whole-step rub — ♭3 against 11 — more smoke than chord' },
{ recipe: { LH: LH_R, RH: ['3', 'b7'] }, note: 'just the dominant\'s tritone; the i\'s ♭3 has become this ♭7 (same note name) — half the dyad doesn\'t move' },
],
register: 'almost nothing: one bass note, two right-hand notes mid-keyboard — the drums are the point',
tips: 'Voodoo-era D\'Angelo is subtraction: three notes total, laid so far behind the beat they almost fall over. Two-finger shapes leave room for the slip — brush the dyad a half-step below and land both fingers on it on the beat. If it sounds empty, good: resist adding notes and push the placement instead.',
},
],
'rnb-gospel-amen': [
{
label: 'The borrowed sigh (full hands)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'maj9 — bright before the shadow' },
{ recipe: { LH: LH_R5, RH: ['6', '9', '3'] }, note: 'the borrowed chord: the 3rd fell a half-step to ♭3, the maj7 a whole step onto the 6th, and the 9 held' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'home: the iv\'s 6th holds as this 9; its borrowed ♭3 sighs a half-step down onto the key\'s 5th — your left hand is already holding it' },
],
register: 'LH fifths around C3, RH just above middle C; let the iv bar breathe',
tips: 'One chord borrowed from the parallel minor, two sighs to pay for it: the 3rd falls a half-step going in (IV→iv), the borrowed ♭3 falls a half-step coming home (iv→I). Every other note name holds or steps down — soul ballads end on this cadence because the hands literally relax. Play the iv softer than the IV; borrowed chords whisper.',
},
{
label: 'Rootless, iv as m6/9',
level: 'intermediate',
chords: [
{ recipe: { LH: A_FORM }, note: 'Type A rootless: 3579' },
{ recipe: { LH: ['3', '5', '6', '9'] }, note: 'm6/9: the 5th and the 9 hold; the 3rd falls a half-step to ♭3, the maj7 a whole step onto the 6th' },
{ recipe: { LH: A_FORM }, note: 'the iv\'s 6th and 9th are already this chord\'s 9th and 5th — those names hold; the borrowed ♭3 (the key\'s ♭6) resolves down a half-step to the 5th, and the iv\'s 5th — the key\'s own tonic — slips a half-step onto this maj7' },
],
register: 'left hand alone, top note C4C5; a bassist owns the roots',
tips: 'The m6/9 grip is what makes the borrowed iv sound like Musiq Soulchild instead of a hymn: same borrowed ♭3, but the 6 and 9 around it are both notes the I wants anyway, so the chord arrives already half-resolved. Across the whole cadence no change moves more than two note names — that stillness is the neo-soul reading of gospel\'s Amen.',
},
],
'rnb-justthetwo': [
{
label: 'Planed 9ths (smooth-soul pads)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'maj9 on the ♭VI — the loop starts away from home' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the whole chord sinks: roots, 5ths, 3rds and 9s each fall a half-step; the 7 falls a whole step (maj7 becomes ♭7)' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the V\'s 3rd — the raised leading tone — resolves up a half-step into your bass root; its ♭7 falls a whole step onto this ♭3' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the same m9 hand slides down a whole step — every voice, together' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'a iiV pointing at ♭VI: the ♭vii\'s ♭3 holds as this ♭7 (same name); its ♭7 falls a half-step onto this 3rd' },
],
register: 'LH fifths mid-low, RH spreads above middle C; think slow-jam strings',
tips: 'The loop teaches two lessons. First, the half-step fall: ♭VI→V drags every voice down by step. Second, iiVs that aim somewhere other than home: ♭vii–♭III7 is a iiV of the ♭VI, and the ♭III7\'s 3rd is the ♭VI\'s maj7 by name — so the loop\'s seam resolves as smoothly as its middle. Hear those two things and every smooth-soul chart gets easier.',
},
{
label: 'Rootless A/B (90s R&B changes)',
level: 'intermediate',
chords: [
{ recipe: { LH: A_FORM }, note: 'Type A on the ♭VImaj7: 3579' },
{ recipe: { LH: B_FORM_DOM }, note: 'Type B on the V: no name survives — every voice moves by step, three of the four by half-step' },
{ recipe: { LH: A_FORM }, note: 'back to Type A: the V\'s 3rd falls a half-step onto this ♭7, its ♭7 a whole step onto this ♭3' },
{ recipe: { LH: B_FORM }, note: 'Type B — alternating types keeps the voicing in the same part of the keyboard while the roots move' },
{ recipe: { LH: A_FORM_DOM }, note: 'three names hold from the ♭vii (9→13, ♭3→♭7, 5→9); only its ♭7 falls, a half-step onto this 3rd' },
],
register: 'top note between C4 and C5; leave the low register to the bass and pads',
tips: 'The iiV law rides again in a strange neighbourhood: minor-to-dominant a fifth down means three fingers freeze and one falls, whether the target is home or — as here — the ♭VI. Around the seam, two names hold into the ♭VImaj7: the ♭III7\'s 3rd becomes its maj7, its 13 becomes its 3rd. Learn the loop as hand motion, not chord names.',
},
],
'rnb-chromatic-vi': [
{
label: 'The chromatic slide (full hands)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R5, RH: RH_69 }, note: '6/9 — the Motown tonic; its 6th is the vi\'s root arriving early' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the I\'s 9 fell a whole step onto this ♭3; its 6th fell another onto this ♭7' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the key\'s home note holds through this change — the vi\'s ♭3 IS the ♭VI7\'s 3rd; the ♭7 and 9 each slip down a half-step' },
{ recipe: { LH: LH_R5, RH: RH_SPREAD9 }, note: 'the whole chord planes down a semitone — all five voices fall exactly a half-step' },
],
register: 'LH fifths around C3, RH around middle C',
tips: 'Sir Duke\'s verse is a bass line wearing chords: home for a bar, then 6–♭65 in half-steps. Count what survives on top: the tonic note refuses to move from vi into ♭VI7 (it just turns from ♭3 into 3rd), then nothing survives into V7 — the one change where everything slides together. Whether you call the ♭VI7 borrowed or a tritone sub of II7, the hands play the same thing.',
},
{
label: 'Stab set with the ♯9 (horn-section hands)',
level: 'intermediate',
chords: [
{ recipe: { LH: LH_R, RH: ['3', '5', '1'] }, note: 'plain triad, root on top — punchy, no colour yet' },
{ recipe: { LH: LH_R, RH: ['3', '5', '7'] }, note: 'the same three note names you just played, reread as this chord\'s ♭3, 5th and ♭7 — only the bass moves' },
{ recipe: { LH: LH_R, RH: ['3', '13', '7'] }, note: '♭VI13: the home note holds (♭3 turned 3rd) while the outer pair pinch inward by half-steps — 5th up onto the 13, ♭7 down onto the ♭7' },
{ recipe: { LH: LH_R, RH: ['3', '7', '#9'] }, note: 'the ♯9 exclamation: the ♭VI\'s 13 holds over as this ♭7 (same name) while the home note finally gives way, a half-step down onto the leading tone' },
],
register: 'tight three-note stabs either side of middle C; short, on the hits',
tips: 'Play these like a horn section: short, placed, gone. The I-to-vi change is free (same three names, new bass), the middle pinches chromatically, and the ♯9 on the V is spice you spend once per loop — the soul-horn exclamation, same budget as the guitar pack\'s 7♯9. Between stabs, dead silence is the groove.',
},
],
},
improv: {
scales: [
{
over: 'i7 / IV9 (Dorian vamps)',
scale: 'dorian',
why: 'D\'Angelo vamps live on Dorian: its raised 6th is the IV9\'s major 3rd, so the scale agrees with the chord change instead of fighting it — one scale covers both chords of the loop.',
},
{
over: 'the m9 circle (iiiviii)',
scale: 'dorian from each root',
why: 'Each root\'s own Dorian contains exactly the planed m9 grip (9, ♭3, 11, ♭7) — shift scales with the chords, the way the chords themselves plane. Aim at each new 9th.',
},
{
over: 'Imaj7 / IVmaj7',
scale: 'major pentatonic of the key',
why: 'Five notes, no avoid note over either chord — over the IV they land on its 3rd, 5th, maj7, 9 and 13. The pentatonic haze over lush maj7s is half of bedroom R&B.',
},
{
over: 'dom7 (II9, V13, ♭VI7, ♭III7)',
scale: 'mixolydian from the chord\'s root',
why: 'Each passing dominant carries its own Mixolydian for exactly one bar. Over the ♭VI7 that scale still contains the key\'s home note — the same pivot your comping hand is holding.',
},
{
over: 'V9sus',
scale: 'the key\'s major scale',
why: 'A 9sus is the ii7 stacked on the V\'s bass, so the plain parent scale cannot miss. Land on the 9 or the suspended 4th, and let the ♭7 fall to the I\'s 3rd when the chord finally turns.',
},
],
targetNotes:
'Nines on the downbeats: most grips in this pack keep a 9 under your fingers, and landing on it — a whole step above each new root — is the fastest way to sound like the record. Approach chord tones from a half-step below (the single-note version of the slip), and when in doubt lay out for a bar: neo-soul solos breathe on the 16th grid they float over.',
},
// Structured piano licks (SCHEMA.md "Piano licks", task P-61). Degree-based
// and key-agnostic: every deg resolves through the stated quality, approach
// pitches are derived from the next deg note. Realized offsets in the
// comments use a C-rooted chord for readability; every interval claim in
// notes/tips was recomputed from those offsets before writing (P-41 bar).
licks: [
{
// Over Cm7: D5 C5 B♭4 G4 E♭4 — offsets 14 12 10 7 3: the 9 held a
// beat and a half, sighing a whole step onto the octave root, then
// the m7 arpeggio falling away (root, ♭7, 5, ♭3) on dragged beats.
id: 'rnb-nine-sigh',
name: 'The nine sigh',
level: 'foundation',
chordContext: 'over the i7 — the m9 colour of a Dorian vamp',
quality: 'min7',
techniques: [],
source: 'the 9-over-minor colour neo-soul leads with — hearandplay.com "Neo Soul Chords: Exploring Extended Minor Chords"; pianowithjonny.com neo-soul lessons',
notes: [
{ deg: '9', octave: 1, beat: 1 },
{ deg: '1', octave: 1, beat: 2.5 },
{ deg: '7', beat: 3 },
{ deg: '5', beat: 3.5 },
{ deg: '3', beat: 4.5 },
],
tips: 'Start ON the 9 — the note this pack keeps under your fingers — hold it past the beat, then let it sigh a whole step onto the octave root and fall away down the chord: ♭7, 5th, ♭3. The beats are written lazy on purpose (the root lands on the and-of-2, the ♭3 limps in on the and-of-4): the sigh is a placement as much as a pitch.',
},
{
// Over Cm7, quartal dyads (each pair a perfect 4th, 5 semitones):
// brush (A4,D5)=(9,14) a half-step below, land (B♭4,E♭5)=(10,15),
// then plane down (G4,C5)=(7,12) and (F4,B♭4)=(5,10). Every note —
// grace pair included — sits in the root's Dorian scale.
id: 'rnb-quartal-slip',
name: 'Quartal slip (fourths on the drag)',
level: 'intermediate',
chordContext: 'over the i7 — verse texture on any m7 station',
quality: 'min7',
techniques: ['grace-note', 'double-stop'],
source: 'fourths as planeable neo-soul texture (the Glasper-school grip) — pianogroove.com "Quartal Comping Voicings for Jazz Piano"; the half-step slip per pianowithjonny.com "4 Steps to Play Neo Soul Chords on Piano"',
notes: [
{ deg: '6', beat: 1, technique: 'grace-note' },
{ deg: '9', octave: 1, beat: 1, technique: 'grace-note' },
{ deg: '7', beat: 1 },
{ deg: '3', octave: 1, beat: 1, technique: 'double-stop' },
{ deg: '5', beat: 2.5 },
{ deg: '1', octave: 1, beat: 2.5, technique: 'double-stop' },
{ deg: '11', beat: 3.5 },
{ deg: '7', beat: 3.5, technique: 'double-stop' },
],
tips: 'One perfect fourth does the whole lick: brush it a half-step low (6 under 9 — both Dorian notes, so even the smear is in the scale) and land it on ♭7-under-♭3 at the beat, then drop the same two-finger grip a third onto 5-under-root, and a step onto 11-under-♭7. Ending on the 11 dyad resolves nothing, and that hovering non-arrival is exactly the verse texture the fourths exist for.',
},
{
// Over Cm7: C5 (B4) B♭4 (A♭4) G4 (E4) E♭4 — offsets 12 [11] 10 [8] 7
// [4] 3. Each bracketed pitch is derived (chrom-above of the next
// deg); the beat-notes alone spell the falling m7 arpeggio
// (root, ♭7, 5, ♭3), each one dragged into from a half-step above
// on the last 16th before the beat.
id: 'rnb-dilla-drop',
name: 'The Dilla drop (lazy chromatic fall)',
level: 'intermediate',
chordContext: 'over the i7, dragged behind the grid',
quality: 'min7',
techniques: [],
source: 'the behind-the-grid drag of the Dilla feel — brltheory.com on the Dilla time-feel; falling-chromatic voice motion per the musicradar.com D\'Angelo "Brown Sugar" breakdown',
notes: [
{ deg: '1', octave: 1, beat: 1 },
{ approach: 'chrom-above', beat: 1.75 },
{ deg: '7', beat: 2 },
{ approach: 'chrom-above', beat: 2.75 },
{ deg: '5', beat: 3 },
{ approach: 'chrom-above', beat: 3.75 },
{ deg: '3', beat: 4 },
],
tips: 'The skeleton is just the chord falling — octave root, ♭7, 5th, ♭3 on the beats — but every chord tone gets dragged into from the half-step above, placed on the last 16th before it lands. The first drag is the minor chord\'s natural 7, the last is the major 3rd — the same "wrong" upper neighbour the jazz enclosure uses — and neither sounds wrong at this tempo because each one falls immediately. Play it almost too late; the lean IS the lick.',
},
{
// Over Cmaj7: G4 A4 C5 D5 E5 D5 — offsets 7 9 12 14 16 14: the major
// pentatonic climbed to the 3rd (whole step, minor 3rd, whole step,
// whole step), then settling a whole step back onto the 9. Ghosts on
// the passing 6 and the first 9.
id: 'rnb-penta-turn',
name: 'Pentatonic turn onto the 9',
level: 'foundation',
chordContext: 'over the Imaj7 (or IVmaj7) of the maj7 vamp',
quality: 'maj7',
techniques: ['ghost-note'],
source: 'the major-pentatonic haze over lush maj7s — stock bedroom-R&B fill vocabulary; see pianowithjonny.com neo-soul piano lessons',
notes: [
{ deg: '5', beat: 1 },
{ deg: '6', beat: 1.5, technique: 'ghost-note' },
{ deg: '1', octave: 1, beat: 2 },
{ deg: '9', octave: 1, beat: 2.5, technique: 'ghost-note' },
{ deg: '3', octave: 1, beat: 3 },
{ deg: '9', octave: 1, beat: 4 },
],
tips: 'Climb the major pentatonic — 5, 6, root, 9 — peak on the 3rd, then settle a whole step back onto the 9 and stay there: the resolution note is the colour note, which is the whole neo-soul bargain. The ghosted notes (the 6 and the first 9) should be felt more than heard — press them at half weight so the beat-notes ring and the in-betweens blur. Same six keys work over the IVmaj7 a bar later.',
},
],
}
+37
View File
@@ -1,3 +1,11 @@
// Level tags + the two intermediate progressions added by task P-20.
// Intermediate-entry changes verified against: guitarmusictheory.com &
// Hooktheory TheoryTab & musescore.com feature ("Just the Two of Us" —
// D♭maj7C7Fm7 with the E♭m7A♭7 iiV pointing back at ♭VI, key of F minor),
// Hooktheory TheoryTab & songdna.blogspot.com & spytunes.com ("Sir Duke"
// verse BG♯mGF♯7 = Ivi–♭VI7V chromatic descent),
// docs/progression-repertoire.md §2 (modal interchange, secondary dominants,
// tritone substitution rows).
export default [
{
id: 'rnb-mediant-circle',
@@ -9,6 +17,7 @@ export default [
mode: 'major',
songs: ['September — Earth, Wind & Fire (rotation family)', 'the soul turnaround started from the iii'],
tip: 'The 1-6-2-5 family entered from the mediant — home is implied for three bars before the V finally points at it. Neo-soul lives in that deferral.',
level: 'foundation',
},
{
id: 'rnb-6251',
@@ -20,6 +29,7 @@ export default [
mode: 'major',
songs: ["Isn't She Lovely — Stevie Wonder"],
tip: 'The II is a secondary dominant (not the polite ii), and the V arrives as a 9sus — suspended, never quite dominant, melting into the I. Stevie\'s whole cadence language in four chords.',
level: 'intermediate',
},
{
id: 'rnb-maj7-vamp',
@@ -31,6 +41,7 @@ export default [
mode: 'major',
songs: ['Waiting in Vain — Bob Marley', "Cruisin' — Smokey Robinson (Iii7 variant)"],
tip: 'Two lush chords trading forever — the song is the texture. The same vamp underpins half of modern bedroom R&B; colour it differently every two bars.',
level: 'foundation',
},
{
id: 'rnb-dorian',
@@ -42,6 +53,7 @@ export default [
mode: 'dorian',
songs: ["Spanish Joint — D'Angelo", "Didn't Cha Know — Erykah Badu (iiv minor variant)", "Brown Sugar — D'Angelo (E Dorian loop)"],
tip: 'The IV9 carries the raised 6th that makes it Dorian — the same pair as the funk vamp, slowed to 70 BPM and dragged behind the beat.',
level: 'foundation',
},
{
id: 'rnb-gospel-amen',
@@ -53,5 +65,30 @@ export default [
mode: 'major',
songs: ['the gospel "Amen" cadence', 'countless soul ballad turnarounds (borrowed iv)'],
tip: 'The IV turns minor on its way home — borrowed from the parallel minor, the single most-borrowed chord in soul. One semitone (the 3rd of the IV falling) does all the work.',
level: 'intermediate',
},
{
id: 'rnb-justthetwo',
name: 'Just-the-Two-of-Us loop (♭VIVi + iiV of ♭VI)',
rn: ['♭VImaj7', 'V7', 'i7', '♭vii7', '♭III7'],
degrees: [8, 7, 0, 10, 3],
qualities: ['maj7', 'dom7', 'min7', 'min7', 'dom7'],
bars: [1, 1, 2, 1, 1],
mode: 'minor',
songs: ['Just the Two of Us — Grover Washington Jr. & Bill Withers', 'a smooth-soul/90s-R&B staple loop'],
tip: 'A minor loop that spends most of its time away from home: ♭VIVi falls in half steps, then the ♭vii–♭III7 is a iiV aimed back at ♭VI, not at i. Hearing iiVs that target chords other than the tonic is the door out of diatonic playing — in the original the last two chords share one bar.',
level: 'intermediate',
},
{
id: 'rnb-chromatic-vi',
name: 'Chromatic soul descent (Ivi–♭VI7V)',
rn: ['I', 'vi7', '♭VI7', 'V7'],
degrees: [0, 9, 8, 7],
qualities: ['maj', 'min7', 'dom7', 'dom7'],
bars: [1, 1, 1, 1],
mode: 'major',
songs: ['Sir Duke — Stevie Wonder (verse)'],
tip: 'One swapped chord makes it: where the diatonic loop would repeat vi or move to IV, the ♭VI7 (borrowed from the parallel minor) slides the bass down 6–♭65 in half steps. It doubles as a tritone sub of II7 (V/V) — either way the whole chord planes down a semitone into V.',
level: 'intermediate',
},
]
+91
View File
@@ -209,4 +209,95 @@ export default {
},
],
},
// Structured licks (SCHEMA.md "Licks", task P-24). Written in a home key each
// (noted per lick) but key-agnostic in spirit — chordContext names the station.
// Every pitch hand-verified: s6=E s5=A s4=D s3=G s2=B s1=e (+fret, mod 12).
licks: [
{
// In A: the 4 slid up to the 5 on the B string, the root stacked on top
// (E+A — the Berry 4ths dyad), hammered in triplets, then the ♭3→3 curl
// and home. The rock-and-roll intro figure.
id: 'rock-berry-double-stop',
name: 'Berry double-stop intro figure',
level: 'foundation',
chordContext: 'over the I — intro or turnaround energy',
techniques: ['slide', 'double-stop', 'hammer-on', 'vibrato'],
source: 'in the style of the "Johnny B. Goode" intro double-stops — Chuck Berry (1958); JustinGuitar song lesson SB-425',
tab: [
{ string: 2, fret: 3 }, // D — the 4, pickup two frets below
{ string: 2, fret: 5, technique: 'slide' }, // E — the 5th, slid up the B string
{ string: 1, fret: 5, technique: 'double-stop' }, // A — root on top: the Berry 4ths dyad lands
{ string: 2, fret: 5 }, // E — restrike the pair in triplets
{ string: 1, fret: 5, technique: 'double-stop' }, // A
{ string: 2, fret: 5 }, // E
{ string: 1, fret: 5, technique: 'double-stop' }, // A
{ string: 3, fret: 5 }, // C — ♭3
{ string: 3, fret: 6, technique: 'hammer-on' }, // C♯ — the 3: the curl resolves up
{ string: 1, fret: 5, technique: 'vibrato' }, // A — end on the root
],
},
{
// In A, box 1 at fret 5: the B-string ♭7 (G) bent a whole step up to the
// root against the same root held on the top string — the beating unison,
// then the ♭3 answer and home. The Purple Haze-outro cliché.
id: 'rock-unison-bend',
name: 'Box-1 unison bend',
level: 'intermediate',
chordContext: 'over the I (or i) at the solo climax',
techniques: ['bend', 'double-stop', 'vibrato'],
source: 'the unison-bend cliché ("Purple Haze" outro lineage — Hendrix, Page, May); JustinGuitar unison bend technique BL-607',
tab: [
{ string: 1, fret: 5 }, // A — state the root first
{ string: 2, fret: 8, technique: 'bend' }, // G — ♭7 bent a whole step up to A
{ string: 1, fret: 5, technique: 'double-stop' }, // A — held on top: the unison pair beats
{ string: 2, fret: 8, technique: 'bend' }, // bend it again
{ string: 1, fret: 5, technique: 'double-stop' }, // A on top
{ string: 1, fret: 8 }, // C — the ♭3: blues grit over a major I
{ string: 1, fret: 5, technique: 'vibrato' }, // A — resolve on the root
],
},
{
// In A Mixolydian (I–♭VIIIV = AGD): climb the mode from the root and
// land the key's ♭7 (G) exactly as the ♭VII chord hits — it IS that
// chord's root — then let it fall a half step to F♯, the IV's 3rd. A
// voice-leading rail, rock edition.
id: 'rock-mixo-rail',
name: 'Mixolydian rail onto the ♭VII',
level: 'intermediate',
chordContext: 'I → ♭VII → IV vamp',
techniques: ['slide', 'vibrato'],
source: 'the I–♭VIIIV Mixolydian language ("All Right Now"/"Highway to Hell" triads) — GuitarPlayer "Master the Mixolydian Mode"; Fundamental Changes "Study the Mixolydian Mode Pt 1"',
tab: [
{ string: 4, fret: 7 }, // A — root, over the I
{ string: 3, fret: 4 }, // B — 2
{ string: 3, fret: 6 }, // C♯ — 3
{ string: 3, fret: 7, technique: 'slide' }, // D — 4, slid into
{ string: 2, fret: 5 }, // E — 5
{ string: 2, fret: 8, technique: 'vibrato' }, // G — the key's ♭7: the ♭VII's root, landed at the change
{ string: 2, fret: 7 }, // F♯ — falls a half step: the IV's 3rd
{ string: 1, fret: 5, technique: 'vibrato' }, // A — the IV's 5th; home
],
},
{
// In A minor, box 1: the descending pull-off cascade — two notes per
// string down the pentatonic, ending on the root an octave down. The
// stock rock run every soloist owns.
id: 'rock-box1-cascade',
name: 'Descending pull-off cascade',
level: 'foundation',
chordContext: 'over the i — works across the whole minor-key vamp',
techniques: ['pull-off', 'vibrato'],
source: 'the box-1 descending run — stock rock vocabulary; MusicRadar "50 rock guitar licks you need to know"; Guitar World "20 rock guitar licks"',
tab: [
{ string: 1, fret: 8 }, // C — ♭3
{ string: 1, fret: 5, technique: 'pull-off' }, // A — root
{ string: 2, fret: 8 }, // G — ♭7
{ string: 2, fret: 5, technique: 'pull-off' }, // E — 5
{ string: 3, fret: 7 }, // D — 4
{ string: 3, fret: 5, technique: 'pull-off' }, // C — ♭3
{ string: 4, fret: 7, technique: 'vibrato' }, // A — root, an octave down: land it
],
},
],
}
+16
View File
@@ -6,3 +6,19 @@ body {
color: #f5f5f5;
font-family: system-ui, -apple-system, sans-serif;
}
/* Thin, dark, overlay-feel scrollbars for the jam dashboard's scrollers
(dashboard-polish.md §4). Scoped (a class), NOT global the KnowledgeDock /
Debug / Tuner / Settings keep the OS default. Raw hex is unavoidable here:
::-webkit-scrollbar pseudo-elements are not reachable by Tailwind utilities;
the values mirror the design tokens (border #2a2a2a, panel #1a1a1a). */
.dark-scroll {
scrollbar-width: thin; /* Firefox */
scrollbar-color: #2a2a2a transparent; /* thumb = border token · track transparent */
}
.dark-scroll::-webkit-scrollbar { width: 8px; height: 8px; } /* WebKit/Blink */
.dark-scroll::-webkit-scrollbar-track { background: transparent; }
.dark-scroll::-webkit-scrollbar-thumb {
background: #2a2a2a; border-radius: 4px; /* border token */
}
.dark-scroll::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
+304
View File
@@ -0,0 +1,304 @@
// ─── Chord audio preview engine (L-20) ────────────────────────────────────────
//
// A pure, React-free Web Audio module that AUDITIONS voicings — the sound behind
// the ▶ buttons in the Voicing Browser (D-21) and anywhere else the Knowledge
// Center wants a chord heard, not just seen.
//
// It owns ONE module-level, lazily-created AudioContext, spun up on the first
// play call (which, in the UI, is always a user gesture — required by browser
// autoplay policy). It NEVER touches the detection pipeline: no import from
// AudioCapture.jsx, audioService.js, or App.jsx, no analyser, no microphone.
// Playback goes straight to the speakers on its own context.
//
// ── ⚠ MIC-FEEDBACK CAVEAT (read before wiring a UI) ───────────────────────────
// This module plays chords out of the speakers. While the mic is live, the
// DETECTION pipeline (pitch + chroma analysers in AudioCapture) will HEAR this
// playback like any other sound in the room — a previewed voicing can vote into
// chord/key detection and pollute the session. UI callers should pause or
// ignore detection for the duration of a preview (roughly the `durMs` window
// after the last strummed note). Wiring that suppression is a FUTURE task —
// this module deliberately stays decoupled and just makes sound.
//
// ── Note space ────────────────────────────────────────────────────────────────
// All play functions take notes in the piano.js convention: absolute semitone
// positions where 0 = the C of the low displayed octave = C3 = MIDI 48
// (130.81 Hz). `pianoVoicing().notes` (036) drops straight in. Guitar shapes
// reach BELOW that anchor (open low E = E2 = MIDI 40 = note 8); negative
// values are legal input to `playVoicing` — only the renderers care about the
// 036 window, the synth maps any integer to its true frequency.
//
// ── Tone ──────────────────────────────────────────────────────────────────────
// Per note: two slightly-detuned triangle oscillators (a little chorus warmth)
// plus a quiet sine an octave up (shimmer), through a lowpass and a gain
// envelope (~20 ms soft attack, exponential release inside `durMs`). Simple,
// pleasant, no samples. A master compressor guards against clipping when many
// notes ring together.
// ─── Module state (the ONE lazy AudioContext) ─────────────────────────────────
let ctx = null // dedicated AudioContext — created on first play call only
let master = null // master gain → compressor → destination
const active = new Set() // live note handles: { g, oscs } — for stopAll()
const ATTACK_S = 0.02 // soft attack
const TAIL_S = 0.06 // oscillator stop margin after the envelope floor
const ENV_FLOOR = 0.0001 // exponential ramps can't reach 0
const MAX_NOTES = 12 // defensive cap on simultaneous scheduled notes
function ensureContext() {
if (!ctx) {
const AC = globalThis.AudioContext || globalThis.webkitAudioContext
if (!AC) throw new Error('chordAudio: Web Audio API not available in this environment')
ctx = new AC()
master = ctx.createGain()
master.gain.value = 0.9
const comp = ctx.createDynamicsCompressor()
comp.threshold.value = -18
comp.knee.value = 24
comp.ratio.value = 4
master.connect(comp)
comp.connect(ctx.destination)
}
// A suspended context (autoplay policy) resumes on the user-gesture play call.
if (ctx.state === 'suspended') ctx.resume()
return ctx
}
// ─── Pitch math ───────────────────────────────────────────────────────────────
const mod12 = (n) => ((n % 12) + 12) % 12
/**
* noteToFreq(note) frequency in Hz.
*
* `note` is an absolute position in the piano.js space (0 = C3 = MIDI 48).
* Pure helper exported so tests can verify the mapping without an
* AudioContext. noteToFreq(0) 130.81 (C3), noteToFreq(21) = 440 (A4).
*/
export function noteToFreq(note) {
return 440 * Math.pow(2, (note + 48 - 69) / 12)
}
// ─── Synthesis ────────────────────────────────────────────────────────────────
// Schedule one note: detuned triangle pair + octave sine → lowpass → envelope.
function scheduleNote(note, when, durMs, peakGain) {
const freq = noteToFreq(note)
const durS = Math.max(0.1, durMs / 1000)
const g = ctx.createGain()
g.gain.setValueAtTime(ENV_FLOOR, when)
g.gain.linearRampToValueAtTime(peakGain, when + ATTACK_S)
g.gain.exponentialRampToValueAtTime(ENV_FLOOR, when + durS)
const lp = ctx.createBiquadFilter()
lp.type = 'lowpass'
lp.frequency.value = Math.min(freq * 7, 5500) // keep it warm, not raw
lp.Q.value = 0.4
const partials = [
{ type: 'triangle', ratio: 1, detune: 0, level: 1.0 },
{ type: 'triangle', ratio: 1, detune: 6, level: 0.35 }, // +6 cents chorus
{ type: 'sine', ratio: 2, detune: 0, level: 0.18 }, // octave shimmer
]
const oscs = partials.map((p) => {
const osc = ctx.createOscillator()
osc.type = p.type
osc.frequency.value = freq * p.ratio
osc.detune.value = p.detune
const og = ctx.createGain()
og.gain.value = p.level
osc.connect(og)
og.connect(lp)
osc.start(when)
osc.stop(when + durS + TAIL_S)
return osc
})
lp.connect(g)
g.connect(master)
const handle = { g, oscs }
active.add(handle)
oscs[0].onended = () => active.delete(handle) // GC the handle when done
return handle
}
// Release one handle now (quick fade, then hard-stop the oscillators).
function releaseHandle(handle, now) {
try {
handle.g.gain.cancelScheduledValues(now)
handle.g.gain.setValueAtTime(Math.max(handle.g.gain.value, ENV_FLOOR), now)
handle.g.gain.linearRampToValueAtTime(ENV_FLOOR, now + 0.04)
for (const osc of handle.oscs) osc.stop(now + TAIL_S)
} catch {
// node already stopped — nothing to release
}
active.delete(handle)
}
// ─── Public API ───────────────────────────────────────────────────────────────
/**
* playVoicing(notes, opts?) { stop() }
*
* Plays a voicing the primary entry point. `notes` are absolute positions in
* the piano.js space (0 = C3 = MIDI 48; `pianoVoicing().notes` drops straight
* in; `guitarShapeToNotes(...)` output too, including its below-C3 negatives).
*
* @param {number[]} notes absolute semitone positions (0 = C3)
* @param {{strumMs?: number, durMs?: number, gain?: number}} [opts]
* strumMs stagger between note onsets, lowhigh (default 30; 0 = block chord)
* durMs each note's envelope length (default 1800)
* gain overall loudness 01 (default 0.5), split across the notes
* @returns {{ stop: () => void }} releases just THIS chord (stopAll() gets everything)
*
* First call creates the AudioContext call from a user gesture (click).
*/
export function playVoicing(notes, opts = {}) {
const { strumMs = 30, durMs = 1800, gain = 0.5 } = opts
const clean = [...new Set((Array.isArray(notes) ? notes : []).filter(Number.isFinite))]
.sort((a, b) => a - b)
.slice(0, MAX_NOTES)
if (clean.length === 0) return { stop() {} }
ensureContext()
const now = ctx.currentTime
// Split the chord's loudness across its voices (sqrt: correlated-ish summing).
const perNote = Math.min(0.6, gain / Math.sqrt(clean.length))
const handles = clean.map((note, i) =>
scheduleNote(note, now + (i * strumMs) / 1000, durMs, perNote)
)
return {
stop() {
if (!ctx) return
const t = ctx.currentTime
for (const h of handles) releaseHandle(h, t)
},
}
}
// Standard-tuning open-string MIDI numbers, strings [s6 … s1] = E2 A2 D3 G3 B3 E4.
// (voicings.js' OPEN holds the same strings as pitch classes; here we need real
// octaves to make sound, so the octaved values live here — same tuning, same order.)
const OPEN_STRING_MIDI = [40, 45, 50, 55, 59, 64]
/**
* guitarShapeToNotes(shape, opts?) number[]
*
* Maps a guitar voicing to the shared absolute-note space (0 = C3 = MIDI 48) so
* guitar shapes are playable via playVoicing. Low guitar strings sit BELOW C3,
* so the result can contain negatives (open low E = 8) legal for playback.
* Returns sorted, deduped notes; [] for anything unrecognisable.
*
* Accepted shapes (everything voicings.js and the lick schema produce):
* 1. `[{string, fret}, …]` note list (lick `tab` form); string 6 = low E,
* string 1 = high e; entries with a non-finite
* fret or string outside 16 are skipped.
* 2. `{frets: [s6…s1]}` absolute frets, 'x'/null = muted. This is both
* voicings.js' open form and every resolved
* `getGuitarVoicings()` entry.
* 3. `{rootStr, offsets: [s6…s1]}` voicings.js movable/barre form; offsets are
* fret distances from the root fret. Needs the
* key: pass `opts.rootPc` (011) to place it
* (falls back to shape.rootPc, then C).
*
* @param {Array|Object} shape
* @param {{rootPc?: number}} [opts] root pitch class for movable shapes
* @returns {number[]} absolute notes (may be negative), sorted lowhigh
*/
export function guitarShapeToNotes(shape, opts = {}) {
if (!shape) return []
// Form 1: [{string, fret}, …]
if (Array.isArray(shape)) {
const notes = []
for (const entry of shape) {
const s = entry?.string
const f = entry?.fret
if (!Number.isFinite(s) || s < 1 || s > 6 || !Number.isFinite(f) || f < 0) continue
notes.push(OPEN_STRING_MIDI[6 - s] + f - 48)
}
return [...new Set(notes)].sort((a, b) => a - b)
}
// Resolve the per-string absolute frets [s6…s1].
let frets = null
if (Array.isArray(shape.frets)) {
// Form 2: open shape / resolved getGuitarVoicings entry.
frets = shape.frets
} else if (Array.isArray(shape.offsets) && Number.isFinite(shape.rootStr)) {
// Form 3: movable shape — offsets relative to the root fret on rootStr.
// rootStr: 6 = low E … 1 = high e → low-E-first index is 6 rootStr
// (the same convention ChordDiagram.jsx renders with).
const idx = 6 - shape.rootStr
if (idx < 0 || idx > 5) return []
const rootPc = mod12(opts.rootPc ?? shape.rootPc ?? 0)
const openPc = mod12(OPEN_STRING_MIDI[idx])
const rootFret = mod12(rootPc - openPc)
frets = shape.offsets.map((off) => (Number.isFinite(off) ? rootFret + off : 'x'))
// Negative-offset shapes (e.g. the G shape) can dip below fret 0 near the
// nut — slide the WHOLE shape up an octave rather than dropping strings.
const finite = frets.filter(Number.isFinite)
if (finite.length && Math.min(...finite) < 0) {
frets = frets.map((f) => (Number.isFinite(f) ? f + 12 : f))
}
}
if (!frets) return []
const notes = []
for (let i = 0; i < Math.min(6, frets.length); i++) {
const f = frets[i]
if (!Number.isFinite(f) || f < 0) continue // 'x' / muted / impossible
notes.push(OPEN_STRING_MIDI[i] + f - 48)
}
return [...new Set(notes)].sort((a, b) => a - b)
}
/**
* playChord(pcs, octave?, opts?) { stop() }
*
* Simple fallback when all you have is a bare pitch-class set (e.g. a detected
* chord's tones, no voicing). Stacks the pcs ASCENDING from the first pc, which
* is treated as the bass: each subsequent pc lands in the nearest position
* above the previous note so [7, 11, 5] plays G4-B4-F5, a real shell, not a
* scrambled cluster. `octave` places the bass (4 = the octave starting at
* C4 = middle C; default 4; piano.js note = (octave 3) * 12 + pc).
*
* @param {number[]} pcs pitch classes 011, first entry = bass
* @param {number} [octave] bass octave (scientific pitch, default 4)
* @param {{strumMs?: number, durMs?: number, gain?: number}} [opts] as playVoicing
* @returns {{ stop: () => void }}
*/
export function playChord(pcs, octave = 4, opts = {}) {
const clean = (Array.isArray(pcs) ? pcs : []).filter(Number.isFinite).map(mod12)
if (clean.length === 0) return { stop() {} }
const base = (octave - 3) * 12
const notes = [base + clean[0]]
for (let i = 1; i < clean.length; i++) {
const prev = notes[i - 1]
let n = base + clean[i]
while (n <= prev) n += 12 // nearest position strictly above the last voice
notes.push(n)
}
return playVoicing(notes, opts)
}
/**
* stopAll()
*
* Immediately releases everything currently sounding or scheduled (quick 40 ms
* fade to avoid clicks, then hard-stops the oscillators). Safe to call before
* the first play (no-op) and repeatedly. Typical UI pattern: stopAll() before
* each playVoicing so previews never layer.
*/
export function stopAll() {
if (!ctx) return
const now = ctx.currentTime
for (const handle of [...active]) releaseHandle(handle, now)
active.clear()
}
+192 -7
View File
@@ -11,7 +11,7 @@
// This file is matching/position logic only. All music-theory primitives
// (note names, roman numerals) come read-only from theory.js.
import { NOTES, NOTES_FLAT, toRomanNumeral } from './theory'
import { NOTES, NOTES_FLAT, CHORD_TYPES, toRomanNumeral, canonicalize, detectRepeatingProgression } from './theory'
// ─── Chord-name parsing (local — theory.js does not export a pitch-class helper) ─
@@ -91,7 +91,9 @@ export function findLoopPosition(chordHistory, loop) {
// for each rotation, re-base so the first element is 0, then pick the
// lexicographically smallest resulting sequence. Same loop → same string,
// regardless of which chord it starts on.
function canonicalDegrees(degrees) {
// Exported additively for RelatedProgressions' ranking (task L-51,
// one-screen.md §5) — no behaviour change.
export function canonicalDegrees(degrees) {
const n = degrees.length
if (n === 0) return ''
let best = null
@@ -110,7 +112,9 @@ function canonicalDegrees(degrees) {
// Converts a loop of chord-name strings into semitone offsets from the loop's
// own first chord. Returns null if any chord root is unparseable.
function loopToDegrees(loop) {
// Exported additively for RelatedProgressions' ranking (task L-51,
// one-screen.md §5) — no behaviour change.
export function loopToDegrees(loop) {
if (!loop?.length) return null
const pcs = loop.map(chordRootPC)
if (pcs.some(pc => pc < 0)) return null
@@ -118,25 +122,108 @@ function loopToDegrees(loop) {
return pcs.map(pc => ((pc - tonic) % 12 + 12) % 12)
}
// Suffix of a KB quality token (the display suffix, '' fallback for out-of-vocab
// tokens). Name-collapse compares SUFFIXES, not raw quality tokens: two
// out-of-vocab qualities both fall back to '' and realize to equal names, so a
// token comparison would under-collapse (jam-roulette.md §3.3.2).
function suffixOfQuality(quality) {
return CHORD_TYPES[quality]?.suffix ?? ''
}
/**
* collapseProjection(progression) { degrees, qualities, rn, bars, sourceIndex }
*
* The key-free collapsed shape of a KB progression (fix (a), jam-roulette.md
* §3.3.2 / §3.3.3): dedupe adjacent stations whose (degree, suffix) pairs are
* equal, then wrap-dedupe (if the last pair equals the first, drop the last).
* The projection mirrors detection's collapsed commit stream:
* - rn : the first-of-run roman numeral
* - bars : summed per run
* - sourceIndex[i] : the first RAW station index of collapsed station i the
* remap every authored-play lookup must go through so a collapsed
* match reads the right raw play entry (JamGuide §3.3.2).
* Name-collapse is provably key-independent (§3.3.3), so this is computed once
* with no key in hand.
*/
function collapseProjection(progression) {
const degrees = Array.isArray(progression?.degrees) ? progression.degrees : []
const qualities = Array.isArray(progression?.qualities) ? progression.qualities : []
const rn = Array.isArray(progression?.rn) ? progression.rn : []
const bars = Array.isArray(progression?.bars) ? progression.bars : []
const outDeg = [], outQual = [], outRn = [], outBars = [], sourceIndex = []
for (let i = 0; i < degrees.length; i++) {
const last = outDeg.length - 1
if (last >= 0 && outDeg[last] === degrees[i] && suffixOfQuality(outQual[last]) === suffixOfQuality(qualities[i])) {
outBars[last] += bars[i] ?? 0
continue
}
outDeg.push(degrees[i])
outQual.push(qualities[i])
outRn.push(rn[i] ?? '')
outBars.push(bars[i] ?? 0)
sourceIndex.push(i)
}
// Wrap-dedupe — only the boundary pair can merge post-collapse (§3.3.2).
if (outDeg.length > 1
&& outDeg[outDeg.length - 1] === outDeg[0]
&& suffixOfQuality(outQual[outQual.length - 1]) === suffixOfQuality(outQual[0])) {
outBars[0] += outBars[outDeg.length - 1]
outDeg.pop(); outQual.pop(); outRn.pop(); outBars.pop(); sourceIndex.pop()
}
return { degrees: outDeg, qualities: outQual, rn: outRn, bars: outBars, sourceIndex }
}
/**
* Precompute a lookup table from a KB registry (kb/index.js default export).
* Returns { byCanonical: Map<canonicalDegrees, entry[]> } where each entry is
* { style, id, progression }. Build once, reuse across matches.
*
* Fix (a) (jam-roulette.md §3.3.2): each progression is indexed by its RAW
* degrees AND when the collapsed shape differs (11/56 today) by its
* collapsed form, whose `progression` is the collapsed PROJECTION (degrees /
* qualities / rn / bars / sourceIndex). Collapsed entries are appended AFTER all
* raw entries so matchLoopToProgression's strict-`>` disambiguation keeps every
* previously-matching input's winner on ties (behaviour-preserving except the
* one enumerated strict win, country-145 its own collapsed form). This makes
* a detected COLLAPSED loop (the live commit stream dedupes back-to-back chords)
* match its progression repairing a pre-existing live-detection miss for real
* 12-bar / 8-bar streams and enabling the roulette seed to populate the guide.
*/
export function buildLoopIndex(kb) {
const byCanonical = new Map()
if (!kb) return { byCanonical }
const add = (canon, entry) => {
if (!byCanonical.has(canon)) byCanonical.set(canon, [])
byCanonical.get(canon).push(entry)
}
const collapsedPending = []
for (const style of Object.keys(kb)) {
const progs = kb[style]?.progressions
if (!Array.isArray(progs)) continue
for (const progression of progs) {
if (!Array.isArray(progression.degrees) || !progression.degrees.length) continue
const canon = canonicalDegrees(progression.degrees)
const entry = { style, id: progression.id, progression }
if (!byCanonical.has(canon)) byCanonical.set(canon, [])
byCanonical.get(canon).push(entry)
add(canonicalDegrees(progression.degrees), { style, id: progression.id, progression })
// Collapsed-form entry — only when the collapsed shape differs (a run
// collapse strictly shortens length, so a length change ⇔ a real collapse).
const proj = collapseProjection(progression)
if (proj.degrees.length && proj.degrees.length !== progression.degrees.length) {
const collapsedProg = {
...progression,
degrees: proj.degrees,
qualities: proj.qualities,
rn: proj.rn,
bars: proj.bars,
sourceIndex: proj.sourceIndex,
}
collapsedPending.push({
canon: canonicalDegrees(proj.degrees),
entry: { style, id: progression.id, progression: collapsedProg },
})
}
}
}
// Append collapsed entries after ALL raw entries (the tie-preservation invariant).
for (const { canon, entry } of collapsedPending) add(canon, entry)
return { byCanonical }
}
@@ -195,6 +282,10 @@ export function matchLoopToProgression(loop, kbOrIndex) {
matched: true,
id: best.id,
style: best.style,
// For a collapsed-form hit best.progression.degrees IS the collapsed shape
// (equal length to the loop by construction, fix (a)), so rotation is
// computed against the collapsed degrees — the length-mismatch guard never
// silently returns 0 for a genuine collapsed match (jam-roulette.md §3.3.2).
rotation: rotationToCanonicalOrder(degrees, best.progression.degrees),
progression: best.progression,
}
@@ -220,6 +311,100 @@ function rotationToCanonicalOrder(loopDegrees, kbDegrees) {
return 0
}
// ─── Jam Roulette — seed realization + the seedable pool (task L-60) ──────────
//
// jam-roulette.md §3.2 / §2.2. The seed writes the exact loop detection would
// commit when the band plays this progression in the rolled key, so the L-31
// commit layer treats it like any committed loop.
/**
* seedableLoop(progression, keyRootPc) string[] | null
*
* Realize collapse (+ wrap-dedupe) canonicalize (§3.2):
* 1. Realize each station in the rolled key with SHARP spellings (§2.1 only
* sharp names string-match live detection's noteName path).
* 2. Collapse consecutive duplicate NAMES, then drop the last if it equals the
* first (the cyclic wrap the loop's tail flows into its head live).
* 3. Canonicalize the rotation with theory.js's own rule, so the seeded string
* equals detectRepeatingProgression's canonical output exactly (the L-31
* agreement branch compares join(',') strings).
* Returns null when the collapsed loop has < 2 names (unrepresentable as a
* detected loop detectRepeatingProgression's min pattern length is 2).
*/
export function seedableLoop(progression, keyRootPc) {
const degrees = Array.isArray(progression?.degrees) ? progression.degrees : []
const qualities = Array.isArray(progression?.qualities) ? progression.qualities : []
if (!degrees.length) return null
const names = degrees.map((deg, i) => {
const rootPc = (((keyRootPc + deg) % 12) + 12) % 12
return NOTES[rootPc] + suffixOfQuality(qualities[i])
})
const collapsed = names.filter((n, i) => i === 0 || n !== names[i - 1])
if (collapsed.length > 1 && collapsed[0] === collapsed[collapsed.length - 1]) collapsed.pop()
if (collapsed.length < 2) return null
return canonicalize(collapsed)
}
/**
* roundTripPasses(canonicalForm) boolean (jam-roulette.md §2.2)
*
* The pool gate: a progression is confirmable iff, with a 32-commit window
* filled with repetitions of its seeded canonical form (steady state) and
* truncated at EVERY partial-cycle offset (0len1), detectRepeatingProgression
* returns exactly that form at ALL offsets. Steady-state-plus-all-offsets is the
* honest protocol a jam is sampled mid-cycle, not at cycle boundaries, and a
* naive "2 clean cycles" feed gets both failure modes wrong (§2.2). Hard length
* bounds 28 (the detector only sweeps those lengths) are part of the gate.
* Key-independent (§3.3.3): the detector consumes only the name stream's
* equality structure, so one sweep in any key (the pool builds in C) covers all.
*/
export function roundTripPasses(canonicalForm) {
if (!Array.isArray(canonicalForm)) return false
const len = canonicalForm.length
if (len < 2 || len > 8) return false
const WINDOW = 32
const target = canonicalForm.join(',')
for (let offset = 0; offset < len; offset++) {
const history = []
for (let k = 0; k < WINDOW; k++) history.push(canonicalForm[(offset + k) % len])
const detected = detectRepeatingProgression(history)
if (!detected || detected.join(',') !== target) return false
}
return true
}
// Lazy module-level memo (§2.2): one sweep on first roulette open, reused for
// every roll. Key-independent, so the pool is computed once in C.
let _roulettePoolMemo = null
/**
* buildRoulettePool(kb) { byStyle: Map<style, member[]> }
* member = { style, id, progression, collapsedLen }
*
* The roulette pool (§2.2): per style, the progressions whose seedable canonical
* form passes the round-trip invariant AND lands in the 28 length bounds. An
* 11th style or a new progression joins automatically. Randomization (weighting,
* no-repeat memory, key) lives in the caller (App.rollJam) this is the pure,
* audio-free eligibility set.
*/
export function buildRoulettePool(kb) {
if (_roulettePoolMemo) return _roulettePoolMemo
const byStyle = new Map()
for (const style of Object.keys(kb ?? {})) {
const progs = kb[style]?.progressions
if (!Array.isArray(progs)) { byStyle.set(style, []); continue }
const eligible = []
for (const progression of progs) {
const form = seedableLoop(progression, 0) // key C — key-independent (§3.3.3)
if (!form || !roundTripPasses(form)) continue
eligible.push({ style, id: progression.id, progression, collapsedLen: form.length })
}
byStyle.set(style, eligible)
}
_roulettePoolMemo = { byStyle }
return _roulettePoolMemo
}
// ─── Roman-numeral helpers (re-exported for callers that only need matching) ───
/**
+417
View File
@@ -0,0 +1,417 @@
// ─── Piano voicing resolver (L-10) ────────────────────────────────────────────
//
// A pure, deterministic module that generates piano voicings from a chord, for
// the Jam Guide's piano instrument tab (GOAL G4: "generate piano voicings from
// interval recipes rather than data files — root position, inversions, shells
// (1-3-7), rootless A (3-5-7-9) / B (7-9-3-5) — choosing the inversion that
// minimizes movement from the previous chord").
//
// Built on the SAME chord model the rest of the app uses: a chord is
// { rootPc, quality } where `rootPc` is a pitch class 011 and `quality` is a
// CHORD_TYPES key (one of the 14: maj, min, dom7, maj7, min7, dim, dim7,
// half_dim, aug, sus4, sus2, maj6, min6, add9). This is exactly what
// match.js exposes (`chordRootPC` + a quality token) and what KB stations carry
// (`degrees[i]` + `qualities[i]`), so a caller maps a station → a voicing with
// no string parsing. Intervals come straight from CHORD_TYPES — never redefined.
//
// No globals, no Date, no random. Same input → same output, always.
//
// ─── The `notes` reference convention (READ THIS — D-10/L-11 render against it) ─
//
// `notes` are ABSOLUTE semitone positions for placing keys on a keyboard, NOT
// pitch classes. The reference point is:
//
// 0 = C of the displayed LOW octave.
//
// So a value of `n` means "the key `n` semitones above that low C". A renderer
// drawing ~23 octaves (MiniPiano, D-10) maps note value `n` to key index `n`
// from the left edge of its low C. Examples in C (rootPc 0):
//
// C-major root-position triad → notes [0, 4, 7] (C E G, low octave)
// Cmaj7 root-position → notes [0, 4, 7, 11] (C E G B)
// Cmaj7 shell (R-3-7) → notes [0, 4, 11]
// Dm7 rootless A (3-5-7-9) → notes [17, 21, 24, 28] (F A C E, lifted a register)
//
// Rootless and shell voicings deliberately sit HIGHER than root position so they
// read as right-hand comping shapes — the resolver lifts them by one octave (+12)
// from the root anchor by default (the LH would supply the root). `bass` is the
// lowest sounding note of whatever was produced, so a renderer can mark the LH
// anchor distinctly. All note values are ≥ 0 and span ≤ ~3 octaves (036), so a
// keyboard of 3 octaves always contains every voicing this module emits.
//
// `pcs` are the pitch classes (011) actually sounding — for highlighting which
// keys light up in every octave, and for validation.
//
// ─── The tone-set contract (what counts as a "correct" pc — READ for C-10) ─────
//
// For root-position and shell voicings, every pc is a strict chord tone:
// pcs ⊆ { (rootPc + i) mod 12 | i ∈ CHORD_TYPES[quality].intervals }, and the
// defining tones (the 3rd, and the true 7th when the chord has one) are present.
//
// Rootless A/B voicings additionally carry the **9th** — the defining colour of
// a rootless jazz voicing (the "9" in 3-5-7-9 / 7-9-3-5). The 9th (a 2nd up an
// octave, pc = rootPc+2) is an EXTENSION, not a member of the bare triad/7th
// interval set, so it is a *deliberate, consonant* added tone — never a "wrong
// note". The full legitimate tone set for a quality is therefore the chord tones
// PLUS the natural 9th, exported as `voicingToneSet(rootPc, quality, style)` so a
// validator (C-10) checks `pcs ⊆ voicingToneSet(...)` rather than the bare triad.
// No voicing this module emits ever contains a pc outside that set.
import { CHORD_TYPES, guideTones } from './theory'
// ─── Internals ────────────────────────────────────────────────────────────────
const mod12 = (n) => ((n % 12) + 12) % 12
// Resolve a quality to its CHORD_TYPES entry, defaulting to maj for anything odd.
function chordType(quality) {
return CHORD_TYPES[quality] ?? CHORD_TYPES.maj
}
// The chord's interval set (semitones from root), e.g. dom7 → [0,4,7,10].
function chordIntervals(quality) {
return chordType(quality).intervals
}
// Does this quality carry a TRUE 7th (a minor or major 7th — interval 10 or 11)?
// This mirrors theory.guideTones' honest `hasSeventh` (NOT "length >= 4": add9
// [0,2,4,7] and maj6/min6 [0,4,7,9] are 4-tone chords with no real 7th).
function seventhInterval(quality) {
return chordIntervals(quality).find((i) => i === 10 || i === 11)
}
// The 3rd interval. CHORD_TYPES index 1 is the 3rd for triad/7th qualities, but
// sus2 [0,2,7] / sus4 [0,5,7] have a 2nd/4th there instead — there is no 3rd, so
// we report the suspension tone as the "3rd-slot" colour (what the voicing uses
// where a 3rd would go). add9's index 1 is its 9th (pc+2), so we pick the actual
// major/minor 3rd (interval 3 or 4) when the set has one, else the index-1 tone.
function thirdInterval(quality) {
const ints = chordIntervals(quality)
const real = ints.find((i) => i === 3 || i === 4) // minor or major 3rd
if (real !== undefined) return real
return ints[1] // sus2 → 2, sus4 → 5 (the suspension stands in for the 3rd)
}
// The 5th interval the chord actually contains: perfect 5th (7) when present,
// else the altered 5th (♭5=6 for dim/dim7/half_dim, #5=8 for aug).
function fifthInterval(quality) {
const ints = chordIntervals(quality)
if (ints.includes(7)) return 7
if (ints.includes(6)) return 6
if (ints.includes(8)) return 8
return 7
}
// The 9th colour for rootless voicings: a 9th is a 2nd up an octave (interval 2
// or 14). add9 already lists 2; otherwise we synthesize the natural 9th (14)
// from the root — rootless A/B want a 9th on top whether or not the chord names
// one. (For min6/maj6 we use the 6th as the rootless "colour" instead — see
// rootlessColours below.)
const NINTH = 14
// ─── Voicing builders ─────────────────────────────────────────────────────────
//
// Each builder returns { pcs, intervalsFromRoot, style, label } where
// `intervalsFromRoot` are signed semitone offsets from the chord root in the
// builder's own register (root position low; shell/rootless lifted +12). The
// register is then optimized for voice-leading in placeVoicing().
// Root position: every chord tone stacked from the root, low register (root @ 0).
function buildRoot(rootPc, quality) {
const ints = chordIntervals(quality)
return {
intervalsFromRoot: [...ints],
pcs: ints.map((i) => mod12(rootPc + i)),
style: 'root',
label: `root position (${labelFor(ints)})`,
}
}
// Shell: the skeleton a comping pianist plays — root + 3rd + 7th for a 7th chord,
// root + 3rd + 5th for a triad (no 7th to thin to). Lifted +12 (RH shape; LH
// would double the root). For sus chords the "3rd" is the suspension tone.
function buildShell(rootPc, quality) {
const seventh = seventhInterval(quality)
const third = thirdInterval(quality)
let ints
let kind
if (seventh !== undefined) {
ints = [0, third, seventh] // R-3-7 (the true shell)
kind = 'R-3-7'
} else {
ints = [0, third, fifthInterval(quality)] // triad shell R-3-5
kind = 'R-3-5'
}
const lifted = ints.map((i) => i + 12)
return {
intervalsFromRoot: lifted,
pcs: ints.map((i) => mod12(rootPc + i)),
style: 'shell',
label: `shell (${kind})`,
}
}
// The 3-5-7-9 / 7-9-3-5 colour tones for a rootless voicing.
// For a true-7th chord: use 3, 5, the real 7th, and the 9th (14).
// For maj6/min6 (no 7th): treat the 6th (9) as the upper colour in the 7-slot —
// GOAL: "min6/maj6 treat the 6th as the 13th-ish color or fall back gracefully".
// For triads/sus/add9 (no 7th): there is no rootless 3-5-7-9 — degrade to a
// 3-5-9 colour shape and SAY SO in the label.
function rootlessColours(quality) {
const third = thirdInterval(quality)
const fifth = fifthInterval(quality)
const seventh = seventhInterval(quality)
const ints = chordIntervals(quality)
if (seventh !== undefined) {
return { third, fifth, seventh, ninth: NINTH, full: true, note: '3-5-7-9' }
}
// maj6 / min6 — the 6th (interval 9) stands in for the 7-slot colour.
if (ints.includes(9) && (quality === 'maj6' || quality === 'min6')) {
return { third, fifth, seventh: 9, ninth: NINTH, full: true, note: '3-5-6-9' }
}
// triad / sus / add9 — no 7th and no 6th: a 3-5-9 colour shape (no 7-slot).
return { third, fifth, seventh: null, ninth: NINTH, full: false, note: '3-5-9' }
}
// Rootless A — voiced low-to-high 3-5-7-9 (the standard "A" form). Lifted +12.
function buildRootlessA(rootPc, quality) {
const c = rootlessColours(quality)
const ints = (c.full ? [c.third, c.fifth, c.seventh, c.ninth] : [c.third, c.fifth, c.ninth])
.map((i) => i + 12)
ints.sort((a, b) => a - b)
return {
intervalsFromRoot: ints,
pcs: ints.map((i) => mod12(rootPc + i)),
style: 'rootlessA',
label: c.full
? `rootless A (${c.note})`
: `rootless A — no 7th, ${c.note} colour`,
}
}
// Rootless B — voiced 7-9-3-5: the SAME four colour tones, but with the 7th & 9th
// in the lower octave and the 3rd & 5th in the upper, so the shape inverts. We
// build it by placing 7 & 9 at +12 and 3 & 5 at +24 (a register higher), which
// is what makes A and B alternate cleanly down a chain. Falls back like A.
function buildRootlessB(rootPc, quality) {
const c = rootlessColours(quality)
let ints
if (c.full) {
ints = [c.seventh + 12, c.ninth + 12, c.third + 24, c.fifth + 24]
} else {
// no true 7th: 9 below, 3 & 5 above — a 9-3-5 inversion of the A fallback.
ints = [c.ninth + 12, c.third + 24, c.fifth + 24]
}
ints.sort((a, b) => a - b)
return {
intervalsFromRoot: ints,
pcs: ints.map((i) => mod12(rootPc + i)),
style: 'rootlessB',
label: c.full
? `rootless B (7-9-3-5)`
: `rootless B — no 7th, 9-3-5 colour`,
}
}
// Human label for a root-position interval set, e.g. [0,4,7,10] → "R-3-5-♭7".
function labelFor(ints) {
const NAME = {
0: 'R', 1: '♭9', 2: '9', 3: '♭3', 4: '3', 5: '4', 6: '♭5',
7: '5', 8: '♯5', 9: '6', 10: '♭7', 11: '7',
}
return ints.map((i) => NAME[mod12(i)] ?? `${i}`).join('-')
}
// ─── Voice-leading placement ──────────────────────────────────────────────────
//
// Given a voicing's pitch classes and a `prev` notes array, choose the absolute
// register (which octave each pc lands in) that MINIMIZES total voice-leading
// movement from prev — the sum, over each voice, of the nearest-semitone
// distance to its closest prev note.
//
// ALGORITHM (documented):
// 1. The builder gives `intervalsFromRoot` — a register-anchored shape. We keep
// that internal voicing SHAPE (its inversion/spread) intact, and only slide
// the whole shape up or down by whole octaves to sit nearest to prev. This
// preserves the chosen voicing identity (a shell stays a shell) while still
// voice-leading the progression smoothly.
// 2. For each candidate octave offset k ∈ {-2..+2} (×12), shift every note by
// 12k, keep it inside the renderable window [0, 36], and score it: for each
// shifted note find min |note p| over all p in prev (nearest-voice
// distance), and sum. Lowest total wins. Ties → the offset closest to the
// builder's default register (k nearest 0), keeping output stable/low.
// 3. With no prev, we don't shift — the builder's default register is used, so
// the FIRST chord of a progression voices at a predictable height and every
// subsequent chord threads from it.
//
// This is per-shape octave optimization, not per-voice re-inversion: it's
// deterministic, cheap, and gives the smooth "shape glides to meet the last
// chord" motion the design wants without scrambling the voicing's character.
function placeVoicing(base, rootPc, prev) {
// Absolute notes in the builder's default register (anchor: low C = 0).
const def = base.intervalsFromRoot.map((i) => mod12(rootPc) + i)
if (!Array.isArray(prev) || prev.length === 0) {
return clampWindow(def)
}
let bestNotes = null
let bestCost = Infinity
let bestK = 0
for (let k = -2; k <= 2; k++) {
const shifted = def.map((n) => n + 12 * k)
if (shifted.some((n) => n < 0 || n > 36)) continue
let cost = 0
for (const n of shifted) {
let nearest = Infinity
for (const p of prev) nearest = Math.min(nearest, Math.abs(n - p))
cost += nearest
}
// Prefer lower cost; tie-break toward the default register (smaller |k|).
if (cost < bestCost || (cost === bestCost && Math.abs(k) < Math.abs(bestK))) {
bestCost = cost
bestNotes = shifted
bestK = k
}
}
return clampWindow(bestNotes ?? def)
}
// Keep a voicing inside the renderable window [0, 36] (≤3 octaves) by sliding it
// by whole octaves if it pokes out — never reshapes, only translates.
function clampWindow(notes) {
let out = [...notes]
while (Math.min(...out) < 0) out = out.map((n) => n + 12)
while (Math.max(...out) > 36) out = out.map((n) => n - 12)
return out.sort((a, b) => a - b)
}
// ─── Public API ───────────────────────────────────────────────────────────────
const BUILDERS = {
root: buildRoot,
shell: buildShell,
rootlessA: buildRootlessA,
rootlessB: buildRootlessB,
}
// Default voicing style: shells for 7th chords (the comping skeleton), root
// position for plain triads / sus / add9 / 6 chords (nothing to thin to a shell).
function defaultStyle(quality) {
return seventhInterval(quality) !== undefined ? 'shell' : 'root'
}
/**
* pianoVoicing({ rootPc, quality }, opts?) voicing
*
* Generates a single piano voicing for a chord.
*
* @param {{rootPc:number, quality:string}} chord
* rootPc 011; quality is a CHORD_TYPES key.
* @param {{ style?: 'root'|'shell'|'rootlessA'|'rootlessB', prev?: number[] }} [opts]
* style force a voicing type (else default: shell for 7ths, root else).
* prev the previous voicing's `notes`; when given, the register is
* chosen to minimize total voice-leading movement from it.
*
* @returns {{
* notes: number[], // absolute key positions (0 = C of low octave; see header)
* pcs: number[], // pitch classes 011 sounding (subset of chord tones)
* bass: number, // lowest sounding note (LH anchor)
* style: string, // 'root' | 'shell' | 'rootlessA' | 'rootlessB'
* label: string, // e.g. "rootless A (3-5-7-9)"
* }}
*
* Inline sanity (verified):
* pianoVoicing({rootPc:0, quality:'maj7'}, {style:'shell'}).pcs {0,4,11} (C-E-B)
* pianoVoicing({rootPc:2, quality:'min7'}, {style:'rootlessA'}).pcs {5,9,0,4} = F-A-C-E
* pianoVoicing({rootPc:7, quality:'dom7'}, {style:'shell'}).pcs {7,11,5} (G-B-F)
* pianoVoicing({rootPc:9, quality:'aug'}).pcs {9,1,5} (A-C-F)
* pianoVoicing({rootPc:0, quality:'sus4'}).pcs {0,5,7} (C-F-G)
* pianoVoicing({rootPc:0, quality:'add9'}).pcs {0,2,4,7} (C-D-E-G)
* A iiVI threaded with `prev` (Dm7G7Cmaj7, all shells) keeps each chord's
* octave register near the last small total semitone motion (voice-led).
*/
export function pianoVoicing(chord, opts = {}) {
const rootPc = mod12(chord?.rootPc ?? 0)
const quality = CHORD_TYPES[chord?.quality] ? chord.quality : 'maj'
const style = BUILDERS[opts.style] ? opts.style : defaultStyle(quality)
const base = BUILDERS[style](rootPc, quality)
const placed = placeVoicing(base, rootPc, opts.prev)
// Dedupe ABSOLUTE notes: two voices can collide on one key (e.g. a forced
// rootless sus2 lands the suspended-2nd "3rd-slot" tone and the synthesized
// 9th on the same absolute key, pc 2 → notes [26,26,31]). A duplicate value
// would stack two highlights on one key in the renderer, so we drop the
// redundant collided note here — the single point every style/quality flows
// through — keeping the first occurrence. A no-op when nothing collides.
const notes = [...new Set(placed)]
// pcs in the voiced order (low→high), deduped — what keys light up.
const pcs = [...new Set(notes.map((n) => mod12(n)))]
return {
notes,
pcs,
bass: Math.min(...notes),
style,
label: base.label,
}
}
/**
* pianoVoicingChain(chords, opts?) voicing[]
*
* Convenience: voice a whole progression with voice-leading threading. Each
* chord after the first is placed to minimize movement from the previous chord's
* `notes`, so a iiVI (or any loop) glides smoothly. `chords` is an array of
* { rootPc, quality }. `opts.style` (optional) forces one style for the chain;
* otherwise each chord uses its own default. Returns the voicings in order.
*
* D-10/L-11 can call this once per loop to lay out a synced row of MiniPianos.
*/
export function pianoVoicingChain(chords, opts = {}) {
if (!Array.isArray(chords)) return []
const out = []
let prev = null
for (const chord of chords) {
const v = pianoVoicing(chord, { style: opts.style, prev })
out.push(v)
prev = v.notes
}
return out
}
// Re-export the chord-model helper the resolver leans on, so a consumer can ask
// "does this chord have a true 7th?" without re-importing theory (handy for
// MiniPiano deciding whether to offer rootless A/B toggles).
export function hasTrueSeventh(quality) {
return seventhInterval(quality) !== undefined
}
/**
* voicingToneSet({ rootPc, quality }, style?) Set<number> of legal pitch classes.
*
* The complete set of pcs a voicing of this chord may legitimately sound the
* correctness reference for validation (C-10). It is the chord's strict tones
* (rootPc + each CHORD_TYPES interval); for rootless styles it ALSO includes the
* natural 9th (rootPc+2) and, for maj6/min6, the 6th (already a chord tone) used
* as the upper colour. Any `pianoVoicing(...).pcs` is guaranteed this set.
*
* Pass `style` to scope it (root/shell never add the 9th); omit `style` to get
* the widest legal set (tones + 9th) handy as a one-shot "no wrong notes" gate.
*/
export function voicingToneSet({ rootPc, quality } = {}, style) {
const r = mod12(rootPc ?? 0)
const q = CHORD_TYPES[quality] ? quality : 'maj'
const set = new Set(chordIntervals(q).map((i) => mod12(r + i)))
const rootless = style === 'rootlessA' || style === 'rootlessB' || style === undefined
if (rootless) set.add(mod12(r + 2)) // the rootless 9th extension
return set
}
// guideTones is re-exported so a renderer can co-highlight the 3rd/7th targets
// on the same keyboard it draws the voicing on, from one import.
export { guideTones }
+273 -26
View File
@@ -520,21 +520,65 @@ export function toRomanNumeral(chordName, keyRoot, keyMode) {
return isMinorQuality ? rn.toLowerCase() : rn
}
// ─── Repeating progression detection ─────────────────────────────────────────
// ─── Repeating progression detection ─────────────────────────────────────────
// Returns true if arr is made of a shorter repeating unit (e.g. [A,B,A,B] → true)
function isPeriodicPattern(arr) {
for (let p = 1; p <= Math.floor(arr.length / 2); p++) {
if (arr.length % p !== 0) continue
const unit = arr.slice(0, p)
if (arr.every((v, i) => v === unit[i % p])) return true
// True if arr has a "weak period" p < arr.length — i.e. arr[i] === arr[i-p] for
// every i ≥ p, meaning arr is a prefix of some p-periodic infinite sequence.
// This rejects not only exact repetitions ([A,B,A,B], p=2) but also self-overlap
// fragments/rotations of a shorter loop ([A,B,A], p=2; [C,G,Am,F,C], p=4) that
// would otherwise mint ghost candidates out of a short vamp. A genuine loop is
// never weak-periodic: a loop whose tail restates its head would produce an
// adjacent duplicate at the cycle seam, which the window collapse removes.
function hasShorterPeriod(arr) {
for (let p = 1; p < arr.length; p++) {
let periodic = true
for (let i = p; i < arr.length; i++) {
if (arr[i] !== arr[i - p]) { periodic = false; break }
}
if (periodic) return true
}
return false
}
// Match one occurrence of `cand` in `win` anchored at `start` (the first chord
// must match exactly), tolerating at most ONE edit per cycle: a substitution
// (one chord misdetected) or an insertion (one foreign chord slipped between two
// loop chords). The remainder after the edit must match exactly. Returns
// { end, matched, editPos } — `matched` = window indices that matched a loop
// chord, `editPos` = window index of the edit (-1 if the occurrence is exact) —
// or null if no match.
function matchLoopOccurrence(win, start, cand) {
if (win[start] !== cand[0]) return null
const matched = [start]
let i = start + 1
for (let j = 1; j < cand.length; j++) {
if (i >= win.length) return null
if (win[i] === cand[j]) { matched.push(i); i++; continue }
// First mismatch — the single allowed edit. Fork the two readings; each
// requires the rest of the candidate to match exactly from where it lands.
const exactFrom = (wi, cj) => {
const tail = []
for (; cj < cand.length; cj++, wi++) {
if (wi >= win.length || win[wi] !== cand[cj]) return null
tail.push(wi)
}
return { end: wi, tail }
}
const ins = exactFrom(i + 1, j) // win[i] is a foreign inserted chord
const sub = exactFrom(i + 1, j + 1) // win[i] is cand[j] misdetected
const hit = ins ?? sub // insertion keeps one more matched chord
if (!hit) return null
return { end: hit.end, matched: [...matched, ...hit.tail], editPos: i }
}
return { end: i, matched, editPos: -1 }
}
// Returns the lexicographically smallest rotation so the same loop always
// produces the same string regardless of where in the cycle we currently are.
function canonicalize(pattern) {
// Exported additively for match.js's seedableLoop / round-trip pool (task L-60,
// jam-roulette.md §3.2) — the seed must canonicalize identically to detection.
export function canonicalize(pattern) {
let best = pattern
for (let i = 1; i < pattern.length; i++) {
const rot = [...pattern.slice(i), ...pattern.slice(0, i)]
@@ -544,42 +588,75 @@ function canonicalize(pattern) {
}
/**
* detectRepeatingProgression(history) chord[] or null
* detectRepeatingProgression(history) chord[] or null (task L-30)
*
* Tests every unique subsequence of every length (not just the tail) so the
* result is stable regardless of where in the loop the musician currently is.
* Returns the canonical (rotation-normalised) form of the best pattern found.
* Finds the loop the musician is playing NOW in the recent chord history.
* Candidates are contiguous slices (lengths 28) of the last-32 window with
* consecutive duplicate commits collapsed; candidates that are self-overlaps
* of a shorter period are rejected (see hasShorterPeriod). Each candidate is
* scored by recency-weighted COVERAGE: non-overlapping occurrences are counted
* with at most one substitution or insertion per cycle, every matched chord
* adds its recency weight, every edit subtracts the weight at the edit slot.
* Linear coverage (not reps × len²) means a ghost pattern straddling noise can
* never outscore the true loop, and exponential recency decay means the current
* section outscores a longer stale one. Requires 2 EXACT occurrences: an
* edit-tolerant occurrence corroborates a loop but cannot establish it a
* loop means the sequence came back exactly, and a ghost slice that absorbs a
* noise chord into itself rarely recurs exactly (only phase-locked corruption
* of the same slot by the same chord can make one recur and such data is
* genuinely periodic at that longer length). Returns the canonical
* (rotation-normalised) best pattern.
*/
export function detectRepeatingProgression(history) {
if (!history || history.length < 6) return null
const win = history.slice(-32)
let best = null, bestScore = 0
// Collapse consecutive duplicate commits — a chord re-committed back-to-back
// is the same loop slot, not two. Non-adjacent repeats (e.g. Em … Em inside a
// 7-chord form) are meaningful and untouched.
const raw = history.slice(-32)
const win = raw.filter((c, i) => i === 0 || c !== raw[i - 1])
const n = win.length
if (n < 4) return null // shortest loop (2 chords) × 2 reps
for (let len = 2; len <= 6; len++) {
if (len * 2 > win.length) break
// Recency weight per window slot: newest chord weighs 1, each step back
// decays by 0.9 (half-life ≈ 6.6 chords).
const RECENCY = 0.9
const weight = Array.from({ length: n }, (_, i) => RECENCY ** (n - 1 - i))
let best = null
let bestScore = 0
for (let len = 2; len <= 8; len++) {
if (len * 2 > n) break
const seen = new Set()
for (let start = 0; start <= win.length - len; start++) {
for (let start = 0; start <= n - len; start++) {
const candidate = win.slice(start, start + len)
const key = candidate.join('\0')
if (seen.has(key)) continue
seen.add(key)
// A pattern that is itself a repetition of something shorter will be
// found at that shorter length — skip it here to avoid inflating scores.
if (len >= 4 && isPeriodicPattern(candidate)) continue
if (hasShorterPeriod(candidate)) continue
let reps = 0, i = 0
while (i <= win.length - len) {
if (candidate.every((c, j) => c === win[i + j])) { reps++; i += len }
else i++
let exactOccurrences = 0
let score = 0
let i = 0
while (i < n) {
const occ = matchLoopOccurrence(win, i, candidate)
// A 2-chord candidate may not take a substitution (1 matched chord is
// no evidence); insertions keep matched === len and stay allowed.
if (occ && occ.matched.length >= 2) {
if (occ.editPos < 0) exactOccurrences++
for (const p of occ.matched) score += weight[p]
if (occ.editPos >= 0) score -= weight[occ.editPos]
i = occ.end
} else {
i++
}
}
if (reps < 2) continue
if (exactOccurrences < 2) continue // implies occurrences ≥ 2
const score = reps * len * len // square length — prevents sub-patterns from beating full loop
if (score > bestScore) {
bestScore = score
best = candidate
@@ -669,3 +746,173 @@ export function transposeChord(chordName, semitones) {
export function transposeProgression(chords, semitones) {
return chords.map(c => transposeChord(c, semitones))
}
// ─── "Try this" — key-aware substitution nudge (task L-73) ────────────────────
//
// Curated, learnable chord-substitution engine for the Jam Guide dashboard.
// Spec: docs/design/try-this-subs.md §2 (the 4 category rules) + §3 (the worked
// AmCF truth-tables). For the chord under the playhead, in the detected key,
// returns up to 4 alternatives — each with one plain sentence that teaches WHY
// it works. This is NOT the context-free colour-swap grid in education.js; this
// one is key-aware and changes the root (relative / secondary dominant).
//
// All-in-module: reuses NOTES, NOTES_FLAT, noteName, noteIndex, CHORD_TYPES,
// getChordsInKey, getScale, intervalName, toRomanNumeral, chordTonePcs. It does
// NOT import match.js's chordRootPC (that would be circular) — it uses theory's
// own noteIndex(keyInfo.root) for the key root pc.
// Chord-quality families the rules branch on.
const SUB_MAJOR_FAMILY = ['maj', 'maj7', 'maj6', 'add9']
const SUB_MINOR_FAMILY = ['min', 'min7', 'min6']
// Key modes with a major tonic ("major-ish") — the only readings under which the
// borrowed-iv (Rule B) is honest. A minor/dorian/phrygian reading suppresses it.
const SUB_MAJORISH_MODES = ['major', 'lydian', 'mixolydian']
// Scale-degree vocabulary for the extension why-copy ("E is C's 3rd (the mediant)").
const DEGREE_ORDINALS = ['root', '2nd', '3rd', '4th', '5th', '6th', '7th']
const DEGREE_NAMES = ['tonic', 'supertonic', 'mediant', 'subdominant', 'dominant', 'submediant', 'leading tone']
// Name a pitch class by its scale degree in the key, e.g. "3rd (the mediant)".
// Returns null if the pc is not diatonic (Rule C never calls it off-scale).
function subDegreeWord(pc, keyRootPc, mode) {
const scale = SCALES[mode] ?? SCALES.major
const semi = ((((pc - keyRootPc) % 12) + 12) % 12)
const idx = scale.indexOf(semi)
if (idx < 0) return null
return `${DEGREE_ORDINALS[idx]} (the ${DEGREE_NAMES[idx]})`
}
/**
* suggestSubstitutions({ rootPc, quality }, keyInfo, opts = {})
* [{ rootPc, quality, label, why, category }]
*
* Categories, always in this order (softest boldest), capped at 4:
* relative · borrowed · extension · secondary_dominant
* Returns [] when there is no key (`!keyInfo?.root`) the UI shows an idle line.
*
* `label = NOTES[rootPc] + CHORD_TYPES[quality].suffix`. `opts.nextRootPc` (the
* next loop station's root pc) gates Rule D. See docs/design/try-this-subs.md §2.
*
* Sanity (AmCF loop, §3):
* F/maj (5) in A minor, next Am (9) [Dm(rel), Fmaj7(ext), E7(2nd-dom)] (no Fm)
* F/maj (5) in C major, next Am (9) [Dm, Fm(borrowed), Fmaj7, E7] (cap 4)
* Am/min(9) next C (0): Rule D = G7 ; C/maj(0) next F (5): Rule D = C7
*/
export function suggestSubstitutions({ rootPc, quality } = {}, keyInfo, opts = {}) {
if (!keyInfo?.root) return []
const keyRootPc = noteIndex(keyInfo.root)
if (keyRootPc < 0 || rootPc == null || quality == null) return []
const mode = keyInfo.mode ?? 'major'
const r = ((rootPc % 12) + 12) % 12
const origLabel = NOTES[r] + (CHORD_TYPES[quality]?.suffix ?? '')
const isMajorFam = SUB_MAJOR_FAMILY.includes(quality)
const isMinorFam = SUB_MINOR_FAMILY.includes(quality)
// Diatonic chord-name set + scale pitch-class set for the gates.
const diatonic = new Set(getChordsInKey(keyInfo.root, mode))
const scaleInts = SCALES[mode] ?? SCALES.major
const scalePcs = new Set(scaleInts.map(i => (keyRootPc + i) % 12))
const mk = (candRootPc, candQuality, why, category) => {
const pc = ((candRootPc % 12) + 12) % 12
return {
rootPc: pc,
quality: candQuality,
label: NOTES[pc] + (CHORD_TYPES[candQuality]?.suffix ?? ''),
why,
category,
}
}
const out = []
// ── Rule A — relative / diatonic-third sub (softest). Circle: inner ring. ──
// major-family → relative minor (root+9); minor-family → relative major (root+3).
// Emit only if the candidate is diatonic in the key.
{
let candRootPc = null, candQuality = null
if (isMajorFam) { candRootPc = (r + 9) % 12; candQuality = 'min' }
else if (isMinorFam) { candRootPc = (r + 3) % 12; candQuality = 'maj' }
if (candRootPc !== null) {
const label = NOTES[candRootPc] + (CHORD_TYPES[candQuality].suffix)
if (diatonic.has(label)) {
// Shared tones = intersection of the two triads (root & 3rd of the original).
const origTones = new Set(chordTonePcs(r, quality))
const shared = chordTonePcs(candRootPc, candQuality).filter(t => origTones.has(t))
const sharedNames = shared.map(t => noteName(t)).join(' & ')
const relWord = isMajorFam ? 'minor' : 'major'
const pull = isMajorFam ? 'softer' : 'brighter'
const rn = toRomanNumeral(label, keyInfo.root, mode)
out.push(mk(candRootPc, candQuality,
`${label} is ${origLabel}'s relative ${relWord} — shares ${sharedNames}. `
+ `In this key it's the ${rn}: a ${pull} pull, same family. `
+ `(Circle: its inner-ring relative.)`,
'relative'))
}
}
}
// ── Rule B — borrowed iv (the "Creep" move), conditional. NOT a circle step. ──
// Only under a major-ish reading, on the IV (root === keyRoot+5), major-family.
if (isMajorFam && SUB_MAJORISH_MODES.includes(mode) && r === (keyRootPc + 5) % 12) {
const n6 = noteName(keyRootPc + 9) // natural 6th of the key
const nb6 = noteName(keyRootPc + 8, true) // ♭6 — spelled FLAT (A→A♭, never G#)
out.push(mk(r, 'min',
`Borrow ${NOTES[r]}m (the iv) from the parallel minor — ${n6}${nb6} adds that `
+ `wistful pull home. The 'Creep' move.`,
'borrowed'))
}
// ── Rule C — extension / colour (same function, one diatonic colour tone). ──
// Vertical colour, NOT a circle step. Pick the first extension whose added tone
// is diatonic; omit the category if none qualifies.
//
// Two guards keep the suggestion an honest ALTERNATIVE, not the chord already
// sounding (the common case — jazz stations are min7/maj7/dom7):
// (a) skip any candidate whose quality === the input quality — the chord
// already carries that colour (a min7 input never re-emits min7).
// (b) minor-family offers ONLY min7. CHORD_TYPES.add9 = [0,2,4,7] is a MAJOR
// add9 (interval 4 = major 3rd), so applying it to a minor chord would
// raise the 3rd (Dm → D, F♮→F♯) = a wrong-note suggestion. Never do it.
{
let opts2 = null
if (isMajorFam) opts2 = [['maj7', 11], ['add9', 2], ['maj6', 9]]
else if (isMinorFam) opts2 = [['min7', 10]]
else if (quality === 'dom7') opts2 = [['sus4', 5]]
if (opts2) {
const pick = opts2.find(([q, interval]) =>
q !== quality && scalePcs.has((r + interval) % 12))
if (pick) {
const [extQuality, interval] = pick
const addedPc = (r + interval) % 12
const addedNote = noteName(addedPc)
const rn = toRomanNumeral(origLabel, keyInfo.root, mode)
const dw = subDegreeWord(addedPc, keyRootPc, mode)
out.push(mk(r, extQuality,
`Add the ${intervalName(interval).toLowerCase()} (${addedNote}) — same ${rn}, lusher. `
+ `${addedNote} is ${keyInfo.root}'s own ${dw}, so it stays in the family.`,
'extension'))
}
}
}
// ── Rule D — secondary dominant of the next chord (boldest). Circle move. ──
// V7 of the next loop chord = (nextRootPc+7) dom7. Requires a known next chord;
// omit when the candidate is the identical chord already sounding.
if (opts.nextRootPc != null) {
const nextPc = ((opts.nextRootPc % 12) + 12) % 12
const candRootPc = (nextPc + 7) % 12
const isSameChord = candRootPc === r && quality === 'dom7'
if (!isSameChord) {
const leadingTone = noteName(candRootPc + 4) // dom7's 3rd = ascending leading tone (SHARP)
const nextName = noteName(nextPc)
out.push(mk(candRootPc, 'dom7',
`Swap for ${NOTES[candRootPc]}7, the V7 of ${nextName} — its 3rd (${leadingTone}) leans `
+ `a half-step into ${nextName}, pulling the loop around. One step clockwise on the circle.`,
'secondary_dominant'))
}
}
return out.slice(0, 4)
}
+36 -2
View File
@@ -52,6 +52,9 @@ const GUITAR_SHAPES = {
{ label: 'Open Am7', type: 'open', onlyRoot: 9, frets: ['x',0,2,0,1,0], fingers: [0,0,2,0,1,0] },
{ label: 'Open Dm7', type: 'open', onlyRoot: 2, frets: ['x','x',0,2,1,1], fingers: [0,0,0,3,1,2] },
],
// dim intentionally stays at 2 shapes: in real guitar practice the bare
// diminished TRIAD is almost always played as dim7 or m7♭5 (which contain
// it) — a third stand-alone triad grip would be contrived. (Task P-62 audit.)
dim: [
{ label: 'A Barre', type: 'barre', rootStr: 5, offsets: ['x',0,1,2,1,'x'], fingers: [0,1,2,4,3,0] },
{ label: 'Compact', type: 'barre', rootStr: 4, offsets: ['x','x',0,1,3,1], fingers: [0,0,1,2,4,3] },
@@ -59,10 +62,16 @@ const GUITAR_SHAPES = {
dim7: [
{ label: 'Movable Box', type: 'barre', rootStr: 5, offsets: ['x',0,1,2,1,2], fingers: [0,1,2,4,3,4] },
{ label: 'Compact', type: 'barre', rootStr: 4, offsets: ['x','x',0,1,0,1], fingers: [0,0,1,2,3,4] },
// P-62: standard drop-3 dim7 with the root on the 6th string (R–♭♭7–♭3–♭5;
// e.g. G°7 = 3x232x) — jazzguitar.be diminished-chord chart shape.
{ label: 'Drop 3', type: 'barre', rootStr: 6, offsets: [0,'x',-1,0,-1,'x'], fingers: [2,0,1,3,1,0] },
],
aug: [
{ label: 'E Barre', type: 'barre', rootStr: 6, offsets: [0,3,2,1,1,0], fingers: [1,4,3,2,2,1] },
{ label: 'Compact', type: 'barre', rootStr: 5, offsets: ['x',0,3,2,2,'x'], fingers: [0,1,4,2,3,0] },
// P-62: the top-four-string aug grip (R–♯5R3; e.g. D+ = xx0332) —
// standard chord-dictionary shape, movable like the file's other D shapes.
{ label: 'D Shape', type: 'barre', rootStr: 4, offsets: ['x','x',0,3,3,2], fingers: [0,0,1,3,4,2] },
],
sus4: [
{ label: 'E Barre', type: 'barre', rootStr: 6, offsets: [0,2,2,2,0,0], fingers: [1,2,3,4,1,1], barre: { fromStr: 1, toStr: 6, fo: 0 } },
@@ -81,16 +90,34 @@ const GUITAR_SHAPES = {
half_dim: [
{ label: 'A Barre', type: 'barre', rootStr: 5, offsets: ['x',0,1,0,1,'x'], fingers: [0,1,2,0,3,0] },
{ label: 'E Barre', type: 'barre', rootStr: 6, offsets: [0,1,2,0,0,'x'], fingers: [1,2,3,1,1,0], barre: { fromStr: 2, toStr: 6, fo: 0 } },
// P-62: standard drop-3 m7♭5 with the root on the 6th string (R–♭7–♭3–♭5;
// e.g. Gø7 = 3x332x) — jazzguitar.be m7♭5 chart shape.
{ label: 'Drop 3', type: 'barre', rootStr: 6, offsets: [0,'x',0,0,-1,'x'], fingers: [2,0,3,4,1,0] },
// P-62: the one-finger-barre m7♭5 (R–♭5–♭7–♭3; e.g. Dø7 = xx0111) —
// standard chord-dictionary grip, movable.
{ label: 'D Shape', type: 'barre', rootStr: 4, offsets: ['x','x',0,1,1,1], fingers: [0,0,1,3,3,3], barre: { fromStr: 1, toStr: 3, fo: 1 } },
],
maj6: [
{ label: 'E Barre', type: 'barre', rootStr: 6, offsets: [0,2,2,1,2,0], fingers: [1,3,4,2,4,1], barre: { fromStr: 1, toStr: 6, fo: 0 } },
{ label: 'A Barre', type: 'barre', rootStr: 5, offsets: ['x',0,2,2,2,2], fingers: [0,1,2,3,4,4], barre: { fromStr: 1, toStr: 2, fo: 2 } },
// P-62: the D6 grip (R563; e.g. D6 = xx0202) — standard chord-dictionary
// shape; the swing/Western-swing four-string 6th, movable.
{ label: 'D Shape', type: 'barre', rootStr: 4, offsets: ['x','x',0,2,0,2], fingers: [0,0,1,3,1,4], barre: { fromStr: 2, toStr: 4, fo: 0 } },
],
min6: [
{ label: 'E Barre', type: 'barre', rootStr: 6, offsets: [0,2,2,0,2,0], fingers: [1,3,4,1,4,1], barre: { fromStr: 1, toStr: 6, fo: 0 } },
// P-62: the Dm6 grip (R56–♭3; e.g. Dm6 = xx0201) — standard
// chord-dictionary shape, movable.
{ label: 'D Shape', type: 'barre', rootStr: 4, offsets: ['x','x',0,2,0,1], fingers: [0,0,1,3,1,2], barre: { fromStr: 2, toStr: 4, fo: 0 } },
// P-62: the movable open-Am6 shape (R5R–♭36; x02212 open, e.g.
// Bm6 = x24344) — standard barre-chart m6 entry.
{ label: 'A Barre', type: 'barre', rootStr: 5, offsets: ['x',0,2,2,1,2], fingers: [0,1,3,3,2,4], barre: { fromStr: 3, toStr: 4, fo: 2 } },
],
add9: [
{ label: 'E Barre', type: 'barre', rootStr: 6, offsets: [0,2,4,1,0,2], fingers: [1,2,4,3,1,1], barre: { fromStr: 1, toStr: 6, fo: 0 } },
// P-62: the movable core of the standard Aadd9 chart grip (x02420 open;
// the open high-e doubling doesn't move, so it is muted here): R593.
{ label: 'A Shape', type: 'barre', rootStr: 5, offsets: ['x',0,2,4,2,'x'], fingers: [0,1,2,4,3,0] },
{ label: 'Open Cadd9', type: 'open', onlyRoot: 0, frets: ['x',3,2,0,3,0], fingers: [0,3,2,0,4,0] },
{ label: 'Open Gadd9', type: 'open', onlyRoot: 7, frets: [3,2,0,2,3,3], fingers: [2,1,0,3,4,4] },
{ label: 'Open Dadd9', type: 'open', onlyRoot: 2, frets: ['x','x',0,2,3,0], fingers: [0,0,0,1,3,0] },
@@ -504,8 +531,11 @@ export function getGuitarVoicings(chordName) {
continue
}
// barre shape: compute rootFret on rootStr
const strIdx = shape.rootStr - 1 // 0=s6 … 5=s1
// barre shape: compute rootFret on rootStr.
// OPEN is ordered [s6 … s1] and rootStr is 1-indexed with 6 = low E,
// so string N lives at index 6 - N (same convention as ChordDiagram.jsx
// and chordAudio.guitarShapeToNotes).
const strIdx = 6 - shape.rootStr // 0=s6 … 5=s1
const openPc = OPEN[strIdx]
let rootFret = (rootPc - openPc + 12) % 12
@@ -561,3 +591,7 @@ export function getPianoTechniques(chordName) {
}
export { parseChord }
// D-21: expose the raw shape library for the VoicingBrowser (read-only consumer —
// it renders shapes via ChordDiagram and plays them via chordAudio.guitarShapeToNotes).
export { GUITAR_SHAPES }
+3
View File
@@ -6,6 +6,9 @@ export default defineConfig({
plugins: [react(), tailwindcss()],
base: './', // relative paths so Electron can load files from disk
server: {
// Explicit IPv4 bind: with plain `localhost`, node ≥17 can bind ::1 only,
// which browsers/wait-on may fail to reach (seen on Windows + node 24).
host: '127.0.0.1',
port: 5173,
},
build: {