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

177 lines
10 KiB
Markdown

# Step 15: Hybrid prose plus precise Counts/Events/Chords/Notes lanes
## Objective and accepted prerequisite
Step14 is reviewed and independently verified (158 new pitch/plan/native tests).
Read report14/current pitch.py/strict plans/composer, description/service/tool
feedback and native codecs. Implement the actual PUBLIC description path for
the agreed hybrid notation. No new public tool, new dependency, commit,
delegation, later prompts, model service, audio/host or user-app changes.
Prose supplies context/defaults; notation fixes events where supplied. Explicit
pitches/timing/articulation/ties cannot be overwritten by improvisation.
Spacing width is NEVER timing. Contradictory prose is an actionable error, not
silent precedence. Unknown material is not ignored into an approximate success.
## Owned surfaces
- One focused `notation.py`/`hybrid.py` parser as appropriate, reused from
description.py and compose.py. Keep module/dependency direction acyclic.
- Minimal reusable unresolved/typed hybrid plan in schemas.py if needed.
Reuse Step14 pitch resolution and ExplicitAttackPlan, never duplicate voicing.
- service.py/result models only to expose accurate interpreted events/assumptions.
- errors.py/server.py/schema descriptions and current docs for actual support.
- Unit/integration/real stdio/installed-package hybrid tests, original fixtures.
- prompts/report_15.md.
## Canonical public example that MUST work directly
Lead guitar, 4/4, 120 BPM, 2 bars.
Bar 1:
Counts: 1 & 2 & 3 & [4 trip let]
Events: x x x x x x [x x ^]
Chords: F#2 F#2 D2 D2 Bb2 Bb2 - - -
Notes: - - - - - - C4 E4 G4
Hold the final G4 through the end of bar 2 without retriggering.
This is six PM chord attacks followed by PM C4, PM E4, PH G4 sustained across
the bar boundary. Exact native/MIDI pitches must be F#2 major42/46/49,
D2 major38/42/45, Bb2 major46/50/53, C4=60 E4=64 G4=67; explicit chords are
not retuned into a key. Exactly21 musical note-ons, not counting switches.
Onsets MIDI960: chord groups0,480,960,1440,1920,2400; C4=2880/E4=3200/
G4=3520; first durations480/two triplets320; final G4 end7680.
Also support original single-note two-measure request using lanes:
Lead guitar, E minor, 4/4, 120 BPM, 2 bars.
Bar 1:
Counts: 1& 2& 3& [4 trip let]
Events: xx xx xx xx^
Notes: E2E2 E2E2 E2E2 E2E2E2
Hold the final E2 through the end of bar 2 without retriggering.
That MUST preserve the exact previous original phrase's nine musical events,
PM26/PH31 switches, durations, pitches and seed0 velocities/bytes where feasible.
Accept normal whitespace and tabs, not column-position heuristics.
## Count/grid semantics
1. Parse labeled Counts:/Events:/Chords:/Notes: rows case-insensitively, preserve
pitch-token capitalization semantics from pitch.py. Rows describe one
selected pitched part; lead/guitar or bass inferred from prose/part override.
No simultaneous drum-lane language is invented in this implementation.
2. Numeric labels identify counted meter-denominator beats (quarter in4/4).
Complete `1 &`/`1&` = two eighth positions. Complete `1 e & a` = four
sixteenth positions, uppercase E/A equivalent (not a different rhythm).
A bare single beat label = one beat. Explicit `[4 trip let]` is a3-way
eighth-triplet beat; bracket syntax declares the subdivision, not visual width.
3. Support an explicit Grid:/Subdivision: eighths/sixteenths/eighth-triplets
directive for disambiguation, with a clear tested count-label interpretation.
Bare `1&a` without explicit sixteenth/triplet grid is AMBIGUOUS and errors.
Never infer a triplet just from three attacks or lowercase letters.
4. Counts ordered within bar, range checked against meter, no duplicate/regressed
position. Use exact Fraction math and proper denominator units, reject
unsupported grids rather than floating rounding. At least different 3/4
simple-meter case plus4/4; do not claim idiomatic compound grouping.
5. Multiple `Bar N:` blocks and/or matching `|` bar boundaries may be supported
if kept simple; at least a second explicit continuation bar must work.
Validate all labeled rows' flattened slots/bar spans agree. No silently
truncated/zip-shortened mismatched rows.
6. Brackets on Events/Notes may group matching triplet tokens; they are not
simultaneous chord syntax there. Chords: `[C3 E3 G3]` is one explicit
simultaneous voicing token. Document and test this distinction. Avoid nested
bracket heuristics silently swallowing a voiced chord as three attacks.
## Event/pitch/hold semantics
- `o` = normal/open attack (not open-string fingering).
- `x` = palm-muted attack.
- `^` = pinch-harmonic attack (evidenced AME only).
- `-` in Events = rest (ends active prior sound unless it ended already).
- `~` = extend PREVIOUS sounding attack/chord without retrigger; cannot follow
silence, conflict with new pitch/articulation or silently create a new note.
- `|` = bar boundary, when used consistently.
- `/` and `\` in Events are RESERVED slide directions. Without an implemented
evidence-backed origin/destination/timing representation, return a specific
unsupported-slide error with guidance; do NOT silently emit a normal attack
or confuse Chords:Em4/B2 with an Events:/ symbol.
1. Each slot has one event symbol and exactly one sounding pitch source or none.
Chords/Notes rows are optional individually; absent row is all `-`.
Both sounding at one slot is a conflict, not an arbitrary merge. A pitch-lane
`-` means empty lane, not necessarily global rest. Active event with no
pitch may use the explicitly disclosed low-tonic context default; never invent
pitches when another precise pitch source exists.
2. Whitespace separates tokens but runs may be compact: Events:`xxxxxx^`;
Chords:`F#F# DD BbBb ---`; Notes:`-- -- -- C4E4G4`.
Use Step14 deterministic tokenizer to resolve atoms; values never depend on
how many spaces were used. Slash/Over bass, octave-qualified chords and
[explicit voicing] must remain one slot, not be split by naive whitespace.
3. Explicit notes/chords override key-based generation by design, not by silently
altering prose: a stated key is context; raw pitches stay exact. If prose
directly specifies a different pitch for the SAME event, flag the conflict.
4. Resolve octave defaults through Step14 profile/routing policy, propagating all
chosen roots/bass octaves and voicings as visible assumptions/interpretation.
`Em4OverB2`=[47,64,67,71], Em4/B=[59,64,67,71]; reject explicit bass not lowest.
No dropped chord tone, automatic key retune or hidden revoicing.
5. Hold directive supports natural `Hold/Tie the final [note|chord|G4|E2]
through/to the end of bar/measure 2 without retriggering.` An optional pitch
must match that final note. Extend to exact bar end, no second attack.
`Bar 2: hold previous note to bar end` should also work and not be consumed
by the unsupported global `to/from` rule. Restrict recognized clauses first.
6. A second `Counts` bar with all Events:`~` and empty pitch lanes must yield
one uninterrupted prior note/chord. Sustaining PH preserves its original
articulation. Explicit rests/new attacks cannot be overridden by a prose
hold. Reject a hold spanning specified conflicting notation.
7. Structured scalar overrides retain existing documented precedence ONLY when
compatible with explicit timing/pitches; a shorter bars override or incompatible
meter must error instead of dropping/regenerating exact material.
## Prose/context and observed interpretation
- Support documented common context around the rows (guitar/bass, key incl.Em,
numeric BPM/bars/meter, "two bars", low-register chord voicings, aggressive/
tight metal style and bounded velocity variation). State actual policy:
exact notation cannot be altered by style; no unrequested CC/effects.
- Prose-only inputs continue on old paths byte-identically. Do not remove
old unsupported-tempo-change safeguards or accept arbitrary instructions.
- When prose specifies a global technique and lanes explicitly differ for the
same events, raise an actionable conflict. Do not mistake explicit intentional
phrase overrides (first PM then PH) for contradictory accidental global input.
- The tool should show its interpretation. Add a backward-compatible optional/
default result interpretation surface if necessary: exact resolved pitch sets,
start/duration as rational beats, technique and holds. Include canonical
voicings/register assumptions in complete JSON text and structuredContent.
Do not dump private raw text or paths in errors. Existing simple callers
should not need to provide new required fields.
- Help text must clearly advertise tested lane syntax/count grid/pitch convention,
not overclaim arbitrary natural-language rhythm comprehension.
## Required tests
Unit: canonical/compact examples, width/case invariance, complete eighth/
sixteenth/explicit triplet grids, ambiguous1&a rejection/explicit-grid recovery,
row slot mismatches, brackets/voicing/slash bass, rests/lane-empty vs rest,
continuation/hold no retrigger, contradictory pitch/articulation/prose, bad
bars/meters/labels/keys, per-part capability errors (PH on bass), slide reserved,
malformed/huge inputs/budget, raw explicit pitches preserved outside key.
Integration:
- Real source stdio AND installed-wheel native/MIDI with text-only JSON parity.
- Independently assert21 tones for the exact chord example and9 for the original
E2 example, exact onsets/durations/PH and no bar2 retrigger, every chord tone,
legal native fingering and actual controller absence.
- Em4OverB2/Em4/B/explicit voicing survive the public description to real MIDI/
griff without retune/drop, default bass/root assumptions visible.
- All-~ bar matches prose-tie bytes/semantics; dash/rest truly separates attacks.
- Genuine invalid/mismatched/ambiguous notation errors publish no artifacts.
- All current template/native/CC/atomic/privacy/old-phrase/pitch regressions.
Run focused new tests, full current suite, Ruff lint/format, strict mypy and pip.
No version/release metadata changes yet (Step16 owns final0.2.0).
When complete, write your end-of-step report to ./prompts/report_15.md including: what was implemented, test results (pass/fail with details), any issues encountered, and whether you're ready for the next step
Entire report in exactly one plain triple-backtick fence. Include supported
grammar/policies/limits, actual native/MIDI event proof, compact and nearby
examples, exact counts/checks, result interpretation and Step16 readiness.