Skip to content

beatstoch

BPM-aware stochastic drum MIDI generator - Create dynamic, probabilistic drum patterns that adapt to any song's BPM.

Python 3.9+ PyPI version uv

Overview

beatstoch is a powerful tool for generating drum patterns that intelligently adapt to any song's BPM. Whether you're a music producer looking for inspiration or a developer wanting to integrate dynamic rhythm generation into your application, beatstoch provides both a command-line interface and Python library.

Key Features

  • 🎵 BPM Database Integration: Automatically looks up song BPM from online databases
  • 🎶 Multiple Styles: House, breaks, and generic drum patterns
  • 🔀 Stochastic Generation: Creates varied, probabilistic drum patterns using golden ratio and Fibonacci sequences
  • 🎹 MIDI Export: Generates standard MIDI files compatible with all DAWs
  • ⚡ CLI & Library: Use as a command-line tool or Python library
  • 🎛️ Customizable: Adjust swing, intensity, bars, groove, and more
  • 🎼 Time Signatures: Support for 4/4, ¾, and 2/4 meters with natural accents
  • 👤 Humanize Mode: Ghost notes and timing variation for authentic human feel

Quick Start

Command Line

# Generate 8 bars of house drums for any song
beatstoch generate "Billie Jean" --artist "Michael Jackson"

# Generate breaks pattern at specific BPM
beatstoch generate-bpm 128 --bars 16 --style breaks

# Humanized pattern with ghost notes
beatstoch generate-bpm 120 --humanize 0.6 --style house

# 3/4 waltz time with humanization
beatstoch generate-bpm 90 --meter 3/4 --humanize 0.7

# See all options
beatstoch --help

Python Library

from beatstoch import generate_from_song, generate_stochastic_pattern

# Generate from song lookup
midi_file, bpm = generate_from_song(
    "1979",
    artist="Smashing Pumpkins",
    bars=8,
    style="house",
    groove_intensity=0.8
)

# Generate with explicit BPM and humanization
midi_file = generate_stochastic_pattern(
    bpm=127,
    bars=4,
    style="breaks",
    swing=0.1,
    humanize=0.6  # Add ghost notes and timing variation
)

# Generate in 3/4 time
midi_file = generate_stochastic_pattern(
    bpm=90,
    bars=8,
    meter=(3, 4),  # Waltz time
    humanize=0.7,
    style="generic"
)

Installation

pip install beatstoch

Documentation Contents

Examples

See the User Guide for comprehensive examples and detailed usage instructions.

License

[Add your license information here]

Support


Generated drum patterns are for educational and creative purposes. Always respect music copyrights and licensing.