Module lib.lfo

LFOs for general-purpose scripting

inspired by contributions from @markwheeler (changes), @justmat (hnds), and @sixolet (toolkit) added by @dndrks + @sixolet, with improvements by @Dewb and @sonoCircuit

The norns script reference has examples for this module.

Functions

new (shape, min, max, depth, mode, period, action, phase, baseline) construct an LFO
add (args) construct an LFO via table arguments eg.
start (from_parameter) start LFO
stop () stop LFO
set (var, arg) set LFO variable state
get (var) get LFO variable state
reset_phase () reset the LFO's phase
add_params (id[, sep[, group]]) Build parameter menu UI for an already-constructed LFO.


Functions

new (shape, min, max, depth, mode, period, action, phase, baseline)
construct an LFO

Parameters:

  • shape string The shape for this LFO (options: 'sine', 'tri', 'up', 'down', 'square', 'random'; default: 'sine')
  • min number The minimum bound for this LFO (default: 0)
  • max number The maximum bound for this LFO (default: 1)
  • depth number The depth of modulation between min/max (range: 0.0 to 1.0; default: 0.0)
  • mode string How to advance the LFO (options: 'clocked', 'free'; default: 'clocked')
  • period number The timing of this LFO's advancement. If mode is 'clocked', argument is in beats. If mode is 'free', argument is in seconds.
  • action function A callback function to perform as the LFO advances. This library passes both the scaled and the raw value to the callback function.
  • phase number The phase shift amount for this LFO (range: 0.0 to 1.0,; default: 0)
  • baseline string From where the LFO should start (options: 'min', 'center', 'max'; default: 'min')
add (args)

construct an LFO via table arguments eg. my_lfo:add{shape = 'sine', min = 200, max = 12000}

  • shape: (string) The shape for this LFO (options: 'sine', 'tri', 'up', 'down', 'square', 'random'; default: 'sine')
  • min: (number) The minimum bound for this LFO (default: 0)
  • max: (number) The maximum bound for this LFO (default: 1)
  • depth: (number) The depth of modulation between min/max (range: 0.0 to 1.0; default: 0.0)
  • mode: (string) How to advance the LFO (options: 'clocked', 'free'; default: 'clocked')
  • period: (number) The timing of this LFO's advancement. If mode is 'clocked', argument is in beats. If mode is 'free', argument is in seconds.
  • action: (function) A callback function to perform as the LFO advances. This library passes both the scaled and the raw value to the callback function.
  • phase: (number) The phase shift amount for this LFO (range: 0.0 to 1.0,; default: 0)
  • baseline: (string) From where the LFO should start (options: 'min', 'center', 'max'; default: 'min')

Parameters:

  • args
start (from_parameter)
start LFO

Parameters:

  • from_parameter
stop ()
stop LFO
set (var, arg)
set LFO variable state

Parameters:

  • var string The variable to target (options: 'shape', 'min', 'max', 'depth', 'offset', 'phase', 'mode', 'period', 'reset_target', 'baseline', 'action', 'ppqn')
  • arg various The argument to pass to the target (often numbers + strings, but 'action' expects a function)
get (var)
get LFO variable state

Parameters:

  • var string The variable to query (options: 'shape', 'min', 'max', 'depth', 'offset', 'phase', 'mode', 'period', 'reset_target', 'baseline', 'action', 'enabled', 'controlspec')
reset_phase ()
reset the LFO's phase
add_params (id[, sep[, group]])
Build parameter menu UI for an already-constructed LFO.

Parameters:

  • id string The parameter ID to use for this LFO.
  • sep string A separator name for the LFO parameters. (optional)
  • group string A group name for the LFO parameters. (optional)
generated by LDoc 1.5.0 Last updated 2024-10-13 17:45:04