Skip to main content
Glama

Play Live Pattern

play-live-pattern
Read-only

Live-code music in Strudel (TidalCycles mini-notation in JavaScript) and play it in a player the user can edit. Layer drums, bass and melody with stack(): 71 drum-machine banks, 128 GM instruments, synths and a full effects chain. Add .pianoroll() for a live piano roll (or .punchcard()/.scope()/.spectrum(), one per pattern), pass visuals for a ready-made animation and theme for the editor colours. Each call creates a NEW player. Optional, when you want more (get-strudel-guide topic in brackets): shader backgrounds that follow the music — start with await initHydra(), lock to the beat with H(pattern), react to the sound with () => a.fft[0] ('hydra'); canvases, scenes and spoken lines for music videos and films ('stage', 'film'); taps, faders, pads and controls you draw, played by the user; tilt and mic, which follow the phone on the browser player (a chat's frame usually blocks them) ('interactive'); complete pieces ('gallery'). To jam back and forth, or to change a piece while it plays, pass session: true, then use update-session and get-session.

The Strudel REPL renders inline with an editable code editor, visualizations, and playback controls.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bpmNoTempo in BPM (40-300). Converts to setcps() automatically.
codeYesStrudel pattern code. Uses TidalCycles mini-notation in JavaScript. Use stack() to layer drums, bass, and melody. Set tempo with setcps(bpm/60/4) or use the bpm parameter. The REPL plays the LAST expression: setup lines (await initHydra(), all(), setcps()) go BEFORE the pattern. Double quotes are mini-notation — use single quotes for plain strings and URLs. One draw method per pattern; pass a.fft values as functions (() => a.fft[0]).
themeNoEditor colour scheme. It also sets the ground the visuals sit on, so pick a dark one when the visual is the point (e.g. 'nord', 'sonicPink', 'tokyoNight').
titleNoPattern title displayed in the widget header (e.g. 'Midnight Rain').
sessionNoOptional: keep this player open as a live session. update-session then swaps new code in on the bar, and get-session reports what played and what the user did. For a jam, or a piece you change while it plays. Give the user something to play — taps, a fader, a grid (topic 'interactive') — or they answer by editing the code and pressing Pass. The log is kept until 2 hours idle.
visualsNoA ready-made visual for code that has none of its own: pianoroll, punchcard, scope or spectrum (drawn behind the code), or hydra-kaleid, hydra-pulse, hydra-wash or hydra-feed (shader backgrounds). It only fills a layer the code leaves empty, and shaders are skipped for viewers who prefer reduced motion. Your own visual is the better result (topics 'visuals' and 'hydra').
autoplayNoStart playing immediately (default: true). May require user click due to browser autoplay policy.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / session / description
      Previous value: -"Open a LIVE SESSION: this player stays open as one performance. update-session swaps in new code on the next bar without a new player and says whether it ran; get-session reads the player's runtime reports and what the user did (taps, code edits, handing you the turn). Use it to iterate on a long piece, to check that a piece really played, or to jam back-to-back. Its log (reports, taps, edits, your updates) is kept on the server until 2 hours idle."New value: +"Optional: keep this player open as a live session. update-session then swaps new code in on the bar, and get-session reports what played and what the user did. For a jam, or a piece you change while it plays. Give the user something to play — taps, a fader, a grid (topic 'interactive') — or they answer by editing the code and pressing Pass. The log is kept until 2 hours idle."
    • changedInput schema / properties / theme / description
      Previous value: -"Editor colour theme; the visuals stage and its readability scrim are derived from it, so it also decides whether a shader sits on a dark or light ground — prefer a dark one when the visual is the point (e.g. 'nord', 'sonicPink', 'tokyoNight'). Not carried into share links or the browser fallback."New value: +"Editor colour scheme. It also sets the ground the visuals sit on, so pick a dark one when the visual is the point (e.g. 'nord', 'sonicPink', 'tokyoNight')."
    • changedInput schema / properties / visuals / description
      Previous value: -"Ready-made visual, for when the code has none of its own. pianoroll/punchcard/scope/spectrum draw onto the 2D canvas behind the code; hydra-kaleid (rotating kaleidoscope), hydra-pulse (shape driven by a rhythm), hydra-wash (slow ambient noise) and hydra-feed (the piano roll mirrored and trailed) are WebGL shader backgrounds. A preset fills the MISSING layer: a hydra preset is skipped only if the code already calls initHydra(), a 2D preset only if the code already has a draw method — so hydra-wash layers happily under your own .pianoroll(). Hydra presets are dropped for viewers who prefer reduced motion. Writing your own visual is still the better result (draw methods: topic 'visuals'; shaders: topic 'hydra')."New value: +"A ready-made visual for code that has none of its own: pianoroll, punchcard, scope or spectrum (drawn behind the code), or hydra-kaleid, hydra-pulse, hydra-wash or hydra-feed (shader backgrounds). It only fills a layer the code leaves empty, and shaders are skipped for viewers who prefer reduced motion. Your own visual is the better result (topics 'visuals' and 'hydra')."
  2. Changed1 schema field changed
    • addedInput schema / properties / session
      Added value: +{
      +  "description": "Open a LIVE SESSION: this player stays open as one performance. update-session swaps in new code on the next bar without a new player and says whether it ran; get-session reads the player's runtime reports and what the user did (taps, code edits, handing you the turn). Use it to iterate on a long piece, to check that a piece really played, or to jam back-to-back. Its log (reports, taps, edits, your updates) is kept on the server until 2 hours idle.",
      +  "type": "boolean"
      +}
  3. Changed3 schema fields changed
    • changedInput schema / properties / code / description
      Previous value: -"Strudel pattern code. Uses TidalCycles mini-notation in JavaScript. Use stack() to layer drums, bass, and melody. Set tempo with setcps(bpm/60/4) or use the bpm parameter."New value: +"Strudel pattern code. Uses TidalCycles mini-notation in JavaScript. Use stack() to layer drums, bass, and melody. Set tempo with setcps(bpm/60/4) or use the bpm parameter. The REPL plays the LAST expression: setup lines (await initHydra(), all(), setcps()) go BEFORE the pattern. Double quotes are mini-notation — use single quotes for plain strings and URLs. One draw method per pattern; pass a.fft values as functions (() => a.fft[0])."
    • changedInput schema / properties / theme / description
      Previous value: -"Editor colour theme — pick to match the mood (e.g. 'nord', 'sonicPink', 'githubLight')."New value: +"Editor colour theme; the visuals stage and its readability scrim are derived from it, so it also decides whether a shader sits on a dark or light ground — prefer a dark one when the visual is the point (e.g. 'nord', 'sonicPink', 'tokyoNight'). Not carried into share links or the browser fallback."
    • changedInput schema / properties / visuals / description
      Previous value: -"Ready-made visual, for when the code has none of its own. pianoroll/punchcard/scope/spectrum draw onto the 2D canvas behind the code; hydra-kaleid (rotating kaleidoscope), hydra-pulse (shape driven by a rhythm), hydra-wash (slow ambient noise) and hydra-feed (the piano roll mirrored and trailed) are WebGL shader backgrounds. Ignored if the code already visualises itself — writing your own .pianoroll() or initHydra() shader is still the better result (see get-strudel-guide topic 'visuals')."New value: +"Ready-made visual, for when the code has none of its own. pianoroll/punchcard/scope/spectrum draw onto the 2D canvas behind the code; hydra-kaleid (rotating kaleidoscope), hydra-pulse (shape driven by a rhythm), hydra-wash (slow ambient noise) and hydra-feed (the piano roll mirrored and trailed) are WebGL shader backgrounds. A preset fills the MISSING layer: a hydra preset is skipped only if the code already calls initHydra(), a 2D preset only if the code already has a draw method — so hydra-wash layers happily under your own .pianoroll(). Hydra presets are dropped for viewers who prefer reduced motion. Writing your own visual is still the better result (draw methods: topic 'visuals'; shaders: topic 'hydra')."
  4. Changed3 schema fields changed
    • addedInput schema / properties / code / maxLength
      Added value: +65536
    • addedInput schema / properties / theme
      Added value: +{
      +  "description": "Editor colour theme — pick to match the mood (e.g. 'nord', 'sonicPink', 'githubLight').",
      +  "enum": [
      +    "strudelTheme",
      +    "algoboy",
      +    "archBtw",
      +    "androidstudio",
      +    "atomone",
      +    "aura",
      +    "bbedit",
      +    "blackscreen",
      +    "bluescreen",
      +    "bluescreenlight",
      +    "CutiePi",
      +    "darcula",
      +    "dracula",
      +    "duotoneDark",
      +    "eclipse",
      +    "fruitDaw",
      +    "githubDark",
      +    "githubLight",
      +    "greenText",
      +    "gruvboxDark",
      +    "gruvboxLight",
      +    "sonicPink",
      +    "materialDark",
      +    "materialLight",
      +    "monokai",
      +    "noctisLilac",
      +    "nord",
      +    "redText",
      +    "solarizedDark",
      +    "solarizedLight",
      +    "sublime",
      +    "teletext",
      +    "tokyoNight",
      +    "tokyoNightDay",
      +    "tokyoNightStorm",
      +    "vscodeDark",
      +    "vscodeLight",
      +    "whitescreen",
      +    "xcodeLight"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / visuals
      Added value: +{
      +  "description": "Ready-made visual, for when the code has none of its own. pianoroll/punchcard/scope/spectrum draw onto the 2D canvas behind the code; hydra-kaleid (rotating kaleidoscope), hydra-pulse (shape driven by a rhythm), hydra-wash (slow ambient noise) and hydra-feed (the piano roll mirrored and trailed) are WebGL shader backgrounds. Ignored if the code already visualises itself — writing your own .pianoroll() or initHydra() shader is still the better result (see get-strudel-guide topic 'visuals').",
      +  "enum": [
      +    "none",
      +    "pianoroll",
      +    "punchcard",
      +    "scope",
      +    "spectrum",
      +    "hydra-kaleid",
      +    "hydra-pulse",
      +    "hydra-wash",
      +    "hydra-feed"
      +  ],
      +  "type": "string"
      +}
  5. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations cover the safety profile (readOnly, non-destructive, not idempotent), and the description adds substantial behavioral context beyond them: each call creates a NEW player, session logs persist until 2 hours idle, autoplay may need a user click, shaders are skipped for reduced-motion viewers, and `visuals` only fills an empty layer. This is exactly the extra context annotations cannot carry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action and the mechanism, then organized by optional capability with guide topics in brackets — an efficient structure. It is dense and occasionally list-like ('71 drum-machine banks, 128 GM instruments'), but almost every clause carries usable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 7-parameter tool with no output schema, the description covers the essential surface: what renders (inline REPL with editor, visuals, controls), the session lifecycle, and where to look for advanced topics. Nothing an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3, but the description adds real meaning beyond it: theme 'sets the ground the visuals sit on, so pick a dark one', visuals 'only fills a layer the code leaves empty', and session's bar-synced swap and idle-log retention. The `code` parameter guidance (quotes vs mini-notation, draw-method limits) also reinforces the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: live-coding Strudel music and playing it in an editable player, with detail on layering drums/bass/melody via stack(). It is clearly distinguishable from siblings like play-sheet-music or convert-abc-to-strudel, and even describes the rendered REPL widget.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Rich routing guidance: it explains when to pass `visuals`, `theme`, and `session: true`, and explicitly names the follow-up flow (update-session / get-session) plus the get-strudel-guide topics for extensions. It does not explicitly say when to choose a different sibling tool (e.g., play-sheet-music), so it falls just short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.