home/ atoms/ strudel-params-take-patterns-not-thunks

Strudel method parameters accept patterns and signals, not JavaScript arrow functions — use sine/saw/rand for movement

Strudel’s chained methods (.lpf(), .gain(), .pan(), etc.) accept pattern values, numbers, or signal objects — not JavaScript thunk functions (() => ...). Passing an arrow function where a value or pattern is expected either throws an error or produces a static/garbage value. For time-varying movement, use Strudel’s signal objects: sine, saw, rand, or perlin, scaled with .range(lo, hi). For example, .lpf(sine.range(300, 1800)) creates a sweeping low-pass, not .lpf(() => 300 + Math.sin(Date.now()) * 750).

Examples

Wrong: .gain(() => 0.5 + Math.random() * 0.3) — may error or be static. Correct: .gain(rand.range(0.5, 0.8)) — randomized each cycle.

Assessment

Explain why .lpf(() => Math.random() * 2000) does not work in Strudel. Write the equivalent using a Strudel signal.

“Strudel params take patterns/values, not thunks — use signals (`sine`, `saw`, `r”
context/ · L5-debug/strudel.md · chunk 1