livepilot-composition-engine
Compositional analysis, transition planning, and translation checking — the diagnostic/analytical side of form. Use when the user wants to "analyze song structure", "improve transitions", "check song flow", "detect motifs", "transform a section", or "score phrase impact". For constructive arrangement work (arrange, build a verse, add an intro, scene-to-arrangement), use livepilot-arrangement instead.
Composition Engine — Structure, Transitions, and Form
The composition engine operates three sub-engines: compositional analysis (structure and motifs), transition planning (section-to-section flow), and translation checking (how the mix survives different playback systems). It also provides form-level tools for emotional arc and arrangement planning.
Composition Sub-Engine
Analyze and transform the structural elements of a track.
Analysis Flow
- Call
analyze_composition— runs a full structural pass returning sections, motifs, phrase grid, and form classification - Call
get_section_graph— returns the section map: intro, verse, chorus, bridge, drop, breakdown, outro with bar ranges - Call
get_phrase_grid— returns the rhythmic and melodic phrase boundaries within each section - Call
get_motif_graph— returns detected melodic and rhythmic motifs with their occurrence locations and transformation history
Transformation
Once you understand the structure:
transform_motif(motif_id, transformation)— apply a transformation to a detected motif. Transformations include: inversion, retrograde, augmentation, diminution, transposition, fragmentation, sequencetransform_section(section_id, transformation)— apply a structural transformation to an entire section. Transformations include: extend, compress, strip_down, build_up, reharmonize, rhythmic_variation
Always capture before state with get_notes or get_arrangement_notes before transforming. Evaluate the result with evaluate_composition_move.
Motif Work
The motif graph tracks recurring melodic and rhythmic patterns:
- Each motif has an
id,pitches,rhythms,first_occurrence, andoccurrenceslist - Related motifs are linked by transformation edges (e.g., motif_2 is an inversion of motif_1)
- Use the motif graph to ensure thematic coherence — transformations should derive from existing material
Transition Sub-Engine
Plan and execute smooth transitions between sections.
Transition Flow
analyze_transition(from_section, to_section)— examine the current transition between two sections. Returns energy delta, timbral shift, harmonic distance, and detected issuesplan_transition(from_section, to_section)— generate a transition plan based on detected issues. Returns an ordered list of moves (filter sweeps, risers, drum drops, fills, automation curves)score_transition(from_section, to_section)— rate the current transition quality (0.0-1.0) with breakdown by energy, harmony, rhythm, and timbral continuity- Execute the planned moves using appropriate tools (
set_clip_automation,add_notes,set_device_parameter,apply_automation_shape) evaluate_composition_move— judge whether the transition improved
See references/transition-archetypes.md for common transition patterns and when to use each.
Transition Principles
- Energy changes should be gradual unless a hard cut is intentional
- Harmonic transitions need a pivot chord or shared tone
- Rhythmic transitions benefit from a fill or break at the boundary
- Timbral shifts should start 1-2 bars before the section change
- The most effective transitions prepare the listener's ear before the change lands
Translation Sub-Engine
Check how the mix translates across playback systems.
Translation Flow
check_translation— run translation analysis on the current mixget_translation_issues— return specific problems:- mono_collapse: elements that disappear or phase-cancel in mono playback
- spectral_consistency: frequency balance shifts between monitoring contexts
- low_end_translation: bass content that may vanish on small speakers
- loudness_consistency: perceived loudness variation across systems
Translation issues feed back into the mix engine — a mono collapse issue becomes a stereo_width critic issue for the mix loop.
Form Sub-Engine
High-level arrangement and emotional arc tools.
Form Flow
get_emotional_arc— map the energy/intensity curve across the entire track, identifying peaks, valleys, and plateausplan_arrangement— generate an arrangement plan based on the current form, suggesting section order, lengths, and energy targetsapply_gesture_template— apply a predefined arrangement gesture (build, drop, breakdown, outro_fade, intro_build) to a bar range
See references/form-patterns.md for common song forms and energy curves by genre.
Arrangement Principles
- Every section should have a clear purpose: introduce, develop, contrast, resolve, release
- The energy arc should have at least one clear peak — flat energy across the entire track lacks emotional impact
- Contrast drives interest: loud/quiet, dense/sparse, bright/dark
- Repetition builds familiarity but needs variation to avoid fatigue — transform on repeat, do not copy verbatim
- Transitions are as important as sections — budget time for them in the arrangement
Combining Sub-Engines
A typical compositional improvement session:
analyze_compositionto understand current structureget_emotional_arcto see the energy shape- Identify the weakest section or transition
- Use the transition sub-engine to fix section boundaries
- Use motif transformations to add thematic development
check_translationto verify the changes survive mono/small speakersevaluate_composition_moveafter each change
Always work one change at a time. Verify and evaluate before moving to the next intervention.