MelodyCraft is a tool for generating MIDI files with chord progressions, bass lines, drum patterns, and melodies. Users can specify different sections of a song (e.g., intro, verse, chorus) and define the song structure by arranging these sections.
MelodyCraft is a tiny CLI to prototype songs in seconds.
Describe sections and chords in one line and get a clean, structured MIDI you can play or polish in a DAW.
-
Quick accompaniment source (MIDI) Generate an immediate harmonic/rhythmic bed to sing or solo over. Perfect for fast songwriting, lead-line sketching, guided jams, and ear-training.
-
DAW skeleton (replace one track at a time) Create the song skeleton (piano, bass, drums, optional melody), then swap instruments inside your DAW (Logic, Ableton, Reaper, Ardour…).
Import the MIDI, assign your plugins, refine voicings, humanize, automate.
- Human-readable input: free-form sections (
[Intro],[Verse_A], …), textual chords (Eb,Gm,Cadd9,Dsus4, …), durations in beats. - Standard output:
.midwith tempo and time-signature meta events, separated tracks (piano, melody, bass, drums). - Musical defaults: basic grooves, optional drum fills at section boundaries, GM channels/volumes that make sense.
- Zero lock-in: it’s just MIDI—edit, move, quantize, re-voice everything.
./MelodyCraft \
-t 120 -m 4 -b -d -g -k \
-p 100 -v 100 -q 100 -w 100 \
-o demo.mid \
[Intro] C 4 G 4 \
[Verse_A] Am 4 Em 4 \
[Chorus] Cadd9 4 G 4 F 4 Dsus4 4 \
[SONG] Intro 1 Verse_A 2 Chorus 2BPM 120, meter 4/4
-
Tracks: piano, bass, drums, melody (optional)
-
Clear song structure with free-form section names
-
Open demo.mid in your DAW and you’re off to the races.
Sections: [SectionName] followed by (CHORD DURATION_IN_BEATS) pairs
Structure: [SONG] SectionName REPEATS ...
Chords:
-
Roots: C C# D D# E F F# G G# A A# B (also: Db Eb Gb Ab Bb)
-
Suffixes: (maj) m 7 m7 maj7 dim aug 6 m6 sus2 sus4 add9 madd9
-
sus2 = {root, 2nd, 5th}, sus4 = {root, 4th, 5th}
-
add9 = major triad + 9th, madd9 = minor triad + 9th
Omitting the suffix ⇒ major triad (e.g., C)
-
Run MelodyCraft with your chord progression.
-
Open output.mid in a MIDI player or DAW.
-
Sing/play on top. Optionally enable -g -k for a generated melody that follows the key.
Great for rapid melody ideation, lyric testing, and creative warm-ups.
-
Generate the MIDI skeleton (piano/bass/drums/melody).
-
Import into your DAW and replace: drums first (your kit), then bass (synth/e-bass), then piano/keys, finally the melody.
-
Polish: voicings, swing/humanization, automation, FX.
The form is already there—focus on sound and musical choices.
🔧 Handy options (cheat-sheet)
-t BPM (e.g., -t 130) · -m 3|4 (meter)
-b bass · -d drums · -g melody · -k keep melody in key
Volumes: -p piano · -v drums · -q bass · -w melody (0–127)
-o file.mid output filename
The file includes tempo and time-signature meta events at t=0, so your DAW grid/metronome matches what you set.
- Generate chord progressions
- Add bass lines
- Add drum patterns
- Generate melodies that follow the key
- Define song sections and structure
-
Clone the repository:
git clone https://github.com/francescosisini/MIDI-Chord-GANerator.git cd MIDI-Chord-GANerator -
Install dependencies:
sudo apt-get install libsmf-dev libglib2.0-dev
-
Compile the project:
make
Run the MelodyCraft executable with the desired options:
./MelodyCraft [options] [section] chord duration ... [section] chord duration ... [structure] section repeat ...
Options
-t BPM Set the BPM (default: 90)
-m meter Set the meter (3 or 4, default: 4)
-r repeats Set the number of repeats for the whole song (default: 1)
-b Include bass
-d Include drums
-g Generate melody
-k Follow key for melody
-p piano_volume Set the piano volume (0-127, default: 100)
-v drum_volume Set the drum volume (0-127, default: 100)
-q bass_volume Set the bass volume (0-127, default: 100)
-w melody_volume Set the melody volume (0-127, default: 100)
-o filename Set the output filename (default: output.mid)
-h Show the help message
./MelodyCraft \
-t 120 -m 4 -b -d -g -k \
-p 100 -v 100 -q 100 -w 100 \
-o my_song.mid \
[Intro] C 4 G 4 \
[Verse_A] Am 4 Em 4 \
[Chorus] C 4 A 4 F 4 G 4 \
[SONG] Intro 1 Verse_A 2 Chorus 1 Verse_A 1 Chorus 2What this does
BPM = 120
Meter = 4/4
Includes bass (-b), drums (-d), and melody generation (-g)
Melody follows the key (-k)
Volumes (piano/drums/bass/melody) = 100
Output file: my_song.mid
Sections defined
Intro: C (4 beats), G (4 beats)
Verse_A: Am (4 beats), Em (4 beats)
Chorus: C (4), A (4), F (4), G (4)
Song structure
Intro ×1 → Verse_A ×2 → Chorus ×1 → Verse_A ×1 → Chorus ×2
💡 Section names are free-form. Use any label inside brackets: [Intro], [Verse_A], [Bridge2], etc.
Roots: C C# D D# E F F# G G# A A# B (anche bemolli: Db Eb Gb Ab Bb)
Suffixes: (maj) m 7 m7 maj7 dim aug 6 m6 sus2 sus4 add9 madd9
sus2 = {root, 2nd, 5th}, sus4 = {root, 4th, 5th}
add9 = major triad + 9th, madd9 = minor triad + 9th
Without suffix ⇒ triade maggiore (es. C)
Contributions are welcome! Please fork the repository and submit a pull request.