This document explains technical details of the MIDI hardware interface class, MIDIIn.
MIDIIn is a simple and direct interface. When MIDI events come into SuperCollider, MIDIIn evaluates simple handler functions.
Certain MIDI messages are supported only through MIDIIn. These are: sysex, sysrt, smpte.
See the Using MIDI helpfile for practical considerations and techniques for using MIDI in SC.
MIDIIn links MIDI input received from the operating system to a set of user defined functions. Only one set of MIDI input handling functions can be active at a time, they are stored in the following class variables:
noteOff, noteOn, polytouch, control, program, touch, bend, sysex, sysrt, smpte
The first argument these functions receive is an unique identifier that specifies the source of the data.
searches for a connected MIDIEndPoint by name.
Add a Function or similar object to be evaluated whenever a particular MIDI message is received. This method is preferable to the setters below, since it will not overwrite any existing functions.
A Symbol indicating the message type to wait for, one of 'noteOn'
'noteOff'
, 'polytouch'
, 'control'
, 'program'
, 'touch'
, 'bend'
, 'sysex'
, 'sysrt'
, 'smpte'
, or 'invalid'
(for invalid sysex messages).
A Function or similar object to be evaluated when a message of the specified type is received. See the setters below for the arguments which will be passed at evaluation time.
Remove a Function or similar object from the list of those to be evaluated whenever a particular MIDI message is received. This method is preferable to the setters below, since it will leave any existing functions in place.
A Symbol indicating the message type, one of 'noteOn'
'noteOff'
, 'polytouch'
, 'control'
, 'program'
, 'touch'
, 'bend'
, 'sysex'
, 'sysrt'
, 'smpte'
, or 'invalid'
(for invalid sysex messages).
The Function or similar object to be removed.
Replace a Function or similar object in the list to be evaluated whenever a particular MIDI message is received with another one. This method is preferable to the setters below, since it will not overwrite any existing functions.
A Symbol indicating the message type to wait for, one of 'noteOn'
'noteOff'
, 'polytouch'
, 'control'
, 'program'
, 'touch'
, 'bend'
, 'sysex'
, 'sysrt'
, 'smpte'
, or 'invalid'
(for invalid sysex messages).
The Function or similar object to be replaced.
A Function or similar object to be evaluated when a message of the specified type is received. See the setters below for the arguments which will be passed at evaluation time.
By default this flag is true
and SuperCollider interprets incoming MIDI noteOn message with velocity 0 as noteOff messages. In case you do not want this automatic translation, you can set this flag to false
Connect to all possible MIDI inputs.
If set to true (default) it will print out the ports found in MIDIClient.init.
Disconnect from all MIDI inputs.
The methods below allow you to register a function to respond to a particular message type.
a Function evaluated whenever a MIDI noteOn message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI noteOff message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI polytouch message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI control change message (CC) is received. It is passed the following arguments:
a Function evaluated whenever a MIDI program change message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI after-touch message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI pitch wheel change message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI System Exclusive message is received. It is passed the following arguments:
a Function evaluated whenever a MIDI System Real-Time message is received. It is passed the following arguments:
Nibbles are sent in ascending order.
a Function evaluated whenever a MIDI smpte message is received. It is passed the following arguments: