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 🙏

© 2026 – Pkg Stats / Ryan Hefner

midify

v0.1.1

Published

Makes working with Web MIDI more palatable.

Downloads

12

Readme

midify NPM version Dependency Status

Makes working with Web MIDI more palatable.

Install via npm:

npm install midify

What it does

midify is a package that combines node's event emitter with the browser's web midi api, to make working with midi messages more palatable. It is supposed to be used in combination with modules that expose input and output objects, so that clients can send events such as deckA.play.on (to light up the play button's LED), and to allow consuming modules to listen to events such as crossfader.change, which will call back with the value of the crossfader, as an example.

Note that midify is a work in progress, and currently only two devices are supported as they are all that I have access to. I'm hoping that those who are working with Web MIDI can help me to build up a library of easily consumable maps, so that we as developers can easily build MIDI applications to run on a wide range of devices, using a common format.

Compatible controllers are:

If you've created a map for your controller that is compatible with midify, please open an issue and it will be added to the list.

Example

Bundle this code with browserify. Note that Web MIDI is currently available behind a flag in Chrome, and remains unsupported in other browsers. To enable it in Chrome, go to chrome://flags and ensure that the Web MIDI option is on. As of this writing, MIDI support in Chrome is not quite plug and play capable, so you'll need to shut down Chrome and plug your device in before testing any code.

var Midify = require('midify');
var mixtrack = require('midify-numark-mixtrack-pro');

navigator.requestMIDIAccess().then(function(midiAccess) {
    var midiIn;
    var midiOut;

    // For brevity, we are just assuming one MIDI device is connected
    for (var input of midiAccess.inputs.values()) {
        midiIn = input;
    }

    for (var output of midiAccess.outputs.values()) {
        midiOut = output;
    }

    var midify = new Midify({
        midiIn: midiIn,
        midiOut: midiOut,
        controller: mixtrack
    });

    midify.on('*', function(event) {
        console.log('triggered', event, 'event');
    });

}, function() { console.error('MIDI access unavailable'); });

API

var midify = new Midify(options)

Construct a new midify instance. It takes an options object with three parameters; midiIn and midiOut should be retrieved from the midiAccess object, as per the example above, and the controller parameter accepts a module which exposes inputs and outputs objects.

midify.getLEDs()

Get an array of all the LED outputs; useful if you need to reset all of the lights on the controller:

midify.getLEDs().forEach(function(led) {
    midify.send(led + '.off');
});

midify.send()

Send a message to the controller. See the documentation for your controller to see which messages you can send.

midify.send('deckA.play.on');

midify.on()

midify just inherits from event emitter, so you can listen to events from your controller:

midify.on('masterGain.change', function(value) {
    console.log('volume changed', value);
});

As well as the namespaced events, midify will also emit *, so that you can listen to all messages for debugging purposes:

midify.on('*', function(event, value) {
    console.log(event, value);
});

Both of these events will also emit the full MIDI message object as the final parameter in the callback function; so to access the raw data you can also do:

midify.on('*', function(event, value, raw) {
    console.log(event, value, raw);
});

License

MIT © Ben Briggs