Live microphone processing in the browser. Effects are formulas you can rewrite while the audio runs.
One statement per line. The value of the last line becomes the output sample. The code runs once per sample, per channel.
Any name you haven't declared as a parameter is state: it keeps its value into the next sample and starts at 0. That is how you write filters and envelopes.
Lines starting with # are directives, // is a comment.
#name My effect#param drive 4 1 40 — name, start, min, max. Becomes a slider.x input sample, −1…1t seconds, n sample countsr sample rate, ch channel (0 = left)pi, esin cos tan tanh atan exp log sqrt abs sign floor ceil round min max pow mod clamp noise
Four per effect, up to 2 seconds, fractionally interpolated. dw(v) writes, delay(n) reads n samples back. Lines 2–4 use dw2 delay2 … dw4 delay4.
Echo with feedback: d = delay(time*sr) then dw(x + d*fb) then x + d*mix.
+ - * / % ^ < > <= >= == != && || ! cond ? a : b
Any recirculating loop has a DC gain of 1/(1−g), so a small standing offset grows until it eats the headroom. DC block handles the input; inside your own loop, subtract it first: s = x - px + 0.997*s then px = x.
Each channel is processed on its own, so an effect can't mix left into right. Use ch to make the two sides behave differently.
Parameters glide over about 10 ms when you move a slider, so sweeps don't click.