Skip to content

Studio: change the key of a piece by scale degree - #225

Merged
PhysShell merged 4 commits into
mainfrom
claude/studio-key
Nov 25, 2026
Merged

PhysShell merged 4 commits into
mainfrom
claude/studio-key

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

Adds a whole-piece option key (tonic + mode) to Studio and Studio Web: every note moves to the same scale degree of the new key, rhythm and form stay. Spec: composer-lab/STUDIO-KEY-SPEC.md.

Behaviour

  • Pitches are mapped inside compose() before fingering, so fingering, technique derivation, the minor-ninth rule, apply_ring, mute_share, octave_share and square_repeat run as for an ordinary piece.
  • The octave shift is the nearest tonic transposition (|Δ| ≤ 6), independent of note content, so rerolling one section does not move a locked one.
  • A run (one guitar, one section) that leaves 40–86 moves a whole octave; single groups are folded only when no octave fits.
  • Chords of one guitar: span limited to fretboard.SPAN; a tone a semitone or minor ninth from another moves to the nearest clearing scale tone or is dropped; unisons collapse; low clusters follow the generator rule.
  • UI "Тональность" in "Параметры пьесы" (Russian mode names, "Как в пьесе"), header shows the key, undo/redo labels; own key is stored as unset; import normalises it.
  • Unset key: output byte-identical to main.

Known costs (30 seeds × 7 keys)

  • Minor-ninth rule between guitars drops about 1.8% of notes on mode changes; same-mode transpositions are not affected.
  • About 15% of notes get different techniques than the source because legato and taps are re-derived for the new frets; about 2% of notes sound shorter or longer because of apply_ring.
  • Legato into the first note of a section is not carried over (sections are fingered separately).

Verification

  • 225 Python tests (1 skipped), 46 Node tests; web/build.py and check_site.py pass.
  • Hash regression against 552831d: 150 lines identical for unset key.
  • Reviewed by Astra 6.2 (10 findings, all fixed with regression tests) and cross-checked by Fable (2 new chord-level findings, fixed; its probe re-run after the fix shows 0 chords over the span limit and 0 semitones or minor ninths inside a chord).
  • Not checked: a real browser, a 360 px layout, real Pyodide for Studio Web.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N3gqehBgzmDPPQ4dCur7DJ

PhysShell and others added 4 commits November 24, 2026 11:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3gqehBgzmDPPQ4dCur7DJ
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3gqehBgzmDPPQ4dCur7DJ
…is pending

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3gqehBgzmDPPQ4dCur7DJ
@PhysShell
PhysShell merged commit dfbc8ce into main Nov 25, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant