Compose and render original melodies as playable MIDI and WAV audio files. Use when asked to write music, create melodies, compose songs, generate musical pieces, or make something musical. Supports expressing genuine creative intent through music theory-informed composition with full audio rendering.
Compose original melodies and render them as playable audio files (MIDI and WAV).
A melody is a journey through emotional space, not an algorithm. Before writing any notes:
Reference references/creative-approaches.md for compositional strategies.
Determine these parameters:
references/music-theory.mdBuild from a motivic seed:
Melodic guidelines:
Create a JSON specification with one or more voices:
{
"title": "Composition Title",
"tempo": 90,
"time_signature": [4, 4],
"voices": [
{
"name": "Melody",
"instrument": 0,
"channel": 0,
"notes": [
{"pitch": 60, "duration": 1.0, "velocity": 80, "start": 0.0}
]
},
{
"name": "Bass",
"instrument": 32,
"channel": 1,
"notes": [
{"pitch": 36, "duration": 2.0, "velocity": 70, "start": 0.0}
]
}
]
}
Voice fields:
name: voice identifier (for MIDI track name)instrument: General MIDI program number (see below)channel: MIDI channel 0-15 (use different channels per voice)notes: array of note eventsNote fields:
pitch: MIDI note number (60 = middle C, each semitone +1)duration: length in beats (1.0 = quarter note at tempo)velocity: loudness 0-127 (typical: 60-100)start: beat position where note beginsCommon GM instruments:
Run the composition script:
echo '<json>' | python3 scripts/compose.py output_name --wav
This creates both .mid (MIDI) and .wav (synthesized audio) files.
MIDI pitches (octave 4): C=60, D=62, E=64, F=65, G=67, A=69, B=71
Common scales from C (60):
Emotional intervals:
For complete theory, see references/music-theory.md.