Strands Strudel: Live Coding Music with AI π΅
Live coding music with real-time WebSocket playback using Strudel patterns.
A Strands Agents tool for algorithmic music composition with a beautiful mobile-friendly player UI.
Features
- π§ Real-time WebSocket streaming - Send patterns to connected players instantly
- π± Mobile-friendly player - Glass morphism UI accessible from any device
- πΉ 13 preset styles - Techno, ambient, DnB, house, acid, lofi, and more
- π Pattern history - Timeline of all played patterns with one-click replay
- π Multi-client support - Broadcast to multiple players simultaneously
Installation
Quick Start
With Strands Agent
from strands import Agent
from strands_strudel import strudel
agent = Agent(tools=[strudel])
# Start server and open player
agent("Start strudel and open the browser")
# Play a beat
agent("Play a techno beat")
# Custom pattern
agent("Play s('bd*4') with some hi-hats")
Direct Usage
from strands_strudel import strudel
# Start server
strudel(action="start", open_browser=True)
# Play by style
strudel(action="play", style="techno")
# Play custom code
strudel(action="play", code='s("bd sd hh sd")')
# Stop playback
strudel(action="hush")
# Stop server
strudel(action="stop")
Available Styles
| Style | Description |
|---|---|
techno |
Four-on-the-floor kick with classic drums |
ambient |
Atmospheric pads with reverb and delay |
dnb |
Fast drum and bass patterns (140 BPM feel) |
house |
Classic house groove with bass |
acid |
303-style acid basslines with filter sweeps |
lofi |
Lo-fi hip hop beats |
minimal |
Sparse minimal techno |
breakbeat |
Syncopated breakbeat patterns |
dub |
Dubby rhythms with heavy delay |
trance |
Uplifting trance with supersaw |
jungle |
Fast jungle/breakcore patterns |
chillout |
Relaxed downtempo vibes |
industrial |
Distorted industrial sounds |
Architecture
βββββββββββββββββββ WebSocket βββββββββββββββββββ
β Strands Agent β βββββββββββββββββΆ β Browser Player β
β β Port 9999 β (Strudel.js) β
βββββββββββββββββββ βββββββββββββββββββ
β
HTTP β
Port 10000 βΌ
βββββββββββββββββββββββββββββββ
β Mobile / Other Browsers β
β http://<your-ip>:10000 β
βββββββββββββββββββββββββββββββ
Actions
| Action | Description |
|---|---|
start |
Start WebSocket + HTTP servers |
play |
Send pattern code or preset style |
hush |
Stop all playback |
stop |
Stop servers |
status |
Show server status |
styles |
List available styles |
Strudel Pattern Syntax
Samples
s("bd") // bass drum
s("sd") // snare
s("hh") // hi-hat
s("cp") // clap
s("bd:0 bd:1") // sample variations
Synthesizers
Mini-Notation
Make music with your AI agent. π΅