mcp_opendaw_generate_melody
Generate a melodic line from a scale using contour-guided random selection. No chord progression needed—picks pitches from the specified scale guided by a contour shape.
Instructions
Generate a melodic line from a scale using contour-guided random selection.
Creates a melody from scratch — no chord progression needed. The algorithm picks pitches from the specified scale, guided by a contour shape that controls the overall direction of the melodic line.
contour: Melodic shape:
"ascending" — starts low, rises throughout (build-up, tension)
"descending" — starts high, falls throughout (release, resolution)
"arch" — rises then falls (classic A-section, question-answer)
"v_shape" — falls then rises (dramatic, bridge)
"wave" — oscillates up and down (meandering, B-section)
"random" — no contour constraint, pure weighted random
rhythm: Rhythm pattern:
"quarter" — all quarter notes (steady, folk)
"eighth" — all eighth notes (driving, pop)
"syncopated" — mix of quarters and off-beat eighths (jazz, funk)
"mixed" — varied durations (16th to half, most musical)
"sparse" — mostly rests with occasional notes (ambient, intro)
The algorithm:
Build a scale pitch list spanning 2 octaves centered on
octave.For each beat position, determine the target contour height (0-1 mapping across the melody length).
Map contour height to a pitch range in the scale.
Weighted random selection: notes near the contour target get higher weight, notes far away get lower weight.
Apply rhythm pattern to determine note durations and positions.
Insert rests based on rest_probability.
root: Root note name (C, D, E, F, G, A, B + accidentals). scale: Scale name (major, minor, dorian, phrygian, lydian, mixolydian, aeolian, harmonic_minor, melodic_minor, pentatonic_major, pentatonic_minor, blues). bars: Number of bars (1-16, default 4). contour: Melodic contour shape (see above). rhythm: Rhythm pattern (see above). octave: Center MIDI octave (3=bass, 4=mid, 5=lead, 6=high, default 5). velocity: Base velocity 0-1 (default 0.7). rest_probability: Chance of a rest instead of a note (0-0.5, default 0.15). unit_index: AU index with note tracks. track_index: Note track index for the melody. start_beat: Position in beats.
Returns notes created, contour shape, scale used, pitch range.
Example:
Arch-shaped C major melody, 4 bars, mixed rhythm
generate_melody(root="C", scale="major", bars=4, contour="arch")
Ascending pentatonic build-up
generate_melody(root="A", scale="pentatonic_minor", bars=4, contour="ascending", rhythm="eighth")
Sparse ambient intro
generate_melody(root="D", scale="dorian", bars=8, contour="wave", rhythm="sparse", rest_probability=0.4)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bars | No | ||
| root | No | C | |
| scale | No | major | |
| octave | No | ||
| rhythm | No | mixed | |
| contour | No | arch | |
| velocity | No | ||
| start_beat | No | ||
| unit_index | No | ||
| track_index | No | ||
| rest_probability | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |