JSPM

  • Created
  • Published
  • Downloads 6213
  • Score
    100M100P100Q123408F
  • License MIT

Async MIDI library for Node.js and web-browsers

Package Exports

  • jzz

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jzz) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JZZ: Asynchronous MIDI Library

nodejs firefox chrome opera safari msie windows mocos linux raspberry pi ios android

JZZ.js allows sending, receiving and playing MIDI messages in Node.js and all major browsers in Linux, MacOS and Windows. Some features are available on iOS and Android devices.

For the best user experience, it's highly RECOMMENDED (though not required) to install the latest version of Jazz-Plugin and browser extensions from Chrome Web Store or Mozilla Add-ons.

Node.js module: npm install jzz.

Development version and minified scripts are available at Github.

Your questions and comments are welcome here.

We would really appreciate your support!

Usage

Plain HTML
<script src="scripts/JZZ.js"></script>
...
<script><!--
JZZ().or('Cannot start MIDI engine!')
     .openMidiOut().or('Cannot open MIDI Out port!')
     .wait(500).send([0x90,60,127])
     .wait(500).send([0x90,64,127])
     .wait(500).send([0x90,67,127])
     .wait(1000).send([0x90,60,0]).send([0x90,64,0]).send([0x90,67,0])
     .and('thank you!');
--></script>
CommonJS (Browserify and Node.js command line applications)
var JZZ = require('jzz');
JZZ().or('Cannot start MIDI engine!')
     .openMidiOut().or('Cannot open MIDI Out port!')
     .wait(500).send([0x90,60,127])
     .wait(500).send([0x90,64,127])
     .wait(500).send([0x90,67,127])
     .wait(1000).send([0x90,60,0]).send([0x90,64,0]).send([0x90,67,0])
     .and('thank you!');
AMD
require(['JZZ'], function(JZZ) {
  JZZ().or('Cannot start MIDI engine!')
       .openMidiOut().or('Cannot open MIDI Out port!')
       .wait(500).send([0x90,60,127])
       .wait(500).send([0x90,64,127])
       .wait(500).send([0x90,67,127])
       .wait(1000).send([0x90,60,0]).send([0x90,64,0]).send([0x90,67,0])
       .and('thank you!');
});
Helpers and shortcuts

All calls below will do the same job:

port.send([0x90,61,127]).wait(500).send([0x80,61,0]);   // arrays
port.send(0x90,61,127).wait(500).send(0x80,61,0);       // comma-separated
port.send(0x90,'C#5',127).wait(500).send(0x80,'Db5',0); // note names
port.noteOn(0,'C#5',127).wait(500).noteOff(0,'B##4');   // helper functions
port.note(0,'C#5',127,500);                             // another shortcut
MIDI input
JZZ().openMidiIn().or('MIDI-In:  Cannot open!')
     .and(function(){ console.log('MIDI-In: ', this.name()); })
     .connect(function(msg){console.log(msg.toString());})
     .wait(10000).close();

Check the Getting Started page and the API reference for more information ...