Async MIDI made easy!
JavaScript HTML
Latest commit 9b00c41 Dec 13, 2016 Sema Added .gitattributes
Permalink
Failed to load latest commit information.
javascript Gracious degrade for no SysEx Aug 31, 2016
jzz Gracious degrade for no SysEx Aug 31, 2016
minified Gracious degrade for no SysEx Aug 31, 2016
.gitattributes Added .gitattributes Dec 13, 2016
.gitignore Initial commit Jul 13, 2015
Gruntfile.js Grunt May 3, 2016
README.md Bug fix Oct 20, 2015
package.json Grunt May 3, 2016
test.html Gracious degrade for no SysEx Aug 31, 2016
test.js port.close() Jul 26, 2015

README.md

JZZ: Asynchronous MIDI Library

nodejs firefox chrome opera safari msie windows mocos linux ios android

JZZ.js allows sending, receiving and playing MIDI messages in Node.js and all major browsers in Linux, MacOS and Windows.

It requires jazz-midi or Jazz-Plugin, and uses Chrome Web MIDI API and/or Web Audio as a fallback.

Limited support is available on iOS and Android devices.

Node.js module: npm install jzz.

Development version and minified scripts are available at Github.

Your questions and comments are welcome here.

You can also support this project.

Usage

Node.js
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!');
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>
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 ...