Class NoteOnEvent

Abstraction of MIDI Note On event.

Useful for arrangements NoteEvent can't be produce.

See also:

Info:

  • License: MIT
  • Author: Pedro Alves Valentim

Functions

NoteOnEvent:new (fields) Creates a new NoteOnEvent.

Methods

NoteOnEvent:print () Prints event's data in a human-friendly style
NoteOnEvent:set_pitch (pitch) Sets NoteOnEvent's pitch
NoteOnEvent:set_velocity (velocity) Sets NoteOnEvent's velocity
NoteOnEvent:set_channel (channel) Sets NoteOnEvent's channel
NoteOnEvent:set_timestamp (timestamp) Sets NoteOnEvent's timestamp
NoteOnEvent:get_pitch () Gets pitch of NoteOnEvent
NoteOnEvent:get_velocity () Gets velocity of NoteOnEvent
NoteOnEvent:get_channel () Gets channel # of NoteOnEvent
NoteOnEvent:get_timestamp () Gets timestamp of NoteOnEvent


Functions

NoteOnEvent:new (fields)
Creates a new NoteOnEvent. Receives a fields table as parameter. This table is expected to have some (or all) of these fields:

Name Type Description
pitch string or number Note to be set on. Can be a string or valid MIDI note code. Format for string is C#4.
timestamp number Number of ticks between previous event and the execution of this event. Default: 0
velocity number How loud the note should sound, values 1-100. Default: 50
channel number MIDI channel to use. Default: 1

Note: pitch is the only required field

Parameters:

  • fields a table containing NoteOnEvent's properties

Returns:

    new NoteOnEvent object

Methods

NoteOnEvent:print ()
Prints event's data in a human-friendly style
NoteOnEvent:set_pitch (pitch)
Sets NoteOnEvent's pitch

Parameters:

  • pitch takes the same values as the pitch field passed to the constructor.

Returns:

    NoteOnEvent with new pitch
NoteOnEvent:set_velocity (velocity)
Sets NoteOnEvent's velocity

Parameters:

  • velocity number loudness of the note sound. Values from 1-100.

Returns:

    NoteOnEvent with new velocity
NoteOnEvent:set_channel (channel)
Sets NoteOnEvent's channel

Parameters:

  • channel number MIDI channel # (1-16).

Returns:

    NoteOnEvent with new channel
NoteOnEvent:set_timestamp (timestamp)
Sets NoteOnEvent's timestamp

Parameters:

  • timestamp number value.

Returns:

    NoteOnEvent with new timestamp
NoteOnEvent:get_pitch ()
Gets pitch of NoteOnEvent

Returns:

    NoteOnEvent's pitch value
NoteOnEvent:get_velocity ()
Gets velocity of NoteOnEvent

Returns:

    NoteOnEvent's velocity value
NoteOnEvent:get_channel ()
Gets channel # of NoteOnEvent

Returns:

    NoteOnEvent's channel value
NoteOnEvent:get_timestamp ()
Gets timestamp of NoteOnEvent

Returns:

    NoteOnEvent's timestamp value
generated by LDoc 1.4.6 Last updated 2020-02-28 01:36:33