OPTIONS "C_CALL LABELCHECK NOSOURCE"
LIBRARY rexxgui, rxmidi
midierr = "ERROR"
midiheading = 1
IF guisay('This script creates a new MIDI file. Proceed?', 'YES|INFO', 'New MIDI') \= 'YES' THEN SIGNAL out
IF ARG() < 1 THEN DO
ERROR = guifile('FromFilename', 'OVERWRITE|SAVE', 'Enter a name for the new MIDI file', 'MIDI files (*.mid, *.rmi) | *.mid;*.rmi | All files (*.*) | *.*')
IF ERROR \= "" THEN RETURN
END
ELSE fromfilename = ARG(1)
IF TRANSLATE(RIGHT(fromfilename, 4)) \== ".MID" THEN fromfilename = fromfilename || '.mid'
DO
MIDIOpenFile()
midievent.!channel = 1
midievent.!measure = 1
midievent.!beat = 1
midievent.!clock = 0
midievent.!type = "Seq "
midievent.!data1 = 10
MIDISetEvent('INS|TIME|DATA', 1)
midievent.!type = "Trac"
midievent.!data1 = "Dummy"
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Inst"
midievent.!data1 = "Piano"
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Text"
midievent.!data1 = "Here's text"
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Time"
midievent.!data1 = 2
midievent.!data2 = 2
midievent.!data3 = 24
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Key "
midievent.!data3 = "G Major"
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Temp"
midievent.!data1 = 600000
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Port"
midievent.!data1 = 0
MIDISetEvent('INS|TIME|DATA')
midievent.!beat = 2
midievent.!type = "On N"
midievent.!data1 = MIDINoteNum("E3")
midievent.!data2 = 127
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!type = "Prog"
midievent.!data1 = 1
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!type = "Syse"
midievent.!data1 = "F0 01 F7"x
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "On N"
midievent.!data1 = MIDINoteNum("B3")
midievent.!data2 = 127
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!measure = 2
midievent.!beat = 1
midievent.!type = "Stop"
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "On N"
midievent.!data1 = MIDINoteNum("G#3")
midievent.!data2 = 127
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!beat = 2
midievent.!type = "(Off"
midievent.!data1 = MIDINoteNum("e3")
midievent.!data2 = ''
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!type = "Temp"
midievent.!data1 = 500000
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "(Off"
midievent.!data1 = MIDINoteNum("g#3")
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!measure = 3
midievent.!beat = 1
midievent.!type = "Firs"
midievent.!data1 = "F0 02"x
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Pack"
midievent.!data1 = "03"x
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "Last"
midievent.!data1 = "04 F7"x
MIDISetEvent('INS|TIME|DATA')
midievent.!measure = 4
midievent.!type = "Spec"
midievent.!data1 = "00 01 02 03"x
MIDISetEvent('INS|TIME|DATA')
midievent.!type = "(Off"
midievent.!data1 = MIDINoteNum("b3")
MIDISetEvent('INS|TIME|DATA|CHAN')
midievent.!clock = 30
midievent.!type = "End "
MIDISetEvent('INS|TIME')
MIDISaveFile(fromfilename)
CATCH ERROR
CONDITION('M')
END
RETURN |