npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jzz-midi-gm

v1.3.9

Published

General MIDI / GM2 / GS / XG instrument names

Downloads

77

Readme

JZZ-midi-GM

npm npm build Coverage Status

General MIDI / GM2 / GS / XG instrument names: MIDI to string / string to MIDI

Install

npm install jzz-midi-gm
or yarn add jzz-midi-gm
or get the full development version and minified scripts from GitHub

Usage

Plain HTML
<script src="JZZ.js"></script>
<script src="JZZ.midi.GM.js"></script>
//...
CDN (jsdelivr)
<script src="https://cdn.jsdelivr.net/npm/jzz"></script>
<script src="https://cdn.jsdelivr.net/npm/jzz-midi-gm"></script>
//...
CDN (unpkg)
<script src="https://unpkg.com/jzz"></script>
<script src="https://unpkg.com/jzz-midi-gm"></script>
//...
CommonJS
var JZZ = require('jzz');
require('jzz-midi-gm')(JZZ);
//...
TypeScript / ES6
import { JZZ } from 'jzz';
import { GM } from 'jzz-midi-gm';
GM(JZZ);
//...
AMD
require(['JZZ', 'JZZ.midi.GM'], function(JZZ, gm) {
  // ...
});

API

MIDI to string

JZZ.MIDI.programName(midi) -
map MIDI program value to a General MIDI instrument name.

JZZ.MIDI.programName(midi, msb, lsb) -
map MIDI program value and bank msb/lsb to a GM2/GS/XG instrument name.

JZZ.MIDI.groupName(midi) -
map MIDI program value to a General MIDI group name.

JZZ.MIDI.percussionName(midi) -
map MIDI note value to General a MIDI percussion name.

console.log(JZZ.MIDI.programName(60));
// => 'French Horn'

console.log(JZZ.MIDI.programName(24, 0, 1));
// => 'Ukulele' (GM2)

console.log(JZZ.MIDI.groupName(60));
// => 'Brass'

console.log(JZZ.MIDI.percussionName(60));
// => 'Hi Bongo'

string to MIDI

JZZ.MIDI.programValue(str) -
map instrument name to a MIDI program (GM only); if there is no exact match, try the best guess.

JZZ.MIDI.noteValue(str) -
map percussion name to a MIDI note number; if there is no exact match, try the best guess.

JZZ.MIDI.guessValue(str) -
map program or percussion name (whatever matches best) to a MIDI value; if the return value is negative, it's the percussion note value with a minus sign, otherwise, it's the program value.

console.log(JZZ.MIDI.programName(JZZ.MIDI.programValue('piano')));
// => 'Acoustic Grand Piano'

console.log(JZZ.MIDI.percussionName(JZZ.MIDI.noteValue('snare')));
// => 'Acoustic Snare'

var n = JZZ.MIDI.guessValue('crash');
if (n < 0) console.log(JZZ.MIDI.percussionName(-n));
else console.log(JZZ.MIDI.programName(n));
// => 'Crash Cymbal 1'

list all instruments

allGM2() / allGS() / allXG() -
return a complete list of GM2/GS/XG programs as an array of of triplets [program-number, bank-msb, bank-lsb].

JZZ helpers

note(...) / noteOn(...) / noteOff(...) / aftertouch(...) / program(...) -
when the module is loaded, JZZ helper functions will understand the instrument names where appropriate.

JZZ().openMidiOut()
  .ch(0).program('accordion').noteOn('C#6', 100)
  .ch(9).noteOn('cowbell', 127);

Demo

https://jazz-soft.net/demo/GmGsXg.html

More information

Please visit https://jazz-soft.net for more information.