stable |

Recipes

Complete, runnable examples for common drum track scenarios.

metal

Death Metal Track

BPM 180 Style death Drummer Gene Hoglan Complexity 0.9

A full death metal song with blast beats, continuous double bass pedal, and Gene Hoglan's mechanical precision. Sections move from atmospheric breakdown intro into relentless verse/chorus cycles.

intro 4 bars
verse 8 bars
chorus 8 bars
verse 8 bars
breakdown 4 bars
chorus 8 bars
outro 4 bars

Python

from midi_drums.api.python_api import DrumGeneratorAPI
from midi_drums import DrumGenerator

# Quick version — one function call
api = DrumGeneratorAPI()
song = api.create_song(
    genre="metal",
    style="death",
    tempo=180,
    complexity=0.9,
    humanization=0.2,   # slight humanization — death metal is tight
    drummer="hoglan",   # Gene Hoglan: mechanical precision
)
api.save_as_midi(song, "death_metal_hoglan.mid")

# Full control over structure
gen = DrumGenerator()
song = gen.create_song(
    genre="metal",
    style="death",
    tempo=180,
    structure=[
        ("intro",     4),
        ("verse",     8),
        ("chorus",    8),
        ("verse",     8),
        ("breakdown", 4),
        ("chorus",    8),
        ("outro",     4),
    ],
    complexity=0.9,
    humanization=0.2,
)
gen.export_midi(song, "death_metal_custom.mid")

CLI

midi-drums generate \
    --genre metal \
    --style death \
    --tempo 180 \
    --complexity 0.9 \
    --humanization 0.2 \
    --drummer hoglan \
    --output death_metal.mid

Export to Reaper

midi-drums reaper export \
    --genre metal \
    --style death \
    --tempo 180 \
    --complexity 0.9 \
    --drummer hoglan \
    --output death_metal.rpp \
    --midi death_metal_drums.mid \
    --marker-color "#FF3300"
What makes it sound right

Hoglan applies MechanicalPrecision — near-zero timing variation — plus HeavyAccents for the characteristic snare crack. Low humanization=0.2 keeps the robotic feel authentic to the genre.

jazz

Modern Jazz Session

BPM 130 Style contemporary / fusion Drummer Dave Weckl Complexity 0.75

A modern jazz recording-session feel — ride-driven with linear passages, ghost notes under the snare, and Weckl's signature sophisticated coordination. Works equally well for contemporary and fusion styles.

intro 4 bars
verse 8 bars
bridge 4 bars
verse 8 bars
outro 4 bars

Python

from midi_drums.api.python_api import DrumGeneratorAPI
from midi_drums import DrumGenerator

api = DrumGeneratorAPI()

# Contemporary jazz with Weckl's linear coordination
contemporary = api.create_song(
    genre="jazz",
    style="contemporary",
    tempo=130,
    complexity=0.75,
    humanization=0.5,   # jazz breathes — higher humanization
    drummer="weckl",
)
api.save_as_midi(contemporary, "jazz_contemporary_weckl.mid")

# Fusion style — more electric energy
fusion = api.create_song(
    genre="jazz",
    style="fusion",
    tempo=145,
    complexity=0.8,
    humanization=0.4,
    drummer="weckl",
)
api.save_as_midi(fusion, "jazz_fusion_weckl.mid")

# Classic swing for comparison
swing = api.create_song(
    genre="jazz",
    style="swing",
    tempo=120,
    drummer="weckl",
)
api.save_as_midi(swing, "jazz_swing_weckl.mid")

Style variations

api = DrumGeneratorAPI()

# Generate individual section patterns for arrangement
intro_pattern  = api.generate_pattern("jazz", "intro",  "contemporary")
verse_pattern  = api.generate_pattern("jazz", "verse",  "contemporary")
bridge_pattern = api.generate_pattern("jazz", "bridge", "fusion")
outro_pattern  = api.generate_pattern("jazz", "outro",  "ballad")

# Apply Weckl style to each section
patterns = {
    "intro":  api.apply_drummer_style(intro_pattern,  "weckl"),
    "verse":  api.apply_drummer_style(verse_pattern,  "weckl"),
    "bridge": api.apply_drummer_style(bridge_pattern, "weckl"),
    "outro":  api.apply_drummer_style(outro_pattern,  "weckl"),
}

# Save individually for layering in your DAW
for name, pattern in patterns.items():
    api.save_pattern_as_midi(
        pattern,
        f"jazz_{name}.mid",
        tempo=130
    )
Weckl's signature

LinearCoordination removes simultaneous hits so every note has its own space — the hallmark of linear drumming. GhostNoteLayer adds barely-audible ghost notes under the snare for depth. Use humanization=0.45–0.55 for the most natural jazz feel.

rock

Progressive Rock Track

BPM 145 Style progressive Drummer John Bonham Complexity 0.85

Progressive rock demands complexity without losing the pocket. Bonham's behind-the-beat feel combined with the progressive rock style creates driving patterns with unexpected syncopations and dynamic fills.

intro 4 bars
verse 8 bars
chorus 8 bars
bridge 8 bars
chorus 8 bars
outro 8 bars

Python

from midi_drums.api.python_api import DrumGeneratorAPI
from midi_drums import DrumGenerator

api = DrumGeneratorAPI()

# Progressive rock with Bonham's signature weight
prog = api.create_song(
    genre="rock",
    style="progressive",
    tempo=145,
    complexity=0.85,
    humanization=0.35,  # behind-the-beat feel
    drummer="bonham",
)
api.save_as_midi(prog, "prog_rock_bonham.mid")

Custom arrangement

from midi_drums import DrumGenerator

gen = DrumGenerator()

