Link search Menu Expand Document

norns script reference


Module Description
arc Connect a script to a hardware arc
audio Directly set system audio levels
clock Coroutine system which executes functions on beat-synced and free-running schedules
controlspec PARAM menu control constructor with presets
crow Connect a script to a hardware crow
encoders Decipher the norns on-board encoders
engine Register a SuperCollider engine
grid Connect a script to a hardware grid
hid Connect a script to HID hardware
keyboard Decipher keyboard (typing, not piano) input
metro High-resolution time-based counter
midi Connect a script to MIDI hardware
osc Connect a script to OSC streams
params Create script parameters, displayed in the PARAMETERS menu
poll System polling for CPU, incoming/outgoing amplitude, and incoming pitch
screen Draw to the norns on-board screen
softcut Two audio buffers which can be recorded into and played by six individual voices
tab Table utilities
util Helpful utility functions
lib/elca Elementary cellular automata generator
lib/envgraph Envelope graph drawing module
lib/er Euclidean rhythm generator
lib/fileselect File select utility
lib/filtergraph Filter graph drawing module
lib/filters Value smoother
lib/formatters PARAM menu formatter functions
lib/graph Graph drawing module
lib/intonation Library of various tunings, including 12 tone and gamuts
lib/lattice Simple and extensible sequencers driven by a superclock
lib/listselect List select utility
lib/musicutil Utility module for common music maths
lib/pattern Timed-event pattern recorder / player
lib/textentry Text entry UI
lib/ui UI widgets module
lib/voice Experimental voice allocation module

folder structure

Scripts are located in ~/dust/code/, and are what make norns do things. A script consists of at least a Lua file but can additionally also contain supporting Lua libraries, SuperCollider engines and data.

  myscript.lua -- main version, shows up as MYSCRIPT
  mod.lua -- alt version, shows up as MYSCRIPT/MOD -- main docs/readme
    myscript-01.pset -- pset, loaded via params:read(1) or via menu
    somelib.lua -- arbitrary lib, imported via require 'lib/somelib' -- engine file
    some-engine.lua -- engine lib, require lib/some-engine'
  docs/ -- more documentation, won't be shown in SELECT

basic script

-- scriptname: short script description
-- v1.0.0 @author
-- = 'PolySub'

function init()
  -- initialization

function key(n,z)
  -- key actions: n = number, z = state

function enc(n,d)
  -- encoder actions: n = number, d = delta

function redraw()
  -- screen redraw

function cleanup()
  -- deinitialization


Lua libraries can be used by using include("path/to/library"), remember not to include .lua in the library name.

local libraries

include() will first look in the directory of the current script. This allows using relative paths to use libraries local to the script. For example, with the following structure:


myscript.lua can include somelib.lua using:


third-party libraries

Third party libraries can be included using their full path starting from the ~/dust/code/ directory. For example, with the following structure in ~/dust/code/:


myscript.lua can include otherlib.lua using:



Specify an engine at the top of your script, see the engine docs for more details. = 'PolySub'

If you want to use an engine from another project make sure to install that project first. If the engine comes with an accompanying Lua file make sure to import it: = 'R'

local R = require 'r/lib/r'
  • engine.list_commands() shows the commands.

For example to set the command cutoff to 500:


To see a list of all locally installed engines:



The screen API handles drawing on the norns screen, see the screen docs for more details.

function redraw()
  screen.text("hello world")


The metro API allows for high-resolution scheduling, see the metro docs for more details.

re = metro.init()
re.time = 1.0 / 15
re.event = function()
  • re:start(), starts metro.
  • re:stop(), stops metro.


The paramset API allows to read and write temporary data and files, see the paramset docs for more details.

A parameter can be installed with the following:

params:add{type = "number", id = "someparam", name = "Some Param", min = 1, max = 48, default = 4}
  • params:set(index, value), writes a parameter.
  • params:get(index), reads a parameter.

system globals

Do not overwrite them. Doing so may break things.

System globals:

_G, _VERSION, assert, bit32, collectgarbage, dofile , error, getmetatable, ipairs, io, load,
loadfile, next, math, os, pairs, pcall, print, rawequal, rawget, rawlen, rawset, require,
select, setmetatable, tonumber, tostring, table, type, utf8, xpcall

Norns globals:

_menu, _norns, _path, _startup, arc, audio, cleanup, clock, controlspec, coroutine, crow,
debug, enc, engine, grid, hid, include, inf, key, metro, midi, mix, norns, osc, package,
params, paramset, paths, poll, redraw, screen, softcut, string, tab, util, wifi



grid.connect(n) to create device, returns object with handler, see the grid docs for more details.

g = grid.connect()
  • g:led(x, y, val), sets state of single LED on this grid device.
  • g:all(val), sets state of all LEDs on this grid device.
  • g:refresh(), update any dirty quads on this grid device.
  • g.key(x, y, state), key event handler function.


arc.connect(n) to create device, returns object with handler, see the arc docs for more details.

a = arc.connect()
  • a:led(ring, x, val), sets state of single LED on this arc device.
  • a:all(val), sets state of all LEDs on this arc device.
  • a:segment(ring, from, to, level), creates an anti-aliased point to point arc - segment/range on a specific LED ring.
  • a:refresh(), updates any dirty quads on this arc device.
  •, delta), encoder event handler function.


midi.connect(n) to create device, returns object with handler, see the midi docs for more details.

m = midi.connect()
  • m:note_on(value,velocity,channel), sends note_on message.
  • m:note_off(value,velocity,channel), sends note_off message.
  • m.event, midi event handler function.


hid.connect(n) to create device, returns object with handler, see the hid docs for more details.

h = hid.connect()


  • osc.send(to, path, args), sends osc event.
  • osc.event(path, args, from) handler function called when an osc event is received.


pdf version