Project

apfelstrudel

experimental

Live coding music environment with AI agent chat — compose and perform with Strudel, talk to an agent mid-set.

Overview

Apfelstrudel wraps the strudel live-coding music environment with an embedded AI agent chat panel. You write and perform generative music patterns in Strudel's mini-language while an agent watches your code and answers questions, suggests variations, or helps you understand what a pattern does — all in real time without breaking your flow.

Motivation

I feel guilty aboiut neglecting my music hobby and thought this would be a neat way to use my limited free time to cover two or three of my interests. It ended up being an off-beat (ha!) precursor to piclaw instead.

How it works

A Bun-based server hosts the Strudel editor and exposes a WebSocket channel to the AI backend. The agent receives the current code buffer as context on each message so it can reason about what's running. Changes the agent suggests can be applied directly to the editor with a single click. Audio runs entirely in the browser via the Web Audio API.

Features
🎵
Strudel live coding

Full Strudel pattern language in the browser — cycles, mininotation, sample triggering, and MIDI output.

🤖
Agent-assisted composition

Chat with an AI agent that sees your current pattern and can suggest rhythms, harmonies, or explain what each function does.

One-click apply

Agent code suggestions appear as clickable diffs — apply them to the editor without copy-pasting.

🔊
Web Audio output

All synthesis runs in the browser with zero latency configuration — connect to MIDI or use the built-in synths.

🧩
Extensible backends

Swap out the AI backend by pointing the WebSocket URL at any OpenAI-compatible endpoint.

Architecture
Browser Strudel editor CodeMirror Chat sidebar AI messages Bun server HTTP + WebSocket MCP tools evaluate · set_tempo · get LLM provider OpenAI / Anthropic / local Web Audio SuperDough synthesis WebSocket AI-assisted live coding with Strudel.cc + MCP tools
Posts