/ HALion Developer Resource / HALion Script / Reference /
onRelease
onRelease(event)
Description
This callback function is called when the script module receives a note-off event.
Available in: Processor.
Arguments
Fields
Note-off events use the following fields of the Event object.
Field | Description | Value Type |
---|---|---|
.type | The type of event (2 = noteOff). See Event Types for details. | number |
.id | The note ID of the note-off event. | number |
.note | The note number in the range of 0 to 127. | number |
.velocity | The note-off velocity in the range of 0 to 127. | number |
.tuning | The tune offset in semitones. | number |
Example
-- Print all held notes.
local heldNotes = {}
function stringOfNotes()
local ret =""
for note, velocity in pairs(heldNotes) do
ret = ret.." "..tostring(note)
end
return ret
end
function onNote(event)
heldNotes[event.note] = event.velocity
print("Held notes:", stringOfNotes())
local id = postEvent(event)
end
function onRelease(event)
heldNotes[event.note] = nil
print("Held notes:", stringOfNotes())
postEvent(event)
end
See also: onNote, postEvent, playNote, releaseVoice, onRetrigger, setBypassNoteOff