Events functions and structure reference.
More...
function | postEvent (e, delta) |
| send a script event back to the script engine event queue. More...
|
|
function | playNote (note, vel, duration, layer, channel, input, vol, pan, tune, slice, oscIndex) |
| helper function to generate a note event. More...
|
|
function | releaseVoice (voiceId) |
| release a specific voice by sending it a note off message More...
|
|
function | controlChange (cc, val, ch, inp) |
| sends a ControlChange event. More...
|
|
function | programChange (val, ch, inp) |
| sends a ProgramChange event. More...
|
|
function | pitchBend (b, ch, inp) |
| sends a PitchBend event. More...
|
|
function | afterTouch (v, ch, inp) |
| sends an AfterTouch event. More...
|
|
function | polyAfterTouch (v, n, ch, inp) |
| sends a PolyAfterTouch event. More...
|
|
Events functions and structure reference.
function postEvent |
( |
e |
, |
|
|
delta |
|
|
) |
| |
send a script event back to the script engine event queue.
- Parameters
-
e | event to be sent |
delta | (optional) delay in ms to be applied to the event default to 0 |
- Returns
- the voice id if the event is of type Event.NoteOn nil otherwise
- See Also
- playNote, releaseVoice
- Examples:
- legato.lua, tremolo.lua, and vibrato.lua.
function playNote |
( |
note |
, |
|
|
vel |
, |
|
|
duration |
, |
|
|
layer |
, |
|
|
channel |
, |
|
|
input |
, |
|
|
vol |
, |
|
|
pan |
, |
|
|
tune |
, |
|
|
slice |
, |
|
|
oscIndex |
|
|
) |
| |
helper function to generate a note event.
if duration is greater than 0 the voice will be released after the given duration if duration is -1 the voice will be released when the note that created this callback is depressed if duration is 0 only the note-on is sent release has to be done manually using releaseVoice and the returned id
- Parameters
-
note | the note number in the range [0;127] |
velocity | the note velocity in the range [1;127] |
duration | (optional) duration of the note in milliseconds, default is -1 |
layer | (optional) default to nil: all layers |
channel | (optional) default to nil: all channels |
input | (optional) default to nil: all inputs |
vol | (optional) initial linear gain, default to 1 |
pan | (optional) initial pan in the range [-1;1], default to 0 |
tune | (optional) initial tuning in fractional semitones, default to 0 |
slice | (optional) sliceId to trigger if when targetting the slice oscillator |
oscIndex | (optional) oscillator index to trigger within one keygroup |
- Returns
- the voice id that will be created by this note-on event
Example:
local
id =
playNote(e.note+12, e.velocity)
end
- See Also
- postEvent, releaseVoice
- Examples:
- Chorder.lua, Ensemble.lua, InvertPitch.lua, Keyswitch.lua, legato.lua, monoBassLine.lua, portamento.lua, quarterTone.lua, TimbreShifting.lua, and Unison.lua.
function releaseVoice |
( |
voiceId |
) | |
|
release a specific voice by sending it a note off message
- Parameters
-
id | the id of the voice to be released |
- Returns
- return true if there was a voice to release with the given id
Example:
- See Also
- postEvent, playNote
- Examples:
- legato.lua.
function controlChange |
( |
cc |
, |
|
|
val |
, |
|
|
ch |
, |
|
|
inp |
|
|
) |
| |
sends a ControlChange event.
- Parameters
-
cc | MIDI Control Change number |
val | MIDI Control Change value |
ch | (optional) MIDI channel |
inp | (optional) MIDI input |
function programChange |
( |
val |
, |
|
|
ch |
, |
|
|
inp |
|
|
) |
| |
sends a ProgramChange event.
- Parameters
-
val | MIDI Program Change value |
ch | (optional) MIDI channel |
inp | (optional) MIDI input |
function pitchBend |
( |
b |
, |
|
|
ch |
, |
|
|
inp |
|
|
) |
| |
sends a PitchBend event.
- Parameters
-
b | PitchBend value in [-1;1] |
ch | (optional) MIDI channel |
inp | (optional) MIDI input |
function afterTouch |
( |
v |
, |
|
|
ch |
, |
|
|
inp |
|
|
) |
| |
sends an AfterTouch event.
- Parameters
-
v | MIDI AfterTOuch value |
ch | (optional) MIDI channel |
inp | (optional) MIDI input |
function polyAfterTouch |
( |
v |
, |
|
|
n |
, |
|
|
ch |
, |
|
|
inp |
|
|
) |
| |
sends a PolyAfterTouch event.
- Parameters
-
v | MIDI AfterTouch value |
n | MIDI note number |
ch | (optional) MIDI channel |
inp | (optional) MIDI input |