len()

len()

Category

Envelope / Control

Description

Returns the current note length in samples. After note-off it includes the release time so release() and releasex() can fade without clicks.

Deprecated / compatibility function. New formulas should normally avoid len(). Prefer explicit time shaping with pos(), attack(), release(), releasex(), parameters, or envelope files so the patch behavior is clearer and more predictable.

Arguments

No arguments.

Typical Values

Use moderate values first, then increase modulation depth while listening for clipping, aliasing, or excessive filter resonance.

Example

exp(-2*pos()/len())

Notes

For pitched oscillator functions, X already contains the current MIDI note pitch and transpose information. Prefer saw(X), sin(X), or pwm(X, 0.4) unless you intentionally want an octave or ratio shift such as 0.5*X or 2*X.