feat: AI Rearrange Scenario Detection from spec 45_SCENARIAO_AI

- 9 rearrange scenarios with keyword matching (arpeggio, harmonies,
  syncopation, walking bass, jazz, synthwave, cinematic, simplify, chromatic)
- detectRearrangeScenario() maps user prompt to specific technique rules
- buildRearrangeMessage auto-injects scenario-specific technique guidance
- 9 rearrange presets added to PromptTemplateManager (Rearrange / Variation)
This commit is contained in:
2026-07-28 11:03:26 +07:00
parent 2eb327056d
commit 3f7abe0c95
3 changed files with 219 additions and 11 deletions
@@ -38,6 +38,124 @@ const PromptTemplateManager = (function() {
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-23T16:00:00Z"
},
// ── Rearrange & Variation Scenarios ──
{
id: "preset_rearrange_arpeggio",
name: "Arpeggio Variation",
keywords: ["arpeggio", "arp", "broken chord", "arpeggiate"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional arranger. Rearrange the source MIDI notes into an arpeggiated variation. Subdivide sustained chord notes into sequential 0.25-beat arpeggiated steps with octave/triad jumps. Create a driving, shimmering sequence while preserving the underlying chord progression.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_harmonies",
name: "Add 3rd/4th Harmonies",
keywords: ["harmony", "harmonize", "harmonies", "3rd", "duet", "chord voicing"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional arranger. Add parallel harmonizing notes to the source melody. For each source pitch P, insert notes at P+3 or P+4 (Major/Minor 3rds) at the same start_beat. Create a richer, fuller texture resembling two instruments playing in duet.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_syncopation",
name: "Syncopation / Off-beat",
keywords: ["syncopation", "syncopate", "syncopated", "off-beat", "off beat", "funk", "latin"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional arranger. Apply syncopation to the source melody. Shift start_beat alignment off strong beats (0.0, 1.0, 2.0, 3.0) onto off-beats (0.5, 1.5, 2.5, 3.5). Preserve the core melodic outline while creating a rhythmic, syncopated feel.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_walking_bass",
name: "Walking Bass Line",
keywords: ["walking bass", "bassline", "walking"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional arranger. Transform the source melody into a walking bass line. Lower pitches to bass register (36-48 range). Build continuous quarter-note steps following the chord outline. Create an improvisational walking bassline matching the original chord progression.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_jazz",
name: "Jazz Swing Rearrangement",
keywords: ["jazz", "swing", "jazz swing", "bebop"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional Jazz arranger. Rearrange the source melody into a rhythmic Jazz Swing style. Apply: off-beat syncopation, 7th/9th chord extensions, swung eighth notes (triplet feel), and rhythmic variations while preserving the core melodic outline.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_synthwave",
name: "Synthwave / 80s Style",
keywords: ["synthwave", "80s", "retro", "synth wave", "retrowave", "outrun"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "A Minor",
system_instruction_template: "You are a Synthwave producer. Transform the source melody into an 80s Synthwave style. Apply: driving 8th-note bass arpeggios, analog synth lead with portamento, pulsating chord pads, and octave jumps in the bass.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_cinematic",
name: "Cinematic Orchestral",
keywords: ["cinematic", "orchestral", "epic", "film score", "symphonic", "hollywood"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 130,
default_scale: "C Minor",
system_instruction_template: "You are a cinematic composer. Transform the source melody into a dramatic Cinematic Orchestral arrangement. Apply: swelling dynamics, brass stabs on downbeats, string ostinato patterns, taiko percussion hits. Layer multiple octaves for epic width.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_simplify",
name: "Simplify / Strip Down",
keywords: ["simplify", "minimal", "strip down", "sparse", "reduce"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional arranger. Simplify the source melody: keep only downbeat notes (start_beat at 0.0, 1.0, 2.0, 3.0). Strip out embellishments, passing tones, and grace notes. Reduce chord voicings to root and 5th only.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
},
{
id: "preset_rearrange_chromatic",
name: "Passing Tones & Chromaticism",
keywords: ["passing tone", "chromatic", "chromaticism", "smooth", "approach note"],
category: "Rearrange / Variation",
default_bars: 8,
default_bpm: 120,
default_scale: "C Major",
system_instruction_template: "You are a professional arranger. Add passing tones and chromatic approach notes to the source melody. Insert half-step and whole-step approach notes targeting chord tones on strong beats. Smooth out the melodic progression while preserving the harmonic framework.",
is_user_defined: false,
is_favorite: false,
created_at: "2026-07-28T11:00:00Z"
}
];