MIDI-KIT - script processor for MIDI - by stoermelder

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 message msg, received from MIDI input port midiPort (always 1 for this version).
  • log(str): Prints string str to the display of the module.
  • overlay(str1, [str2], [str3]): Displays string str1 in an overlay widget.

input

  • input.enable(port): Enables input with index port (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 port port (1…4) of polyphonic channel (1…16).
  • input.isHigh(port, [channel]): Returns true if the voltage on input port port (1…4) of polyphonic channel (1…16) is above 0.7V.
  • input.isLow(port, [channel]): Returns true if the voltage on input port port (1…4) of polyphonic channel (1…16) is below 0.7V.

trig

  • trig.getTicks([trigPort]): Returns the number of triggers on trigger port trigPort (only 1 is supported in this version) since loading the script. If trigPort is omitted the default trigger port is selected.
  • trig.isHigh([trigPort]): Returns true if the voltage on trigger port trigPort (only 1 is supported in this version) is above 0.7V. If trigPort is omitted the default trigger port is selected.
  • trig.isLow([trigPort]): Returns true if the voltage on trigger port trigPort (only 1 is supported in this version) is below 0.7V. If trigPort is omitted the default trigger port is selected.

param

  • param.enable(arg): Enables parameter with index arg (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 index arg (1…4). The return value is interval [0, 1].

number

  • number.ceil(arg): Computes the largest integer value not less than arg.
  • number.floor(arg): Computes the largest integer value not greater than arg.
  • 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): Converts arg to 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) of msg.
  • midi.getLength(msg): Returns the length of the MIDI message msg, for all common messages this will return 3.
  • midi.getNote(msg): Returns the MIDI note number (0…127) of msg (byte 2 of the MIDI message).
  • midi.getSysExData(msg): Returns the data of a MIDI SysEx message msg as hexstring.
  • midi.getPitchWheel(msg): Returns the MIDI pitch wheel (0…16383) value of msg.
  • midi.getValue(msg). Returns the MIDI value field (0…127) of msg (byte 3 of the MIDI message).
  • midi.isCc(msg): Returns true if msg is a MIDI CC message.
  • midi.isChanPressure(msg): Returns true if msg is a MIDI channel pressure message.
  • midi.isClock(msg): Returns true if msg is a MIDI clock message.
  • midi.isContinue(msg): Returns true if msg is a MIDI continue message.
  • midi.isNoteOff(msg): Returns true if msg is a MIDI note off message.
  • midi.isNoteOn(msg): Returns true if msg is a MIDI note on message.
  • midi.isPitchWheel(msg): Returns true if msg is a MIDI pitch wheel message.
  • midi.isProgramChange(msg): Returns true if msg is a MIDI program change message.
  • midi.isStart(msg): Returns true if msg is a MIDI start message.
  • midi.isStop(msg): Returns true if msg is a MIDI stop message.
  • midi.isSysEx(msg): Returns true if msg is a MIDI SysEx message.
  • midi.setCc(msg, channel, cc, value): Sets msg as a MIDI CC message with the specified MIDI channel channel (1…16), CC number cc (0…127) and value (0…127).
  • midi.setCc14bit(msg1, msg2, channel, cc, value): Sets msg1 and msg2 as a 14-bit MIDI CC message pair, with the MIDI channel channel (1…16), CC number cc (0…127) and value (0…16383).
  • midi.setChannel(msg, channel): Sets the MIDI channel channel (1…16) for msg.
  • midi.setChanPressure(msg, channel, value): Sets msg as a MIDI channel pressure message, with MIDI channel channel (1…16) and pressure value (0…127).
  • midi.setKeyPressure(msg, channel, note, value): Sets msg as MIDI key pressure/aftertouch message, with the MIDI channel channel (1…16), MIDI note number note (0…127) and pressure value (0…127).
  • midi.setNote(msg, note): Sets the MIDI note number (0…127) for msg (byte 2 of the MIDI message).
  • midi.setNoteOff(msg, channel, note): Sets msg as MIDI note off message, with MIDI channel channel (1…16) and MIDI note number note (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): Sets msg as MIDI note on message, with MIDI channel channel (1…16), MIDI note number note (0…127) and velocity (0…127).
  • midi.setNRPN(nrpn, channel, number, value): Sets the NRPN number and NRPN value of nrpn.
  • midi.setPitchWheel(msg, channel, value): Sets msg as a MIDI pitch wheel message, with the specified MIDI channel (1…16) and pitch wheel value (0…16383).
  • midi.setProgramChange(msg, channel, prg): Sets msg as a MIDI program change message, with the MIDI channel channel (1…16) and program number prg (0…127).
  • midi.setSysEx(msg, str): Sets msg as a MIDI SysEx message with string str representing a hexstring of data (e.g. “ab0fad050fdd”, whitespaces are ignored).
  • midi.setValue(msg, value): Sets the MIDI value field (0…127) for msg (byte 3 of the MIDI message).

midiOut

  • midiOut.send([midiPort], msg): Sends msg on MIDI port midiPort (default port = 1). If midiPort is omitted the default MIDI output port is used.
  • midiOut.sendAfterMs([midiPort], msg, ms): Sends msg delayed on MIDI port midiPort (default port = 1). The delay ms is specified in milliseconds. If midiPort is omitted the default MIDI output port is used.
  • midiOut.sendAfterTrigger([midiPort], msg, [trigPort], ticks): Sends msg delayed on MIDI port midiPort (default output = 1). The delay is specified in ticks of triggers on CV trigger input trigPort. If midiPort is omitted the default MIDI output port is used. If trigPort is omitted the default trigger port is selected.
4 Likes