Surge XT's Formula modulator runs Lua scripts that read voice/MIDI state and output arbitrary modulation curves
The Formula shape turns a Surge XT LFO slot into a Lua scripting environment. Every instance must define a process function that sets the output variable (range -1 to 1 by default). The script can read state variables for envelope stages, LFO phase, MIDI velocity, pitch bend, poly aftertouch, MPE parameters, host tempo, sample rate, and more. Output can be an array of up to 8 independent values for multi-target modulation from one formula instance. A debugger panel shows real-time variable values and lets you step through code. The Surge prelude provides built-in utility functions. Formula modulators can retrigger AEG or FEG via retrigger_AEG / retrigger_FEG flags, making them capable of replacing both envelopes and LFOs.
Examples
A formula that reads state.velocity and state.key to output a modulation that both velocity-scales a filter sweep and transposes modulation speed by note pitch — impossible with standard LFOs alone.
Assessment
Name three state variables available to a Formula voice modulator but not to an S-LFO Formula. What is the purpose of clamp_output = false and why would you set it?