MIDI-KIT is still “work-in-progress” and I haven’t done much coding in the last few months. This is its programming interface right of today, most of the stuff is working and tested. I haven’t released anything because I want the API being stable before.
Global functions
processMidi(midiPort, msg): Main entry point of the script. This function is called by the module on each incoming MIDI messagemsg, received from MIDI input portmidiPort(always 1 for this version).log(str): Prints stringstrto the display of the module.overlay(str1, [str2], [str3]): Displays stringstr1in an overlay widget.
input
input.enable(port): Enables input with indexport(1…4).input.getName(port): Callback function used by the module to display a tooltip text for the input. The default implementation can be replaced to display some additional information for the input.input.getVoltage(port, [channel]): Reads the current voltage on the input portport(1…4) of polyphonicchannel(1…16).input.isHigh(port, [channel]): Returns true if the voltage on input portport(1…4) of polyphonicchannel(1…16) is above 0.7V.input.isLow(port, [channel]): Returns true if the voltage on input portport(1…4) of polyphonicchannel(1…16) is below 0.7V.
trig
trig.getTicks([trigPort]): Returns the number of triggers on trigger porttrigPort(only 1 is supported in this version) since loading the script. IftrigPortis omitted the default trigger port is selected.trig.isHigh([trigPort]): Returns true if the voltage on trigger porttrigPort(only 1 is supported in this version) is above 0.7V. IftrigPortis omitted the default trigger port is selected.trig.isLow([trigPort]): Returns true if the voltage on trigger porttrigPort(only 1 is supported in this version) is below 0.7V. IftrigPortis omitted the default trigger port is selected.
param
param.enable(arg): Enables parameter with indexarg(1…4).param.getName(arg): Callback function used by the module to display a tooltip text for the parameter. The default implementation can be replaced to display some additional information for the parameter.param.getValueFormat(arg): This function is used by the module to display a formated value on the tooltip for the parameter. The default implementation can be replaced.param.getValue(arg): Reads the value of the parameter with indexarg(1…4). The return value is interval [0, 1].
number
number.ceil(arg): Computes the largest integer value not less thanarg.number.floor(arg): Computes the largest integer value not greater thanarg.number.max(arg1, arg2): Returns the greater of two arguments.number.min(arg1, arg2): Returns the smaller of two arguments.number.random(): Returns a random number of interval [0, 1).number.toString(arg): Convertsargto a string representation.
midi
midi.create(): Creates an empty MIDI message.midi.createNRPN(): Creates an empty NRPN MIDI message (actually 4 MIDI messages).midi.getChannel(msg): Returns the MIDI channel (1…16) ofmsg.midi.getLength(msg): Returns the length of the MIDI messagemsg, for all common messages this will return 3.midi.getNote(msg): Returns the MIDI note number (0…127) ofmsg(byte 2 of the MIDI message).midi.getSysExData(msg): Returns the data of a MIDI SysEx messagemsgas hexstring.midi.getPitchWheel(msg): Returns the MIDI pitch wheel (0…16383) value ofmsg.midi.getValue(msg). Returns the MIDI value field (0…127) ofmsg(byte 3 of the MIDI message).midi.isCc(msg): Returns true ifmsgis a MIDI CC message.midi.isChanPressure(msg): Returns true ifmsgis a MIDI channel pressure message.midi.isClock(msg): Returns true ifmsgis a MIDI clock message.midi.isContinue(msg): Returns true ifmsgis a MIDI continue message.midi.isNoteOff(msg): Returns true ifmsgis a MIDI note off message.midi.isNoteOn(msg): Returns true ifmsgis a MIDI note on message.midi.isPitchWheel(msg): Returns true ifmsgis a MIDI pitch wheel message.midi.isProgramChange(msg): Returns true ifmsgis a MIDI program change message.midi.isStart(msg): Returns true ifmsgis a MIDI start message.midi.isStop(msg): Returns true ifmsgis a MIDI stop message.midi.isSysEx(msg): Returns true ifmsgis a MIDI SysEx message.midi.setCc(msg, channel, cc, value): Setsmsgas a MIDI CC message with the specified MIDI channelchannel(1…16), CC numbercc(0…127) andvalue(0…127).midi.setCc14bit(msg1, msg2, channel, cc, value): Setsmsg1andmsg2as a 14-bit MIDI CC message pair, with the MIDI channelchannel(1…16), CC numbercc(0…127) andvalue(0…16383).midi.setChannel(msg, channel): Sets the MIDI channelchannel(1…16) formsg.midi.setChanPressure(msg, channel, value): Setsmsgas a MIDI channel pressure message, with MIDI channelchannel(1…16) and pressurevalue(0…127).midi.setKeyPressure(msg, channel, note, value): Setsmsgas MIDI key pressure/aftertouch message, with the MIDI channelchannel(1…16), MIDI note numbernote(0…127) and pressurevalue(0…127).midi.setNote(msg, note): Sets the MIDI note number (0…127) formsg(byte 2 of the MIDI message).midi.setNoteOff(msg, channel, note): Setsmsgas MIDI note off message, with MIDI channelchannel(1…16) and MIDI note numbernote(0…127). Please be aware, some MIDI devices need a MIDI note on message with velocity 0 instead of a MIDI note off message.midi.setNoteOn(msg, channel, note, velocity): Setsmsgas MIDI note on message, with MIDI channelchannel(1…16), MIDI note numbernote(0…127) andvelocity(0…127).midi.setNRPN(nrpn, channel, number, value): Sets the NRPN number and NRPN value ofnrpn.midi.setPitchWheel(msg, channel, value): Setsmsgas a MIDI pitch wheel message, with the specified MIDI channel (1…16) and pitch wheel value (0…16383).midi.setProgramChange(msg, channel, prg): Setsmsgas a MIDI program change message, with the MIDI channelchannel(1…16) and program numberprg(0…127).midi.setSysEx(msg, str): Setsmsgas a MIDI SysEx message with stringstrrepresenting a hexstring of data (e.g. “ab0fad050fdd”, whitespaces are ignored).midi.setValue(msg, value): Sets the MIDI value field (0…127) formsg(byte 3 of the MIDI message).
midiOut
midiOut.send([midiPort], msg): Sendsmsgon MIDI portmidiPort(default port = 1). IfmidiPortis omitted the default MIDI output port is used.midiOut.sendAfterMs([midiPort], msg, ms): Sendsmsgdelayed on MIDI portmidiPort(default port = 1). The delaymsis specified in milliseconds. IfmidiPortis omitted the default MIDI output port is used.midiOut.sendAfterTrigger([midiPort], msg, [trigPort], ticks): Sendsmsgdelayed on MIDI portmidiPort(default output = 1). The delay is specified inticksof triggers on CV trigger inputtrigPort. IfmidiPortis omitted the default MIDI output port is used. IftrigPortis omitted the default trigger port is selected.