Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

note

Global


Functions

note(...NoteValue)

->Note

Create a new monophonic or polyphonic note (a chord) from a number value, a note string, chord string or array of note values.

In note strings the following prefixes are used to specify optional note attributes:

 -'#' -> instrument (integer > 0)
 -'v' -> volume (float in range [0-1])
 -'p' -> panning (float in range [-1-1])
 -'d' -> delay (float in range [0-1])

examples:

note(48) --> middle C
note("c4") --> middle C
note("c4 #2 v0.5 d0.3") --> middle C with additional properties
note({key="c4", volume=0.5}) --> middle C with volume 0.5
note("c4'maj v0.7") --> C4 major chord with volume 0.7
note("c4", "e4 v0.5", "off") --> custom chord with a c4, e4 and 'off' note

note_number(note : NoteValue)

->integer

Convert a note string or note table to a raw MIDI note number in range 0-127 or 0xFF for nil or empty note strings or 0xFE for note offs

Examples:

note_value("c4") --> 48
note_value(note("c4")) --> 48
note_value("") --> 0xFF
note_value("off") --> 0xFE
note_value("xyz") --> error

Aliases

NoteValue

string | number | NoteTable | nil

Note


Properties

notes : NoteTable[]


Functions

transpose(self, step : integer | integer[])

->Note

Transpose the notes key with the specified step or steps.

Values outside of the valid key range (0 - 127) will be clamped.

examples:

note("c4"):transpose(12)
note("c'maj"):transpose(5)
note("c'maj"):transpose({0, 0, -12})

amplify(self, factor : number | number[])

->Note

Multiply the note's volume attribute with the specified factor or factors.

Values outside of the valid volume range (0 - 1) will be clamped.

examples:

note({"c4 0.5", "g4"}):amplify(0.5)
note("c'maj 0.5"):amplify({2.0, 1.0, 0.3})

volume(self, volume : number | number[])

->Note

Set the note's volume attribute to the specified value or values.

examples:

note({"c4", "g4"}):volume(0.5)
note("c'maj"):volume(0.5)
note("c'maj"):volume({0.1, 0.2, 0.3})

instrument(self, instrument : number | number[])

->Note

Set the note's instrument attribute to the specified value or values.

panning(self, panning : number | number[])

->Note

Set the note's panning attribute to the specified value or values.

delay(self, delay : number | number[])

->Note

Set the note's delay attribute to the specified value or values.

NoteTable


Properties

key : string | number

Note key & octave string (or MIDI note number as setter)

instrument : number?

Instrument/Sample/Patch >= 0

volume : number?

Volume in range [0.0 - 1.0]

panning : number?

Panning factor in range [-1.0 - 1.0] where 0 is center

delay : number?

Delay factor in range [0.0 - 1.0]