# Longer, more cinematic arrangement
song = gen.create_song(
    genre="rock",
    style="progressive",
    tempo=145,
    structure=[
        ("intro",  4),   # Build
        ("verse",  8),   # Theme A
        ("chorus", 8),   # Lift
        ("verse",  8),   # Theme A again
        ("bridge", 8),   # Contrast section — key change feel
        ("chorus", 8),   # Return
        ("outro",  8),   # Extended fade
    ],
    complexity=0.85,
    humanization=0.35,
)
gen.export_midi(song, "prog_rock_long.mid")

# Or try with Porcaro's ghost note mastery for a more polished feel
api = DrumGeneratorAPI()
porcaro_prog = api.create_song(
    genre="rock",
    style="progressive",
    tempo=145,
    complexity=0.75,
    humanization=0.4,
    drummer="porcaro",  # studio precision + ghost notes
)
api.save_as_midi(porcaro_prog, "prog_rock_porcaro.mid")
Bonham's behind-the-beat feel

BehindBeatTiming delays hits by 15–25 ms — subtle enough to be musical, noticeable enough to create that signature weight. Combined with TripletVocabulary for fills and HeavyAccents for power, it produces the Led Zeppelin signature.

Batch generation

Generate multiple tracks in one call — useful for providing a DAW session with all sections pre-made:

from midi_drums.api.python_api import DrumGeneratorAPI

api = DrumGeneratorAPI()

specs = [
    # Death metal at different tempos
    {"genre": "metal", "style": "death",  "tempo": 180, "drummer": "hoglan"},
    {"genre": "metal", "style": "death",  "tempo": 160, "drummer": "hoglan"},
    # Progressive rock variations
    {"genre": "rock",  "style": "progressive", "tempo": 145, "drummer": "bonham"},
    {"genre": "rock",  "style": "progressive", "tempo": 130, "drummer": "porcaro"},
    # Jazz sessions
    {"genre": "jazz",  "style": "contemporary", "tempo": 130, "drummer": "weckl"},
    {"genre": "jazz",  "style": "fusion",       "tempo": 145, "drummer": "chambers"},
]

output_files = api.batch_generate(specs, output_dir="output/")
print(f"Generated {len(output_files)} MIDI files")

AI-described recipes

With AI dependencies installed (uv sync --group ai) and an API key configured, you can describe drums in plain English. Two code paths are available: the Python async API for scripting, and the prompt CLI command for quick one-liners.

CLI — single pattern

The fastest way to get a MIDI file from a description:

# Single death metal pattern
midi-drums prompt "brutal death metal with continuous blast beats and galloping double bass" \
    --tempo 190 --bars 4 -o ai_death.mid

# Contemporary jazz — auto-named output
midi-drums prompt "contemporary jazz with linear drumming, ghost notes, and complex ride pattern" \
    --tempo 132 --complexity 0.75 --drummer weckl

# Progressive rock with odd meter feel
midi-drums prompt "progressive rock in 7/8 with syncopated snare and polyrhythmic hi-hat" \
    --tempo 145 --bars 8 --section verse -o prog78.mid

CLI — full song via agent

Add --song to have the AI agent compose a complete multi-section arrangement. Use --save-metadata for an organized output directory with per-section MIDI parts.

# Full song, organised output
midi-drums prompt \
    "death metal song with Gene Hoglan blast beats, Dave Lombardo double-kick sections, \
     and an extended solo arc that starts slow and builds to full thrash speed" \
    --song --save-metadata --tempo 185 -o my_death_song

# What gets written to disk:
# output/my_death_song/
# ├── my_death_song.mid        ← full linear song (all sections)
# ├── metadata.json            ← prompt, provider, structure, agent notes
# └── parts/
#     ├── 00_intro.mid
#     ├── 01_verse.mid
#     ├── 02_chorus.mid
#     ├── 03_breakdown.mid
#     ├── 04_solo_slow.mid
#     ├── 05_solo_build.mid
#     └── ...

# Progressive rock epic
midi-drums prompt "progressive rock epic with odd time signatures, Bonham-style power, \
                   extended bridge section and ambient outro" \
    --song --save-metadata --tempo 138 -o prog_epic

# Modern jazz with complex structure
midi-drums prompt "modern jazz quartet session: intro brushwork, swing groove verse, \
                   bebop bridge, fusion chorus and calm outro" \
    --song --save-metadata --tempo 125 -o jazz_session
Using parts in your DAW

Each parts/ file is a standalone MIDI clip for one section — drop them onto separate tracks in your DAW to mix and match, or import the full *.mid for a linear arrangement. metadata.json lists section names and bars so you know exactly what each file contains.

Python API

import asyncio
from midi_drums.ai import DrumGeneratorAI

async def main():
    ai = DrumGeneratorAI()

    # Death metal via natural language
    pattern, info = await ai.generate_pattern_from_text(
        "brutal death metal with continuous blast beats and galloping double bass",
        section="verse", tempo=190, bars=4
    )
    ai.export_pattern(pattern, "ai_death.mid", tempo=190)

    # Modern jazz
    pattern, info = await ai.generate_pattern_from_text(
        "contemporary jazz with linear drumming, ghost notes, and complex ride pattern",
        section="verse", tempo=132, bars=4
    )
    ai.export_pattern(pattern, "ai_jazz.mid", tempo=132)

    # Progressive rock
    pattern, info = await ai.generate_pattern_from_text(
        "progressive rock in odd meter with syncopated snare and driving hi-hat",
        section="verse", tempo=145, bars=4
    )
    ai.export_pattern(pattern, "ai_prog.mid", tempo=145)

asyncio.run(main())

Next: Learn how to use these tracks in Reaper →