Claude-skill-registry-data midi-generation
Generate MIDI files with GM instruments and music theory. Use when creating music, composing melodies, or generating MIDI files.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry-data
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry-data "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/midi-agent-skill" ~/.claude/skills/majiayu000-claude-skill-registry-data-midi-generation && rm -rf "$T"
manifest:
data/midi-agent-skill/SKILL.mdsource content
MIDI Generation Skill
Generate MIDI files with proper music theory. Use the provided Python scripts in
. Do NOT write custom code.skills/
Important Rules
- Use provided scripts in
directory (Python)skills/ - Never write custom Python/JS for MIDI generation
- Install dependencies first:
pip install midiutil - Consult music theory resources when needed (see below)
Quick Dissonance Rules
Always follow these to avoid harsh sounds:
- Never play notes 1 semitone apart (C+C#, E+F, B+C)
- Bass plays root or fifth of the chord
- Spread voices across octaves (don't cluster)
- Each track uses different MIDI channel (automatic)
Music Theory Resources (Read When Needed)
Only read the resource that matches your current task:
| When you need... | Read this file |
|---|---|
| Scales, chords, intervals, cadences | resources/music-theory.md |
| Chord progressions by genre | resources/chord-progressions.md |
| Avoiding dissonance, voice spacing | resources/voice-leading.md |
| Classical/Baroque counterpoint | resources/counterpoint.md |
| Modes (Dorian, Phrygian, etc.) | resources/modes-scales.md |
| Rhythm, time signatures, syncopation | resources/rhythm-patterns.md |
| Instrument ranges, combinations | resources/orchestration.md |
When to Read Each Resource
- Pop/Rock song → chord-progressions.md + voice-leading.md
- Classical piece → counterpoint.md + orchestration.md
- Jazz composition → modes-scales.md + chord-progressions.md
- Film score → orchestration.md + modes-scales.md
- Any composition → Always check voice-leading.md for dissonance
Workflow
- Install dependencies:
pip install midiutil - Identify genre/style → Select appropriate resources
- Read relevant theory → Only the files you need
- Choose instruments → See midi_types/gm_instruments.py
- Create composition JSON
- Use scripts to generate MIDI
Python Scripts
| Script | Purpose |
|---|---|
| Generate MIDI (auto-assigns channels per track) |
| Validate and normalize input |
| Adjust length, extend tracks |
| MIDI → WAV (requires FluidSynth) |
Usage Example
import sys sys.path.insert(0, '/path/to/midi-skill') from skills.generate_midi import generate_midi_from_dict composition = { "title": "My Song", "bpm": 120, "tracks": [ { "instrument": "acoustic-grand-piano", "notes": [ {"pitch": "C4", "duration": "4"}, {"pitch": "E4", "duration": "4"}, {"pitch": "G4", "duration": "4"}, {"pitch": "C5", "duration": "2"} ] }, { "instrument": "acoustic-bass", "notes": [ {"pitch": "C2", "duration": "2"}, {"pitch": "G2", "duration": "2"} ] } ] } midi_path = generate_midi_from_dict(composition) print(f"Generated: {midi_path}")
Composition Format
{ "title": "My Song", "bpm": 120, "tracks": [ { "instrument": "acoustic-grand-piano", "notes": [ { "pitch": "C4", "duration": "4" }, { "pitch": "E4", "duration": "4" } ] }, { "instrument": "acoustic-bass", "notes": [ { "pitch": "C2", "duration": "2" } ] } ] }
Duration Notation
| Value | Note |
|---|---|
| Whole note (4 beats) |
| Half note (2 beats) |
| Dotted half (3 beats) |
| Quarter note (1 beat) |
| Dotted quarter (1.5 beats) |
| Eighth note (0.5 beats) |
| Sixteenth note (0.25 beats) |
Instrument Aliases
| Alias | GM Instrument |
|---|---|
| acoustic-grand-piano |
| acoustic-guitar-nylon |
| acoustic-bass |
| string-ensemble-1 |
| brass-section |
| alto-sax |
Full list: midi_types/gm_instruments.py
Notes
- Max 15 melodic tracks (MIDI channels 0-8, 10-15; ch.9 = drums)
- Output:
directoryoutput/ - WAV requires: FluidSynth + A320U.sf2 in
soundfonts/