/ HALion Developer Resource / HALion Script / Reference /

onNoteExpression

onNoteExpression(event)

Description

This callback function is called when the script module receives a note expression event.

❕ Note expression events are always processed by the engine, regardless of whether the event is posted or not. Therefore, the use of postEvent is not necessary.

Available in: Processor.

Arguments

ArgumentDescriptionValue Type
eventEvent object of the type noteExpression.Event

Fields

FieldDescriptionValue Type
.typeThe type of event (4 = noteExpression). See Event Types for details.number
.idThe ID of the associated note-on event.number
.noteExpressionTypeThe type of note expression event. See Note Expression Types for details.number
.valueThe note expression value in the range of 0 to 1.0.number

Example

-- Change note expression for the root note and a generated note.

local ids = {}
 
function onNote(event)
  local id = postEvent(event)
  ids[id] = playNote(event.note + 7, event.velocity)
  waitForRelease()
  ids[id] = nil
end
 
function onNoteExpression(event)
  if ids[event.id] then
    changeNoteExpression(ids[event.id], event.noteExpressionType, event.value)
  end
  -- postEvent(event) is not required for onNoteExpression.
end

See also: changeNoteExpression, getNoteExpression, Note Expression Types