OPTIONS "C_CALL LABELCHECK NOSOURCE"
LIBRARY rexxgui, rxmidi
IF ARG() < 1 THEN DO
ERROR = guifile('FromFilename', 'EXISTING', 'Choose the MIDI file', 'MIDI files (*.mid, *.rmi) | *.mid;*.rmi | All files (*.*) | *.*')
IF ERROR \== "" THEN RETURN
END
ELSE fromfilename = ARG(1)
DO
MIDIOpenFile(fromfilename)
chan = 1
DO UNTIL chan = 17
err = MIDITrack('\')
IF err == 0 THEN RETURN
result = MIDIGetEvent("On Note", chan)
IF result == "" THEN DO
midievent.!type = 'Controller'
midievent.!data1 = 1
midievent.!data2 = 0
MIDISetEvent('BEFORE|INS|TIME|CHAN|DATA')
midievent.!data1 = 64
midievent.!data2 = 0
MIDISetEvent('BEFORE|INS|TIME|CHAN|DATA')
midievent.!data1 = 93
midievent.!data2 = 0
MIDISetEvent('BEFORE|INS|TIME|CHAN|DATA')
midievent.!data1 = 91
midievent.!data2 = 70
MIDISetEvent('BEFORE|INS|TIME|CHAN|DATA')
midievent.!data1 = 121
midievent.!data2 = 0
MIDISetEvent('BEFORE|INS|TIME|CHAN|DATA')
END
chan = chan + 1
END
MIDISaveFile(fromfilename)
CATCH ERROR
CONDITION('M')
RETURN
|