Midiplex
Converge multiple data streams into one MIDI output
Automated test coverage currently incomplete
Example
var Midiplex = var mp = //...//Set up some sort of sensor input stream//... mp
A full-fledged example is also available
API
Midiplex#addNoteStream(stream, opts)
Takes bytes from the given stream and turns it into notes using the given options. opts
is an object and has the following defaults:
minVal: 0 //Minimum input value maxVal: 255 //Maximum input value (cannot be higher than 255) minOut: 60 //Minimum output note maxOut: 71 //Maximum output note (cannot be higher than 127) channel: this //MIDI channel to output on maxLen: 1000 //Maximum note length staticVelocity: 64 //Constant velocity value for notes
Midiplex#addControllerStream
Takes bytes from the given stream and turns it into MIDI control data. opts
is an object and has the following defaults:
minVal: 0 //Minimum input value maxVal: 255 //Maximum input value (cannot be higher than 255) minOut: 0 //Minimum output value maxOut: 127 //Maximum output value (cannot be higher than 127) channel: this //MIDI channel to output on controller: 1 //Controller to modify (default is usually what a mod wheel is mapped to)
Midiplex#getMainChannel()
Returns the current default channel
Midiplex#setMainChannel(channel)
Sets the default channel
Midiplex#getReadableStream()
Returns a readable stream of the combined midi output stream generated by the input streams