A repository for experimenting with Strudel live coding music patterns, with an automated development workflow powered by the Strudel MCP server.
- π΅ Auto-reload: Automatically updates Strudel when you save
.strudelor.strfiles - π File watching: Monitors all
.strudeland.strfiles in your project - πΉ Integrated sampler: Run the Strudel sampler server alongside your development
- π MCP Integration: Leverages the Strudel MCP server for seamless browser control
- π TypeScript workflow: Type-safe development scripts with tsx
This project currently depends on two upstream pull requests of the submodule that are open and under review:
- PR #8: Fix: Replace keyboard.type() with insertText() to prevent auto-pairing corruption
- PR #9: Add Update Button Support for Live Pattern Updates
Workaround: While these PRs are in review, this project uses a fork of the MCP server submodule with the changes already implemented. The forked is available in the main-fixed branch of this repo. If you want a working version of this application prior to the merge of the two listed PRs, you'll have to copy/use main-fixed for now.
- Node.js (v18 or higher recommended)
- The Strudel MCP server installed and configured
- Clone this repository:
git clone <your-repo-url>
cd strudelplay- Run the setup command to install everything:
npm install
npm run setupThis will:
- Initialize the git submodule for the MCP server
- Install all dependencies
- Build the MCP server
- Create your
.envfile
If you prefer to set up manually:
- Clone with submodules:
git clone --recurse-submodules <your-repo-url>
cd strudelplay- Install main project dependencies:
npm install- Set up the MCP server:
npm run setup:mcp- Create environment file:
npm run setup:envNew to this workflow? See QUICKSTART.md for a step-by-step tutorial with example files!
Initialize Strudel and start the development workflow:
# Initialize Strudel browser instance
npm run init
# Start the file watcher (all .strudel and .str files)
npm run dev
# Watch a specific file only
npm run dev:file patterns/my-song.strudel
# Start sampler + file watcher (recommended)
npm run dev:watch
# Start sampler + custom samples + file watcher (with custom samples)
npm run dev:full| Command | Description |
|---|---|
| Development | |
npm run dev |
Start the file watcher (all files) |
npm run dev:file <path> |
Watch a specific file only |
npm run dev:watch |
Start sampler + file watcher (recommended) |
npm run dev:full |
Start sampler + custom samples + file watcher |
npm run sampler |
Start the Strudel sampler server (port from .env) |
npm run samples:serve |
Start custom samples server (port/dir from .env) |
npm run init |
Initialize a new Strudel browser session |
| Utilities | |
npm run cleanup |
Kill lingering processes on ports 5555 and 8000 |
npm run stop |
Alias for cleanup |
| Setup | |
npm run setup |
Run all setup steps (submodule, MCP server, env file) |
npm run setup:submodule |
Initialize git submodules |
npm run setup:mcp |
Install and build the MCP server |
npm run setup:env |
Create .env from .env.example if it doesn't exist |
-
Start the development environment:
npm run dev:all
-
Create or edit a
.strudelfile:- Any changes to
.strudelfiles are automatically detected - The pattern is instantly updated in the Strudel browser
- Any changes to
-
Write your patterns:
// first_notes.strudel or first_notes.str setcpm(90/4) samples('http://localhost:5555') sound("bd bd hh bd rim bd hh bd")
-
Save and watch the magic happen:
- The watcher detects the change
- Sends the pattern to the Strudel MCP server
- Your pattern updates in the browser automatically
strudelplay/
βββ patterns/ # Store your .strudel pattern files here
βββ scripts/ # Development workflow scripts
β βββ mcp-client.ts # MCP server communication
β βββ watcher.ts # File watcher implementation
β βββ init-strudel.ts # Initialization script
βββ .env # Environment configuration
βββ *.strudel # Your pattern files (anywhere in project)
The .env file supports the following options:
# Port for the Strudel sampler server (@strudel/sampler)
PORT=5555
# Custom samples server configuration
SAMPLES_PORT=8000 # Port for serving your custom samples
SAMPLES_DIR=samples # Directory containing your samples
# Path to the Strudel MCP server (uses submodule by default)
STRUDEL_MCP_PATH=./mcp-server/dist/index.js
# Optional: Node executable path
# NODE_PATH=/usr/local/bin/node-
Add your samples to the
samples/directory:samples/ βββ drums/ β βββ kick.wav β βββ snare.wav βββ synths/ βββ lead.wav -
Start the full dev environment:
npm run dev:full
-
Use in your patterns:
// Load both Strudel's samples and your custom ones samples('http://localhost:5555', 'http://localhost:8000') // Use your custom samples sound("drums/kick drums/snare")
See samples/README.md for detailed information about organizing and using custom samples.
- File Watcher: Uses chokidar to monitor
.strudelfiles - MCP Client: Communicates with the Strudel MCP server via the MCP SDK
- Auto-update: When files change, the pattern is sent to the browser through MCP tools
- Sampler Integration: Runs the Strudel sampler for audio samples
βββββββββββββββββββ
β .strudel files β
ββββββββββ¬βββββββββ
β (file change detected)
β
βββββββββββββββββββ
β File Watcher β
β (chokidar) β
ββββββββββ¬βββββββββ
β
β
βββββββββββββββββββ
β MCP Client β
β (SDK stdio) β
ββββββββββ¬βββββββββ
β
β
βββββββββββββββββββ
β Strudel MCP β
β Server β
ββββββββββ¬βββββββββ
β
β
βββββββββββββββββββ
β Strudel Browser β
β (Puppeteer) β
βββββββββββββββββββ
- Ensure the Strudel MCP server is properly installed
- Check that Node.js is in your PATH
- Verify
.envconfiguration
- Check the terminal for error messages
- Ensure the Strudel browser window is open
- Verify the
.strudelfile syntax is valid
- Run
npm installto ensure all dependencies are installed - The TypeScript errors about
@types/nodeshould resolve after installation
Feel free to experiment, add patterns, and improve the workflow! This is a personal playground for Strudel experimentation.
MIT