/ 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

ArgumentDescriptionValue Type
eventEvent object of the type noteOff.Event

Fields

Note-off events use the following fields of the Event object.

FieldDescriptionValue Type
.typeThe type of event (2 = noteOff). See Event Types for details.number
.idThe note ID of the note-off event.number
.noteThe note number in the range of 0 to 127.number
.velocityThe note-off velocity in the range of 0 to 127.number
.tuningThe 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