A proof-of-concept that connects Claude to the Behringer RD-78 drum machine via MIDI. Describe a groove in plain English, and Claude generates a 16-step drum pattern that plays on real hardware.
- You describe a groove (e.g., "classic 808 trap beat" or "minimal techno kick pattern")
- Claude interprets your description and generates a 16-step pattern as JSON
- The pattern is sent to the RD-78 over USB MIDI
- Python 3.12+
- uv (Python package manager)
- Behringer RD-78 connected via USB
- An Anthropic API key
# Clone the repo
git clone https://github.com/philmerrell/claude-md-78.git
cd claude-md-78
# Install uv (if you don't have it)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
# Set your API key in .env
cp .env.example .env
# Edit .env and add your keyuv run python rd78_claude.pyThe script will auto-detect the RD-78 if connected. Then enter groove descriptions at the prompt:
Describe a groove (or 'quit'): four on the floor house beat with open hihats on the offbeats
You'll see a visual grid of the pattern, confirm, and it plays on the RD-78.
Sends on MIDI Channel 1. Note mapping from the RD-78 MIDI implementation:
| Voice | MIDI Note |
|---|---|
| Bass Drum | 36 |
| Rim Shot | 37 |
| Handclap | 39 |
| Snare | 40 |
| Hi-Hat | 46 |
| Cymbal | 49 |
| Tambourine | 54 |
| Cowbell | 56 |
| High Bongo | 60 |
| Low Bongo | 61 |
| Low Conga | 64 |
| Maracas | 70 |
| Guiro | 73 |
| Claves | 75 |
| Metallic | 80 |
If your RD-78 responds differently (e.g., custom mappings via SynthTribe), adjust the DRUM_MAP dictionary in the script.
- No MIDI ports found — Make sure the RD-78 is connected via USB and powered on. On macOS it should appear automatically; on Linux you may need
sudo modprobe snd-usb-audio. - Port not auto-detected — The script looks for "RD", "Behringer", or "rd78" in the port name. If yours differs, select it manually from the numbered list.
- JSON parse errors — Occasionally Claude's response may not be valid JSON. Just try again with a rephrased prompt.
MIT