Jazz-Soft.net

We make it sound!

Home » Documentation » JZZ.js » JZZ.midi.Gear

JZZ.midi.Gear

Retrieve the MIDI device model and manufacturer info.

How it works

Most MIDI devices, when receiving the ID Request SysEx (f0 7e 7f 06 01 f7),

respond with the ID Response SysEx (f0 7e xx 06 02 xx ... xx f7), which uniquely identifies the model.

JZZ.midi.Gear script extends the JZZ.MIDI.prototype with two functions:

isIdResponse() - returns true if the message is an ID Response SysEx, or false otherwise.

gearInfo() - if the message is an ID Response SysEx, returns the info object with the following members:

Example

// in Node.js:
var JZZ = require('jzz');
require('jzz-midi-gear')(JZZ);
// or in HTML:
<script src="JZZ.js"></script>
<script src="JZZ.midi.Gear.js"></script>
JZZ({sysex:true}).and(function(){
  var inputs = this.info().inputs;
  var outputs = this.info().outputs;
  // enable message handlers on all MIDI-In ports:
  for (var i in inputs) this.openMidiIn(i).connect(function(msg){
    if (msg.isIdResponse()) {
      var gear = msg.gearInfo();
      console.log('ID Response SysEx received:');
      console.log('   port:    ' + this.name());
      console.log('   message: ' + msg);
      console.log('   brand:   ' + gear.brand);
      console.log('   model:   ' + gear.model);
      console.log('   device:  ' + gear.descr);
    }
  });
  // send the ID Request SysEx to all MIDI-Out ports:
  for (var i in outputs) this.openMidiOut(i).sxIdRequest();
});

The expected output will look similar to the following:

ID Response SysEx received:
   port:    Roland RD
   message: f0 7e 10 06 02 41 2b 02 00 00 00 01 00 00 f7
   brand:   Roland
   model:   RD-700GX
   device:  Digital Stage Piano

If your device was not identified correctly, we ebcourge you to let us know, so we could improve the script.

See also