Description
Enumerator to identify the different MIDI file formats.
- Format 0: The data is stored in one single multi-channel track.
- Format 1: The data is stored in separate tracks to be played simultaneously.
MidiFileFormat.singleMultiChannelTrack refers to format 0 and MidiFileFormat.simultaneousTracks to format 1.
Format 2 is seldomly used and not supported.
Available in: Controller.
MIDI File Format Types
Name | Index |
---|---|
MidiFileFormat.singleMultiChannelTrack | 0 |
MidiFileFormat.simultaneousTracks | 1 |
Example
To explore the following script:
- Download Format 0.mid and Format 1.mid using the links below.
- 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
readMidiFile
to the location of the files on your system. - Execute the script.
-- detect the format of the MIDI files midiseq = {} midiseq[1] = readMidiFile("c:/temp/Format 0.mid") midiseq[2] = readMidiFile("c:/temp/Format 1.mid") --[[ please set the file path to the location of the files on your system before you run the script ]] for i, seq in ipairs(midiseq) do if seq.format == MidiFileFormat.singleMultiChannelTrack then print(seq.songname..".mid has MIDI file format 0.") elseif seq.format == MidiFileFormat.simultaneousTracks then print(seq.songname..".mid has MIDI file format 1.") else print("Midi file format of "..seq.songname.." not supported!") end end
Attachments: Format 0.mid, Format 1.mid