MIDI Files are managed through a special predefined table: the MIDI sequence table. This table allows you to change values and add or remove notes like with normal Lua tables, but the structure of that table must remain as defined below.
Available in: Controller.
MIDI Sequence Fields
The MIDI file format. It can be determined via names or indices.
The default is format 0. See MIDI File Format Types for details.
|enum or number|
The SMPTE format.
The default format is 0.
|.division||Specifies the ticks used for the SMPTE format. The default is 480 ticks.||number|
|.tempo||The original tempo in beats per minute. The default is 120 BPM.||number|
|.signature||The time signature of the MIDI file as a table. Numerator and denominator are separate fields of that table (see Signature Table below).||table|
|.songname||The name of the song.|
|.tracks||The tracks of the MIDI file as an array with the index starting at 1. Name, channel and event are separate fields of that table (see Tracks Table below)||table|
|.numerator||The numerator of the time signature. The default is 4.||number|
|.denominator||The denominator of the time signature. The default is 4.||number|
|.name||The name of the track.||string|
|.channel||The MIDI channel of the track. The default is 1.||number|
|.events||The events of the track as an array with the index starting at 1. The events are stored as Event objects.||table|
To explore the following script:
- Download C Major Scale.mid.
- Create an empty program and add a script module.
- Paste the script into the text editor of the script module and adjust the file path of
readMidiFileto the location of the file on your system.
- Execute the script.