Cubase-MCP-GAJ3T.MusicGen.R.../prompts/step_14.md

101 lines
5.8 KiB
Markdown

# Step 14: Reusable explicit pitch, chord and timed-attack foundation
## Objective and prerequisites
Implement the agreed hybrid notation foundation, before parsing lane text.
Read current plan, reports11-13, schemas, composer, profiles, compiler and native
Riffer validation. Preserve all prior work (dirty worktree includes accepted
0.1.1 changes). No commits, delegation, later prompts or application changes.
User wants prose for context plus precise Counts/Events/Chords/Notes lanes.
Explicit pitches/chords must never be changed to fit a key. C4=MIDI60.
Chord root octave is custom input syntax: Em4 means E4-G4-B4; Em4OverB2 or
Em4/B2 means B2 plus E4-G4-B4. Em4OverB defaults to the closest B BELOW the
upper chord's lowest pitch (B3); report that default. Slash bass must truly
be the lowest pitch; reject explicit contradictory bass octaves.
## Owned surfaces
- Small `pitch.py` (or equivalently named focused module) with typed note/chord
parsing, octave arithmetic and voicing; no new package dependency.
- Reusable strict internal explicit-attack plan in schemas.py, separate from
the legacy low-tonic monophonic PhrasePlan unless unification is demonstrably
simpler without changing existing semantics.
- compose.py for consuming that plan into actual polyphonic PitchedNotes.
- Related pitch/plan/composer/native tests and architecture docs.
- prompts/report_14.md.
Do not implement full lane parser or public score tool yet. Public generate_music
description contract remains, shared internal intent may add an optional plan.
## Required foundation
1. Typed pitch token supports A-G, optional one #/b, optional signed octave with
C4=60. No-octave tokens remain unresolved until instrument/register policy,
not silently assumed from accidental math. Reject out-of-MIDI/unsupported
spellings; preserve enharmonic numerical values.
2. Chord symbols: bare root means major; m/min means minor; explicit octave
follows quality (Em4, F#3, Bb2). Add4 should use an explicit parenthesized
form such as Em(add4) or Em4(add4), not be confused with the octave digit.
No other ambiguous quality is silently accepted. Correct octave-qualified
Over/slash bass and explicit pitch-set voicing [C3 E3 G3] are supported.
3. Tokenization must be deterministic for concatenated roots F#F#, DD, BbBb
and note run CEG later used in compact lanes. Keep a clear distinction
between whitespace token boundaries and spacing width. Avoid whole-string
musical-example hacks. Unknown/ambiguous leftovers are errors.
4. Unspecified note/chord root octave: choose the low playable root nearest
MIDI40 under the selected part profile; report the decision. Do NOT transpose
explicit notes/chords; explicit C4/E4/G4 remain exactly 60/64/67.
5. Chord default voicing: close root-position major/minor/add4 (documented
intervals), explicit slash bass prepended as lowest, deduplicate identical
pitches. If full voicing cannot fit the map/tuning, error rather than drop,
revoice arbitrarily, spread octaves or emit an incomplete chord.
6. Score representation supports exact rational start/duration, one event's
simultaneous pitch-set, technique normal/palm_mute/pinch_harmonic, optional
intensity, rest/continuation semantics at a later parsing stage.
Validate pitch uniqueness, positive duration, bounded timeline/count, and
incompatible same-pitch overlaps. Compatible polyphonic chords remain valid.
7. Composition consumes the actual explicit plan into all simultaneous notes;
preserve seed/intensity behavior and enforce total event budget on EXPANDED
chord tones plus compiler controls, not one count per chord token.
8. Ordinary simple patterns and original 0.1.1 PM-triplet-PH phrase must remain
byte/semantically unchanged. Current source/native profiles/tunings unchanged
except necessary typed extensibility. No invented slide behavior.
9. Native Riffer output must contain the actual independent chord tones with
legal physical string assignment; MIDI fallback is allowed only through
existing policy for genuinely unrepresentable native voicings. No fake
success for an explicit out-of-map pitch.
10. New internal plan use does not imply arbitrary prose support yet.
## Unit tests
- C4=60, E4=64, G4=67; flats/sharps/octave bounds and malformed symbols.
- F#, D, Bb majors and Em4=[64,67,71].
- Em4OverB and Em4/B -> [59,64,67,71].
- Em4OverB2 and Em4/B2 -> [47,64,67,71].
- Explicit [C3 E3 G3] -> [48,52,55]; no key-based correction.
- Em(add4) vs Em4 octave unambiguous, invalid/unsupported qualities.
- Compact pitch/chord runs and malformed ambiguous tails.
- Voicing/register/range/duplicate/overlap/budget validation.
- Internal simultaneous chord composition with exact starts/ends and valid
profile technique, no hidden transposition.
## Integration tests
- Compose a small original explicit chord+single-note plan, compile/write actual
MIDI and real .griff; independently parse saved pitches/times/articulation
and chord physical-string assignment. Include slash bass and non-key chord.
- Explicit impossible chord/pitch fails or uses existing known native fallback
truthfully, with no dropped tones or overwritten files.
- All prior ordinary phrase/native/CC/stdio/contracts regressions.
Run focused new tests, relevant regressions, Ruff lint/format, strict mypy,
and full current suite if shared schema/composer changes (expected).
Do not refresh version/build release until final Step16.
When complete, write your end-of-step report to ./prompts/report_14.md including: what was implemented, test results (pass/fail with details), any issues encountered, and whether you're ready for the next step
One plain triple-backtick fence for the entire report. Include public internal
APIs, exact chord/pitch policies and actual native/MIDI musical checks/counts,
source preservation and Step15 readiness. Do not create the next prompt.