uvi-script
Musical event scripting with Lua
Loading...
Searching...
No Matches
MidiEvent Class Reference

A Midi Event. More...

Public Member Functions

 MidiEvent (number timestamp, int channel, int status, int byte1, int byte2)
 creates a MidiEvent.
 

Public Attributes

int byte1
 MIDI byte 1 in range [0;127].
 
int byte2
 MIDI byte 2 in range [0;127].
 
int channel
 MIDI channel in range [0;15].
 
int type
 MIDI event type (Event.NoteOn | Event.NoteOff | Event.ControlChange | Event.ProgramChange | Event.PitchBend | Event.AfterTouch | Event.PolyAfterTouch)
 
int status
 alias for type: writing it sets the event type, leaving the channel untouched
 
number timestamp
 event timestamp in midi ticks, resolution is given by the MidiSequence's division (read-only).
 

Detailed Description

A Midi Event.

Constructor & Destructor Documentation

◆ MidiEvent()

MidiEvent::MidiEvent ( number timestamp,
int channel,
int status,
int byte1,
int byte2 )

creates a MidiEvent.

Note the argument order: the channel comes before the event type.

local noteOn = uvi.MidiEvent(0, 0, Event.NoteOn, 60, 100) -- channel 0, note 60, velocity 100
Event types.
Definition Engine.cpp:723
int channel
MIDI channel in range [0;15].
Definition Engine.cpp:769
Note
Two channel conventions coexist. The event tables handled by callbacks and postEvent() use 1-based channels in [1;16]; in a table passed to postEvent(), channel = 0 is also accepted and means omni (same as omitting the field). MidiEvent objects (postMidiEvent(), MidiSequence) carry the raw MIDI channel, 0-based in [0;15]. Channel 1 in an event table and channel 0 in a MidiEvent designate the same MIDI channel.
Parameters
timestampevent timestamp in midi ticks
channelMIDI channel in range [0;15]
statusMIDI status (Event.NoteOn | Event.NoteOff | Event.ControlChange | Event.ProgramChange | Event.PitchBend | Event.AfterTouch | Event.PolyAfterTouch)
byte1MIDI byte 1 in range [0;127]
byte2MIDI byte 2 in range [0;127]