Jazz-Soft.net

We make it sound!

Home » Documentation » JZZ.js » MIDI-Thru

MIDI-Thru

Starting from JZZ v.0.3.0, all MIDI nodes, including MIDI-In and MIDI-Out share the same API.

All MIDI nodes can stand on either side of the connect() and disconnect() functions, and/or receive MIDI messages via the send() and various helpers.

NOTE: The node connected after the MIDI-Out port, will most likely receive nothing, since, by default, MIDI-Out will consume the messages sent to it;

Messages sent to the MIDI-In port will appear unchanged on its other end.

However, this default behavior can be changed by redefining the object's _receive() function.

Creating MIDI nodes

JZZ.createNew(arg) - creates a MIDI node.

If arg is a not empty object, its properties will be copied to the new node.

Possible properties:

Example

var logger = JZZ.createNew();
logger._receive = function(msg) { console.log(msg.toString()); };

// or

var logger = JZZ.createNew({ _receive: function(msg) {
  console.log(msg.toString());
}});

// ...

JZZ().openMidiIn().connect(logger);

emit()

_emit(msg), emit(msg) - send MIDI event to the descendant nodes; _emit(msg) is synchronous, emit(msg) - asynchronous.

These functions are most often used by gadgets emulating MIDI-In devices.

Example

var delay = JZZ.createNew();
delay._receive = function(msg) { this.wait(500).emit(msg); };

Other calls

or(), and(), wait()

See also