Page tree
Skip to end of metadata
Go to start of metadata

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

event

 Event object of the type noteExpression.

Event

Fields

.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 root note and 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), not needed for note expression
end

1 Comment