Greets.
I’ve written a class that deals with MIDI (binary files) and MF2T (text files)
The class is based on:
http://www.dasdeck.de/staff/valentin/midi/documentation.htm
If you are looking for documentation on the methods, just read the above URL. This is a Lua port of the class, minus methods I didn’t find useful.
This is part of a tool I’m working on named MidiConvert. I estimate this class to be 2/5 of the total work needed. It’s a rewrite of XRNS2MIDI, but I also want to deal with importing to solve problems like this one.
I’m posting the class here to avoid duplicate efforts. If you want to help out, or just want to use the Midi class for your own ideas, well here it is.
Example usage:
require "Midi"
local example = Midi()
example:importMid("Scrapyard/test.midi")
print(example:getTxt())
-- rprint(example.tracks)
example:saveMidFile("/Users/dac514/Desktop/test1.mid")
Supported methods are:
- open
- setTempo
- getTempo
- setBpm
- getBpm
- setTimebase
- getTimebase
- newTrack
- getTrack
- getMsgCount
- addMsg
- insertMsg
- getMsg
- deleteMsg
- deleteTrack
- getTrackCount
- soloTrack
- transpose
- transposeTrack
- importTxt
- importTrackTxt
- getTxt
- getTrackTxt
- importMid
- getMid
- saveMidFile
Cheers.