Installations
npm install jzz
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
20.12.1
NPM Version
8.4.1
Score
78.8
Supply Chain
99
Quality
86.5
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (98.51%)
HTML (1.49%)
Developer
Download Statistics
Total Downloads
222,057
Last Day
54
Last Week
761
Last Month
7,618
Last Year
58,325
GitHub Statistics
529 Stars
626 Commits
28 Forks
13 Watching
1 Branches
6 Contributors
Package Meta Information
Latest Version
1.8.7
Package Id
jzz@1.8.7
Unpacked Size
371.42 kB
Size
58.78 kB
File Count
13
NPM Version
8.4.1
Node Version
20.12.1
Publised On
30 Nov 2024
Total Downloads
Cumulative downloads
Total Downloads
222,057
Last day
-58.5%
54
Compared to previous day
Last week
-32%
761
Compared to previous week
Last month
6.2%
7,618
Compared to previous month
Last year
26.9%
58,325
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
JZZ: MIDI library for Node.js and web-browsers
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.
JZZ.js enables Web MIDI API in Node.js and those browsers that don't support it, and provides additional functionality to make developer's life easier.
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 or Apple App Store.
Features
- MIDI In/Out
- User-defined MIDI nodes
- MIDI files
- MPE
- SMPTE
- UMP (MIDI 2.0)
- Additional modules
Install
npm install jzz --save
or yarn add jzz
or get the full development version and minified scripts from Github
Note: in the (unlikely) case you get into trouble installing the
midi-test module,
that requires special system configuration,
you can safely remove it from the devDependencies
by running npm remove midi-test --save-dev
.
Usage
Plain HTML
1<script src="JZZ.js"></script> 2//...
CDN (jsdelivr)
1<script src="https://cdn.jsdelivr.net/npm/jzz"></script> // the latest version, or 2<script src="https://cdn.jsdelivr.net/npm/jzz@1.8.7"></script> // any particular version 3//...
CDN (unpkg)
1<script src="https://unpkg.com/jzz"></script> // the latest version, or 2<script src="https://unpkg.com/jzz@1.8.7"></script> // any particular version 3//...
CommonJS
1var JZZ = require('jzz'); 2//...
TypeScript / ES6
1import { JZZ } from 'jzz'; 2//...
AMD
1require(['JZZ'], function(JZZ) { 2 //... 3});
Web MIDI API
(Node.js example)
1var navigator = require('jzz'); 2navigator.requestMIDIAccess().then(onSuccess, onFail); 3// ... 4navigator.close(); // This will close MIDI inputs, 5 // otherwise Node.js will wait for MIDI input forever. 6// In browsers the funcion is neither defined nor required.
JZZ API
MIDI Output/Input
1JZZ().or('Cannot start MIDI engine!') 2 .openMidiOut().or('Cannot open MIDI Out port!') 3 .wait(500).send([0x90,60,127]) // note on 4 .wait(500).send([0x80,60,0]); // note off 5JZZ().openMidiIn().or('Cannot open MIDI In port!') 6 .and(function() { console.log('MIDI-In: ', this.name()); }) 7 .connect(function(msg) { console.log(msg.toString()); }) 8 .wait(10000).close();
Connecting MIDI nodes
1var input = JZZ().openMidiIn(); 2var output = JZZ().openMidiOut(); 3var delay = JZZ.Widget({ _receive: function(msg) { this.wait(500).emit(msg); }}); 4input.connect(delay); 5delay.connect(output);
Helpers and shortcuts
1// All calls below will do the same job: 2port.send([0x90, 61, 127]).wait(500).send([0x80, 61, 0]); // arrays 3port.send(0x90, 61, 127).wait(500).send(0x80, 61, 0); // comma-separated 4port.send(0x90, 'C#5', 127).wait(500).send(0x80, 'Db5', 0); // note names 5port.noteOn(0, 'C#5', 127).wait(500).noteOff(0, 'B##4'); // helper functions 6port.note(0, 'C#5', 127, 500); // another shortcut 7port.ch(0).noteOn('C#5').wait(500).noteOff('C#5'); // using channels 8port.ch(0).note('C#5', 127, 500); // using channels
Asynchronous calls
1// in the environments that support async/await: 2async function playNote() { 3 var midi = await JZZ(); 4 var port = await midi.openMidiOut(); 5 await port.noteOn(0, 'C5', 127); 6 await port.wait(500); 7 await port.noteOff(0, 'C5'); 8 await port.close(); 9 console.log('done!'); 10} 11// or: 12async function playAnotherNote() { 13 var port = await JZZ().openMidiOut(); 14 await port.noteOn(0, 'C5', 127).wait(500).noteOff(0, 'C5').close(); 15 console.log('done!'); 16}
Virtual MIDI ports
1var logger = JZZ.Widget({ _receive: function(msg) { console.log(msg.toString()); }});
2JZZ.addMidiOut('Console Logger', logger);
3
4// now it can be used as a port:
5var port = JZZ().openMidiOut('Console Logger');
6// ...
7
8// substitute the native MIDIAccess
9// to make virtual ports visible to the Web MIDI API code:
10navigator.requestMIDIAccess = JZZ.requestMIDIAccess;
Frequency / MIDI conversion
1JZZ.MIDI.freq('A5'); // => 440
2JZZ.MIDI.freq(69); // => 440
3JZZ.MIDI.freq(69.5); // => 452.8929841231365
4// from frequency:
5JZZ.MIDI.midi(440); // => 69
6JZZ.MIDI.midi(450); // => 69.38905773230853
7// or from name:
8JZZ.MIDI.midi('A5'); // => 69
MIDI 2.0
MIDI2()
is an adapter that enables MIDI 2.0 in all subsequent chained calls.
MIDI1()
returns the operation back to MIDI 1.0.
Note that the downstream MIDI nodes don't require any special actions to receive and transfer MIDI 2.0 messages:
1var first = JZZ.Widget(); 2var second = JZZ.Widget(); 3var third = JZZ.Widget(); 4first.connect(second); 5second.connect(third); 6third.connect(function (msg) { console.log(msg.toString()); }); 7 8first 9 .send([0x90, 0x3c, 0x7f]) // 90 3c 7f -- Note On 10 .MIDI2() // enable MIDI 2.0 11 .send([0x20, 0x90, 0x3c, 0x7f]) // 20903c7f -- Note On 12 .MIDI1() // reset to MIDI 1.0 13 .send([0x90, 0x3c, 0x7f]) // 90 3c 7f -- Note On
When used with MIDI 2.0, most of MIDI 1.0 helpers require group
as an additional first parameter
and produce MIDI 1.0 messages wrapped into UMP packages.
Most of the new MIDI 2.0 helpers don't have corresponding MIDI 1.0 messages.
Use gr()
, ch()
and sxId()
calls to set default group
, channel
and SysEx ID
for the subsequent calls.
MIDI2()
and MIDI1()
clear off default group
, channel
, SysEx ID
and MPE
settings:
1first 2 .noteOn(5, 'C5', 127) // 95 3c 7f -- Note On 3 .ch(5).noteOn('C5', 127) // 95 3c 7f -- Note On 4 .MIDI2() 5 .noteOn(2, 5, 'C5', 127) // 22953c7f -- Note On 6 .gr(2).noteOn(5, 'C5', 127) // 22953c7f -- Note On 7 .ch(5).noteOn('C5', 127) // 22953c7f -- Note On 8 .MIDI2() 9 .noteOn(2, 5, 'C5', 127) // 22953c7f -- Note On 10 .ch(5).noteOn(2, 'C5', 127) // 22953c7f -- Note On 11 .MIDI2() 12 .umpNoteOn(2, 5, 'C5', 127) // 42953c00 007f0000 -- Note On 13 .gr(2).umpNoteOn(5, 'C5', 127) // 42953c00 007f0000 -- Note On 14 .ch(5).umpNoteOn('C5', 127) // 42953c00 007f0000 -- Note On
More on MIDI 2.0 support...
Additional modules
- JZZ-midi-SMF - Standard MIDI files: read / write / play
- JZZ-midi-GM - General MIDI instrument names: MIDI to string / string to MIDI
- JZZ-midi-Gear - Retrieve your MIDI device model and manufacturer
- JZZ-input-Kbd - Virtual piano controls for your MIDI projects
- JZZ-synth-Tiny - A tiny General MIDI synth implemented with the Web Audio API
- JZZ-gui-Select - MIDI Input/Output pickers
- JZZ-gui-Player - MIDI Player - ready for your page
- JZZ-gui-Karaoke - Karaoke :)
- etc... - Import third-party solutions into the JZZ framework
Testing your MIDI application
- midi-test - Virtual MIDI ports for testing MIDI applications
- web-midi-test - Fake Web MIDI API for testing Web MIDI applications
- jazz-midi-headless - MIDI for headless testing
- test-midi-files - A framework for producing test MIDI files
Check the Getting Started page and the API reference for more information...
Thanks for your support!
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/jazz-soft/JZZ/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/jazz-soft/JZZ/build.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/jazz-soft/JZZ/build.yml/master?enable=pin
- Warn: pipCommand not pinned by hash: .github/workflows/build.yml:10
- Warn: npmCommand not pinned by hash: .github/workflows/build.yml:14
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 0 out of 1 pipCommand dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3.4
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More