Events

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...
 

Detailed Description

Events functions and structure reference.

Function Documentation

function postEvent ( ,
delta   
)

send a script event back to the script engine event queue.

Parameters
eevent 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
local id = postEvent({type=Event.NoteOn, note=60, velocity=100})
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
notethe note number in the range [0;127]
velocitythe 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:

function onNote(e)
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
idthe id of the voice to be released
Returns
return true if there was a voice to release with the given id

Example:

local id = playNote(note,vel)
wait(20)
See Also
postEvent, playNote
Examples:
legato.lua.
function controlChange ( cc  ,
val  ,
ch  ,
inp   
)

sends a ControlChange event.

Parameters
ccMIDI Control Change number
valMIDI Control Change value
ch(optional) MIDI channel
inp(optional) MIDI input
function programChange ( val  ,
ch  ,
inp   
)

sends a ProgramChange event.

Parameters
valMIDI Program Change value
ch(optional) MIDI channel
inp(optional) MIDI input
function pitchBend ( ,
ch  ,
inp   
)

sends a PitchBend event.

Parameters
bPitchBend value in [-1;1]
ch(optional) MIDI channel
inp(optional) MIDI input
function afterTouch ( ,
ch  ,
inp   
)

sends an AfterTouch event.

Parameters
vMIDI AfterTOuch value
ch(optional) MIDI channel
inp(optional) MIDI input
function polyAfterTouch ( ,
,
ch  ,
inp   
)

sends a PolyAfterTouch event.

Parameters
vMIDI AfterTouch value
nMIDI note number
ch(optional) MIDI channel
inp(optional) MIDI input