Skip to main content

๐ŸŽต strands-strudel

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 on your network
  • ๐ŸŽน 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

pip install strands-strudel

Quick Start

With Strands Agent

from strands import Agent
from strands_strudel import strudel

agent = Agent(tools=[strudel])

# Start the server and open player
agent("Start strudel and open the browser")

# Play a beat
agent("Play a techno beat")

# Create custom pattern
agent("Play s('bd*4') with some hi-hats")

Direct Tool Usage

from strands_strudel import strudel

# Start server and open player in browser
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")

# Check status
strudel(action="status")

# List available styles
strudel(action="styles")

# Stop server
strudel(action="stop")

Actions

Action Description
start Start WebSocket + HTTP servers, optionally open browser
play Send pattern code or preset style to connected players
hush Stop all playback
stop Stop servers
status Show server status and connected players
styles List available preset styles

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    โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Configuration

Environment variables:

Variable Default Description
STRUDEL_WS_PORT 9999 WebSocket server port
STRUDEL_WS_HOST 0.0.0.0 WebSocket bind address

Strudel Pattern Syntax

Sound Sources

Samples (from dirt-samples):

s("bd")           // bass drum
s("sd")           // snare drum
s("hh")           // hi-hat
s("cp")           // clap
s("808")          // 808 sounds
s("piano")        // piano
s("bd:0 bd:1")    // sample variations

Synthesizers (built-in):

note("c4").sound("sine")       // sine wave
note("c4").sound("sawtooth")   // sawtooth wave
note("c4").sound("triangle")   // triangle wave
note("c4").sound("square")     // square wave
note("c4").sound("supersaw")   // detuned saws

Mini-Notation

"a b c d"       // sequence (4 equal parts)
"[a b] c"       // subdivide: a and b share one slot
"a*4"           // repeat 4 times
"a/2"           // play every 2 cycles
"~"             // rest/silence
"a?"            // 50% chance
"<a b c>"       // one per cycle
"a,b,c"         // play simultaneously (chord)
"a(3,8)"        // Euclidean: 3 hits over 8 steps

Effects

.lpf(1000)      // lowpass filter
.hpf(200)       // highpass filter
.gain(0.8)      // volume
.pan(0.5)       // stereo position
.room(0.5)      // reverb
.delay(0.5)     // delay amount
.distort(2)     // distortion
.speed(2)       // playback speed

Example Patterns

Basic Beat:

stack(
  s("bd*4"),
  s("~ sd ~ sd"),
  s("hh*8").gain(0.6)
)

Melodic:

n("0 2 4 <5 7>")
  .scale("C:minor")
  .sound("sawtooth")
  .lpf(800)

Ambient:

note("<[c3,e3,g3] [d3,f3,a3]>")
  .sound("triangle")
  .lpf(sine.range(400, 2000).slow(8))
  .room(0.8)

Links

License

MIT

Metadata

Release files for strands-strudel 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strands-strudel 0.1.1
File Size Uploaded
strands_strudel-0.1.1.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strands-strudel 0.1.1
File Interpreter ABI Platform
strands_strudel-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.7 kB

Release files / strands_strudel-0.1.1.tar.gz

Download URL strands_strudel-0.1.1.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c561ec92042432fcd77cbd6567414cec0af7ff95553d8dac492dc943fd1a9b39
BLAKE2b-256 checksum
How to use checksums
71c63aac41ff8eae4dafb7a5df8386d32ed301f1ec8c25cb3d1c10fb02adb534
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / strands_strudel-0.1.1-py3-none-any.whl

Download URL strands_strudel-0.1.1-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d0ec627f7c067103fb0a823ef9c186bcf0cf2d29e86ad4f35cfa754e41234df
BLAKE2b-256 checksum
How to use checksums
d536c6c8cd82883edabc243e690128b9da7f006f3566d5e123e062d2663fe375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page