Strudel

From bfollington/terma · View interactive version

Strudel is an AI agent skill from the GitHub repository bfollington/terma. This skill should be used when working with Strudel.cc, a live-coding music environment. Use when creating musical patterns, drum sequences, melodies, basslines, or generative compositions. The user will always want to run Strudel code in the browser, either by copy-pasting or by providing a clickab

How to use this skill

Skill file

Strudel

Overview

Strudel is a browser-based live-coding environment that ports TidalCycles' pattern language to JavaScript. It uses pure functional programming to create musical patterns that can include drums, melodies, synthesis, and effects. Patterns are immutable query functions that transform time spans into event streams, supporting mini-notation DSL, Euclidean rhythms, and extensive audio processing.

When to Use This Skill

Use this skill when:

Core Workflow

1. Understanding the User's Musical Intent

When a user requests a pattern, clarify:

For genre/artist-specific techniques, consult references/genre-styles.md which provides:

2. Writing the Pattern

Build patterns using Strudel's functional, compositional approach:

Basic structure:

// Simple drum pattern
s("bd hh sd hh")

// With tempo
s("bd hh sd hh").cpm(120)

// Layered with stack
stack(
  s("bd(3,8)"),           // Kick drum
  s("hh*8"),              // Hi-hats
  s("~ sd ~ sd")          // Snare on backbeat
).cpm(120)

Key patterns:

3. Providing Output to the User

The user always wants to run the code in their browser. Provide both:

  1. The raw code - for copy-pasting into https://strudel.cc/
  2. An encoded URL - using scripts/strudel_url.py for immediate playback

When to encode URLs:

Encoding a URL:

python3 scripts/strudel_url.py encode 's("bd hh sd hh").cpm(120)'

This produces a clickable link like:

https://strudel.cc/#cygiYmQgaGggc2QgaGgiKS5jcG0oMTIwKQ%3D%3D

Present the URL as a clickable link the user can immediately open.

4. Iteration and Refinement

After the user tests the pattern, they may request modifications:

Provide the updated code for copy-pasting. Skip URL encoding during iterations unless requested.

Common Pattern Templates

Use templates from assets/patterns/ as starting points:

Reference these when users request similar styles.

Key Syntax Quick Reference

Mini-notation:

Common functions:

Effects:

For comprehensive syntax, consult references/strudel-reference.md which contains:

Search this file with grep when needed:

grep -i "euclidean" references/strudel-reference.md
grep -i "filter" references/strudel-reference.md
grep -i "delay" references/strudel-reference.md

Debugging Common Issues

Pattern not playing:

Timing issues:

Filter not working:

Code too complex:

Resources

scripts/strudel_url.py

Python script for encoding/decoding Strudel URLs.

Encode:

python3 scripts/strudel_url.py encode '<strudel-code>'

Decode:

python3 scripts/strudel_url.py decode '<strudel-url>'

Always encode URLs after creating or modifying patterns to provide clickable links.

references/strudel-reference.md

Comprehensive technical reference including:

Load this file when users need detailed syntax explanations or advanced techniques.

references/genre-styles.md

Genre and artist style guide including:

Each entry provides sonic characteristics and Strudel implementation techniques. Load when users reference specific genres or artists.

Search this file when needed:

grep -i "lorn" references/genre-styles.md
grep -i "techno" references/genre-styles.md
grep -i "ambient" references/genre-styles.md

assets/patterns/

Example pattern templates for common musical styles. Copy and adapt these as starting points:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.