Module lib.lattice
module for creating a lattice of sprockets based on a single fast "superclock"
The norns script reference has examples for this module.
Info:
- Release: v2.0
- Author: tyleretters & ezra & zack & rylee
Functions
new ([args]) | instantiate a new lattice |
start () | start running the lattice |
reset () | reset the norns clock without restarting lattice |
hard_restart () | reset the norns clock and restart lattice |
stop () | stop the lattice |
toggle () | toggle the lattice |
destroy () | destroy the lattice |
set_meter (_) | set_meter is deprecated |
auto_pulse (s) | use the norns clock to pulse |
pulse () | advance all sprockets in this lattice a single by pulse, call this manually if lattice.auto = false |
new_sprocket ([args]) | factory method to add a new sprocket to this lattice |
new_pattern (args) | new_pattern is deprecated |
order_sprockets () | "private" method to keep numerical order of the sprocket ids for use when pulsing |
Sprocket:new (args) | "private" method to instantiate a new sprocket, only called by Lattice:new_sprocket() |
Sprocket:start () | start the sprocket |
Sprocket:stop () | stop the sprocket |
Sprocket:toggle () | toggle the sprocket |
Sprocket:destroy () | flag the sprocket to be destroyed |
Sprocket:set_division (n) | set the division of the sprocket |
Sprocket:set_action (fn) | set the action for this sprocket |
Sprocket:set_swing (swing) | set the swing of the sprocket |
Sprocket:set_delay (delay) | set the delay for this sprocket |
Functions
- new ([args])
-
instantiate a new lattice
Parameters:
- args table optional named attributes are: - "auto" (boolean) turn off "auto" pulses from the norns clock, defaults to true - "ppqn" (number) the number of pulses per quarter cycle of this superclock, defaults to 96 (optional)
Returns:
-
table
a new lattice
- start ()
- start running the lattice
- reset ()
- reset the norns clock without restarting lattice
- hard_restart ()
- reset the norns clock and restart lattice
- stop ()
- stop the lattice
- toggle ()
- toggle the lattice
- destroy ()
- destroy the lattice
- set_meter (_)
-
set_meter is deprecated
Parameters:
- _
- auto_pulse (s)
-
use the norns clock to pulse
Parameters:
- s table this lattice
- pulse ()
- advance all sprockets in this lattice a single by pulse, call this manually if lattice.auto = false
- new_sprocket ([args])
-
factory method to add a new sprocket to this lattice
Parameters:
- args
table
optional named attributes are:
- "action" (function) called on each step of this division (lattice.transport is passed as the argument), defaults to a no-op
- "division" (number) the division of the sprocket, defaults to 1/4
- "enabled" (boolean) is this sprocket enabled, defaults to true
- "swing" (number) is the percentage of swing (0 - 100%), defaults to 50
- "delay" (number) specifies amount of delay, as fraction of division (0.0 - 1.0), defaults to 0
- "order" (number) specifies the place in line this lattice occupies from 1 to 5, lower first, defaults to 3
Returns:
-
table
a new sprocket
- args
table
- new_pattern (args)
-
new_pattern is deprecated
Parameters:
- args
- order_sprockets ()
- "private" method to keep numerical order of the sprocket ids for use when pulsing
- Sprocket:new (args)
-
"private" method to instantiate a new sprocket, only called by Lattice:new_sprocket()
Parameters:
- args
Returns:
-
table
a new sprocket
- Sprocket:start ()
- start the sprocket
- Sprocket:stop ()
- stop the sprocket
- Sprocket:toggle ()
- toggle the sprocket
- Sprocket:destroy ()
- flag the sprocket to be destroyed
- Sprocket:set_division (n)
-
set the division of the sprocket
Parameters:
- n number the division of the sprocket
- Sprocket:set_action (fn)
-
set the action for this sprocket
Parameters:
- fn the action
- Sprocket:set_swing (swing)
-
set the swing of the sprocket
Parameters:
- swing number the swing value 0-100%
- Sprocket:set_delay (delay)
-
set the delay for this sprocket
Parameters:
- delay fraction of the time between beats to delay (0-1)