uvi-script
Musical event scripting with Lua
Loading...
Searching...
No Matches
Events
function postEvent (e, delta)
 send a script event back to the script engine event queue.
 
function playNote (note, vel, duration, layer, channel, input, vol, pan, tune, slice, oscIndex)
 helper function to generate a note event.
 
function releaseVoice (voiceId)
 release a specific voice by sending it a note off message
 

Detailed Description

Event structure and event manipulation functions.

Events represent musical messages (notes, controllers, etc.) flowing through the system. This group provides functions to create, modify, post, and inspect events.

Event Structure:

Events are Lua tables with fields like:

Key Functions:

See also
Event Callbacks, Voice Manipulation

Function Documentation

◆ playNote()

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) target layer index in the range [1;Program.layers] or a table of layer indices (e.g. {1, 3}), 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) -- harmonize note
end
void onNote(table e)
event callback that will receive all incoming note-on events if defined.
function playNote(note, vel, duration, layer, channel, input, vol, pan, tune, slice, oscIndex)
helper function to generate a note event.
Definition api.lua:931
function postEvent(e, delta)
send a script event back to the script engine event queue.
Definition api.lua:842
See also
postEvent, releaseVoice, Keyswitch

◆ postEvent()

function postEvent ( e ,
delta  )

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

The event's layer field can be a single index or a table of indices (e.g. {1, 3}) to target multiple layers at once. When a table is provided, a separate event is dispatched for each layer.

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})
Event types.
Definition Engine.cpp:548
See also
playNote, releaseVoice

◆ releaseVoice()

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)
function releaseVoice(voiceId)
release a specific voice by sending it a note off message
Definition api.lua:1008
function wait(ms)
suspend the current thread callback execution for the given number of samples.
Definition wrapper.lua:39
See also
postEvent, playNote