/ HALion Developer Resource / HALion Script / Class Reference /
Event
The Event class describes the properties of events.
On this page:
Event Class, Event Constructor
Classes
Event Class
Description
The state of an Event object is described by the following fields.
Available in: Processor.
Fields
Field | Description | Value Type |
---|---|---|
.type | The type of event. See Event Types for details. | number |
.id | The ID of the event. | number |
.note | The note number in the range of 0 to 127. | number |
.velocity | The note-on velocity in the range of 0 to 127. | number |
.tuning | The tune offset in semitones. | number |
.controller | The controller number. See Controller Numbers for a description of the different controllers. | number |
.value | The value of a controller, pitch bend, or note expression event. The value range depends on the event type. | number |
.bend | The value of a pitch bend event in the range of -1.0 to 1.0. | number |
.noteExpressionType | The type of note expression event. See Note Expression Types for details. | number |
.data | An array with the bytes of a system exclusive message. For the interpretation of these values, please consult the documentation of the MIDI data format of the device sending the system exclusive message. (Since HALion 7.0) | table |
.dataType | Currently, there is only one data type (0 = sysex). (Since HALion 7.0) | number |
.ppqPosition | The position of the event in ppq relative to the project start. The host must be in playback, otherwise, this value will be 0.0. | number |
Fields per Event Type
Which of the fields are used depends on the Event Type.
Field | noteOn | noteOff | controller | noteExpression | noteRetrigger | data |
---|---|---|---|---|---|---|
.type | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
.id | ✅ | ✅ | - | ✅ | ✅ | - |
.note | ✅ | ✅ | - | - | ✅ | - |
.velocity | ✅ | ✅ | - | - | ✅ | - |
.tuning | ✅ | ✅ | - | - | ✅ | - |
.controller | - | - | ✅ | - | - | - |
.value | - | - | ✅ | ✅ | - | - |
.bend | - | - | ✅ | - | - | - |
.noteExpressionType | - | - | - | ✅ | - | - |
.data | - | - | - | - | - | ✅ |
.dataType | - | - | - | - | - | ✅ |
.ppqPosition | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Example
-- Print the fields of an Event object.
function onNote(event)
print(event)
postEvent(event)
end
function onRelease(event)
print(event)
postEvent(event)
end
function onController(event)
print(event)
postEvent(event)
end
function onNoteExpression(event)
print(event)
-- postEvent(event), not needed for note expression.
end
function onRetrigger(event)
print(event)
postEvent(event)
end
function onData(event)
print(event)
postEvent(event)
end
Constructors
Event Constructor
Event(type)
Description
Constructor to create a new Event object of the specified type.
Available in: Processor.
Arguments
Argument | Description | Value Type |
---|---|---|
type | The type of event. See Event Types for details. | enum or number |
Return Values
Returns a new Event object of the specified type.
❕ The fields of the Event object must be set after its creation.
Example
-- Create a new note-on event.
function onNote(event)
local newEvent = Event(EventType.noteOn)
newEvent.note = event.note + 12
newEvent.velocity = event.velocity
local id = postEvent(newEvent)
waitForRelease()
releaseVoice(id)
end