Live Controls, 60fps Preset Banks & Modulators
Build 60fps click-free multi-mode consoles with presets() + P.slider(), standalone helpers (select(), pills(), toggle(), stepper(), slider()), portable // @ comment directives, Public vs. Private /listen gating, Auto-Sweep @slider LFOs, and 1-click Copy for strudel.cc vanilla export.
1. Declarative 60fps Preset Banks (presets() + P.slider())
Bind dozens of calibrated slider() parameters to a single public mode selector (@select dropdown or @pills bar) without centered-offset math or extra override toggles. When all reads of your preset bank go through P.slider(...), switching modes updates every fader simultaneously at 60fps with zero script re-evaluation or audio phase reset.
- Syntax:
const P = presets(initialKey, bankObject, { ui: "select" | "pills", label: "Mode", sliders: "private" | "public" });. - Mode display labels: Include
label: "Human Name"inside each mode entry (e.g.VIBE_CODING: { label: "Vibe Coding", macro: 1.05, ... }). - Positional or options-object `P.slider(...)`: Write
P.slider("macro", 0, 2, 0.01, "Master Macro")orP.slider("t.bass", { min: 0, max: 2, step: 0.02, label: "Trim: Bass" }). Nested dot-paths ("t.bass") read nested sub-objects cleanly. - Per-slider visibility override: Set
{ sliders: "private" }onpresets(...)to hide all bound sliders on/listen, then append.public()(or.listen()) on any single fader you still want to expose publicly. - 60fps click-free rule: As long as every live read uses
P.slider(...)(plus optional.private()/.public()/.label()), changing modes never glitches or restarts long-running LFO/entrainment phases. ReadingP.value("path"),P.get("path"), orP.keystill works cleanly when a switch genuinely changes non-slider code (shouldReevaluatefalls back to hot re-eval automatically).
| API / Option | Example | Behavior |
|---|---|---|
presets(key, bank, opts) | const P = presets("flow", { flow: {...}, sleep: {...} }, { ui: "select", label: "Mode", sliders: "private" }) | Renders 1 mode control (select or pills) and recalls bound sliders on switch |
P.slider(path, min, max, step, label?) | const cut = P.slider("t.cut", 200, 3200, 10, "Cutoff") | Registers a real-time 60fps slider initialized from active preset dot-path |
.private() / .public() | P.slider("macro", 0, 2, 0.01, "Depth").public() | Overrides bank sliders: "private" for a single exposed fader |
P.value(path) / P.key | const bankName = P.value("kit") | Reads non-numeric preset metadata (triggers clean Strudel re-eval on switch) |
Multi-Parameter Night Console (`presets()` + Nested `P.slider()`)
One public Listening Mode dropdown drives filter, atmosphere, and nested per-layer trims (`t.bass`, `t.pad`) at 60fps while keeping calibration faders private on /listen.
setCpm(32);
const P = presets("focus", {
focus: { label: "Deep Focus", cutoff: 1550, t: { bass: 0.72, pad: 0.42 } },
sketch: { label: "Sketch Flow", cutoff: 2400, t: { bass: 0.80, pad: 0.50 } },
nap: { label: "Power Nap", cutoff: 580, t: { bass: 0.55, pad: 0.34 } },
}, {
ui: "select",
label: "Listening Mode",
sliders: "private",
});
const cutoff = P.slider("cutoff", 260, 3600, 10, "Master Filter");
const trimBass = P.slider("t.bass", 0, 1.2, 0.02, "Trim: Bass");
const trimPad = P.slider("t.pad", 0, 1.2, 0.02, "Trim: Pad").public();
$: note("<c2 g1 ab1 g1>").s("lila_sub").lpf(cutoff).gain(trimBass);
$: chord("<Cm9 Gm7 Abmaj7 G7>").voicing().s("lila_pad").lpf(cutoff).room(0.55).gain(trimPad);2. Explicit Helper Functions (select(), pills(), toggle(), stepper(), slider())
Standalone self-documenting JS helpers that evaluate transparently to their active value while rendering interactive controls in both the Live Controls rack and inline CodeMirror widgets.
select(defaultVal, optionsArray, label?)— accepts values or[value, "Display Label"]pairs.pills(defaultVal, optionsArray, label?)— renders 1-click mode buttons in Sandbox and/listen.toggle(defaultVal, label?)— acceptstrue/falseor1/0.stepper(defaultVal, min, max, step, label?)— renders bounded-/+buttons.- Chain
.label("Name"),.private(), or.public()onslider(...)or control helpers — or add trailing// @private/| privatecomments.
Helper Function Syntax (`pills`, `select`, `toggle`, `stepper`)
Function-call helpers with optional [value, label] pairs and `.private()` chaining.
setCpm(30);
const kit = pills("tr808", [["tr808", "TR-808"], ["tr909", "TR-909"]], "Drum Machine");
const mode = select("C2:minor", [["C2:minor", "Night Minor"], ["D2:dorian", "Liquid Dorian"]], "Key");
const arpOn = toggle(true, "Arp Layer");
const arpSteps = stepper(4, 2, 8, 1, "Arp Speed").private();
$: s("bd ~ [~ bd] ~, ~ sd ~ ~, hh*8").bank(kit).gain(0.8);
$: arpOn ? n(run(arpSteps)).scale(mode).s("lila_pluck").lpf(1800).gain(0.45) : silence;4. Public /listen Exposure vs. Private Sandbox Controls (sliders: "private", .private(), @private)
By default, every control and slider() is public so listeners opening your creation on /listen or /embed can play with it. When your script has 20+ engineering or psychoacoustic calibration faders, hide internal controls so /listen listeners see ONLY your curated top-level mode switcher.
- In a preset bank, pass
sliders: "private"inpresets(..., { sliders: "private" })to hide allP.slider(...)faders automatically on/listen. - Chain
.private()on individual helpers or sliders (slider(0.5, 0, 1, 0.01).label("Bias").private()), or append| private/// @privatein comments. - Listeners on
/listenand/embedonly seepubliccontrols; Sandbox creators still see a lock-badgedPrivateshelf inside the sliders rack. - Important AST rule for comment tags: Hoist annotated sliders into top-level
const name = slider(...)declarations if using trailing// @label ... | privatecomments.
Put your cursor on any control or slider line and press Alt+Enter -> "Hide from /listen (@private)" or click the eye/lock icon directly on the control pill in the Live Controls rack.
Public Mode Dropdown + Private Calibration Sliders
Only the Entrainment Mode selector is public; the bank’s internal cutoff and gain sliders stay hidden on /listen via `sliders: "private"`.
setCpm(40);
// PUBLIC listener control — visible on /listen; private calibration faders stay inside Sandbox
const P = presets("vibe", {
vibe: { label: "Vibe Coding", cutoff: 1500, gain: 0.48 },
debug: { label: "Heavy Debug", cutoff: 1950, gain: 0.45 },
sketch: { label: "Sketching", cutoff: 1200, gain: 0.52 },
nap: { label: "Power Nap", cutoff: 620, gain: 0.40 },
sleep: { label: "Deep Sleep", cutoff: 340, gain: 0.34 },
}, {
ui: "select",
label: "Entrainment Mode",
sliders: "private",
});
const effCutoff = P.slider("cutoff", 220, 3600, 10, "Master Cutoff");
const effGain = P.slider("gain", 0.1, 0.9, 0.01, "Pad Gain");
$: chord("<Cm9 Fm9>").voicing().s("lila_pad").lpf(effCutoff).room(0.6).gain(effGain);
$: note("c2 ~ g1 ~").s("lila_sub").gain(0.65);5. Continuous Sliders (slider()) & Auto-Sweep @slider LFOs
Every slider(val, min, max, step) runs at 60fps in LILA without re-evaluating or clicking the audio graph. Toggle Auto-Sweep wave mode (∿) on any slider pill — or write a standard .range(min, max).slow(cycles) signal paired with a // @slider parked-value comment — to modulate smoothly with full strudel.cc compatibility.
- LFO Shapes:
sine,cosine,tri,itri,saw,isaw,square,perlin,rand. - Cycle Rates:
.slow(4)for a 4-bar sweep, omit for 1 cycle, or.fast(2)/.segment(16)for stepped rhythmic modulation. - Canonical Syntax:
const cutoff = sine.range(320, 2800).slow(4); // @slider 1100 step 10 | label: Master Filter(optional trailing| private). When turned back into a manual fader, LILA restores the parked manual fallback1100. - Sandbox Toolbar Mix Helpers: Pin (
P) a fader so randomizers skip it, clickMutatefor constrained variation around your active values, or store/recall snapshots in slotsM1–M3.
Calibrated Filter Slider with Auto-Sweep `@slider` LFO
The low-pass filter sweeps smoothly across 4 cycles between 320 Hz and 2800 Hz while retaining the parked manual value `1100`.
setCpm(31);
const cutoff = sine.range(320, 2800).slow(4); // @slider 1100 step 10 | label: Master Filter
const reso = slider(6, 1, 14, 0.5); // @label Filter Resonance
$: note("c2 eb2 g2 bb2 c3 bb2 g2 eb2")
.s("lila_acid")
.lpf(cutoff)
.lpq(reso)
.gain(0.7);6. 1-Click "Copy for strudel.cc" Vanilla Export
Want to share or archive a script built with LILA’s presets(), P.slider(), select(), pills(), toggle(), stepper(), .label(), or .private() extensions inside external vanilla strudel.cc? Click Copy for strudel.cc in the Sandbox More menu (or Cmd+K / Ctrl+K Command Palette).
- Zero LILA-only helpers: Compiles every
presets(...)declaration,P.slider(...)call,select()/pills()/toggle()/stepper()call, and.label()/.private()/.public()modifier chain out cleanly. - Live State Baked In: Active mode presets and any manually adjusted Sandbox slider values are baked directly into standard
slider(val, min, max, step)calls so the exported script sounds identical in vanilla Strudel. - Portable Comment Layer Preserved: Standard
slider()calls and Strudel patterns remain untouched and human-readable (no obfuscation or runtime wrappers).
3. Portable Comment Directives (
@select,@pills,@toggle,@stepper)Prefer zero-runtime metadata? Annotate any top-level
constprimitive (number,"string", orboolean) with a trailing// @...comment directive. The script stays 100% vanillastrudel.cc-valid JavaScript with no helper definitions needed.1,2,3or"flow","deep").true/falseor1/0). Follow with your control label (e.g.// @toggle Rhythmor// @toggle Rhythm | private).min..max step S), ideal for octaves or Euclidean pulse counts.value=Display Nameon any@selector@pillsoption so listeners see"Deep Sleep"while code keeps0or"sleep".@pillsconst MODE = "day"; // @pills day=Day Flow, nap=Power Nap, night=Deep Sleep/listen+ Sandbox)@selectconst MODE = 0; // @select 0=Vibe Coding, 1=Deep Debug, 2=Music Sketch, 3=Power Nap, 4=Deep Sleep | label: Focus Mode/listen+ Sandbox)@toggleconst DRUMS_ON = true; // @toggle Rhythm/listen+ Sandbox)@stepperconst PULSES = 5; // @stepper 1..16 step 1 | label: Euclidean Hits/listen+ Sandbox)Four Comment-Annotated Controls Together
Dropdown, segmented pills, boolean toggle, and stepped Euclidean pulses driving one synth groove.