← all scripts / norns

n-rg-rd

A small library to generate Nørgård infinity sequences for Norns

undisclosed Imported automatically; the author has not disclosed AI use yet

install

In maiden's REPL (the >> prompt at the bottom of the editor), run:

;install https://github.com/frederickk/noergaard

Or add the splines catalog to maiden and install it from the project manager. Restart norns if the script ships a new engine.

readme from frederickk/noergaard

Nørgård

v0.1.1

A small library to generate Nørgård infinity sequences for Norns.

Thank you to Ezra Buchla for his lua Nørgård algorithm and Lawton Hall for his Nørgård SuperCollider algorithms.


Install

You can install this library and demos via Maiden. Be sure to refresh the Community lists, and look for nørgård.

Otherwise, if you're a developer, pull down the library from Github and checkout the API below.


Usage

Look at the demos to see how the library can be used. The library itself is lib/noergaard.lua just add that file to your scripts folder, wherever you chose (I prefer lib/). Then add the following to your script.

local noergaard = include("path/to/noergaard")

Demos

Along with the library are 3 demos showing how to use the library.

noergaard-simple

Generates Nørgård infinity series and played using the PolyPerc engine. There are no controls, it just starts and goes on... infinitely

screenshot of noergaard-simple

noergaard-sequencer

A fairly simple sequencer that plays infinity sequence — uses PolyPerc engine and also outputs Midi notes (to device 1).

screenshot of noergaard-sequencer

Page Controller Description Values
All E1 Change page
1 E2 BPM 20 - 300
1 E3 note length 1/256 - 4
2 E2 Midi root C-2 - C8
2 E3 Scale type (see norns/musicutil.lua for full list); 0 = scale determined naturally by algorithm 0 - 46
3 E2 Step 1 – 12
3 E3 Sequence length; 0 = maximum (or 480) 0 - 320
4 E2 Loop at length true (1) or false (0)
4 E3 Increment 1 - 8

noergaard-chords

Generate chords from infinity series intervals — uses PolyPerc engine and also outputs Midi notes (to device 1). Thanks to Devine Lu Linvega for the keyboard.

screenshot of noergaard-chords

Page Controller Description Values
All E1 Change page
1 E2 BPM 20 - 300
1 E3 note length 1/256 - 4
2 E2 Midi root C-2 - C8
2 E3 Chord type (see norns/musicutil.lua for full list); 0 = build chord from sequence notes using amount determined by Chord length 0 - 26
3 E2 Step 1 – 12
3 E3 Sequence length; 0 = maximum (or 480) 0 - 320
4 E2 Loop at length true (1) or false (0)
4 E3 Chord length; only applies when Chord type is set to Noergaard 2 - 9

API

Noergaard.compute(t, step)

Nørgård algorithm to compute intervals. Thank you @zebra! https://llllllll.co/t/35657/9

Parameters

t a table containing at least 2 values

step (optional, default=1) new interval step

Returns

nothing; new value is appended to the table in-place

Noergaard.integer(index)

Returns integer in infinity series by index. https://www.lawtonhall.com/blog/2019/9/9/per-nrgrds-infinity-series

Parameters

index index of infinity series to calculate

Returns

Nørgård number

Noergaard.compute_subset(start_index, end_index)

Populates intervals table with Nørgård integers within a given range. https://www.lawtonhall.com/blog/2019/9/9/per-nrgrds-infinity-series

Parameters

start_index starting index of infinity series

end_index ending index of infinity series

Noergaard.step()

Adds interval to table, based on "start" and "step" params.

Noergaard.get_step()

Gets step increment.

Returns

Step interval

Noergaard.get_interval(index)

Gets interval.

Parameters

index (optional) interval index; no index returns last added interval

Returns

Interval

Noergaard.get_midi_note(index)

Gets Midi note number.

Parameters

index (optional) note index; no index returns last added note

Returns

Midi note number

Noergaard.get_midi_note_scale(scale_type, index)

Gets Midi note number, snapped to given scale.

Parameters

scale_type String defining scale type (eg, "major", "aeolian" or "neapolitan major"), see "musicutil" class for full list.

index (optional) note index; no index returns last added note

Returns

Midi note number

Noergaard.get_midi_root()

Gets Midi root note as name + octave e.g. "C4".

Returns

Midi root note

Noergaard.get_note_name(index)

Gets Midi note name e.g. "C".

Parameters

index (optional) note index; no index returns last added note

Returns

Midi note name

Noergaard.get_note_freq(index)

Gets note as frequency name e.g. C4 => "261.63".

Parameters

index (optional) note index; no index returns last added note

Returns

Note frequency

Noergaard.get_note_freq_scale(scale_type, index)

Gets note as frequency name e.g. C4 => "261.63", mapped to given scale

Parameters

scale_type String defining scale type (eg, "major", "aeolian" or "neapolitan major"), see "musicutil" class for full list.

index (optional) note index; no index returns last added note

Returns

Note frequency

Noergaard.set_octave(index)

Sets octave to lock Midi notes to.

Parameters

index (optional) Midi octave value -2 to 8; no index sets octave to "Natural".

Noergaard.get_octave()

Gets octave as string.

Returns

Octave value


Params

params:set("noergaard_start", num)

Sets seed starting value, setting/changing this will reset the interval values table; default = 0

params:get("noergaard_start")

Returns seed starting value

Range

0 – 12

params:set("noergaard_step", num)

Sets seed step value, setting/changing this will reset the interval values table; default = 1

params:get("noergaard_step")

Returns seed step value

Range

1 – 12

params:set("noergaard_midi_root", num)

Sets root (starting) note for all Midi subsequent notes.

params:get("noergaard_midi_root")

Returns Midi root (starting) note as number

Range

0 – 128

params:set("noergaard_octave", num)

Sets octave for notes returned any value above 0 locks the returned notes to that octave; default = 0 (or Natural)

params:get("noergaard_octave")

Range

  • 0: Natural, i.e. what the algorithm would naturally generate
  • 1: -2
  • 2: -1
  • 3: 0
  • 4: 1
  • 5: 2
  • 6: 3
  • 7: 4
  • 8: 5
  • 9: 6
  • 10: 7
  • 11: 8

params:set("noergaard_len", num)

Sets a specific maximum number for intervals, a value of 0 means no defined length, but the maximum is 480; default = 0

params:get("noergaard_len")

Range

0 – 480


References

discussion

Like this script? React with 👍 or ❤️ below (needs a GitHub account). Reactions count as likes (♥) on splines, updated daily.