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

zmidi

v1.2.1

Published

Simple library providing an event based model for working with MIDI inside the browser

Downloads

12

Readme

zMIDI

zMIDI is a small JavaScript library that provides an easy interface to transfer messages from connected MIDI devices into your application and vice versa. zMIDI basically enables your web app to communicate with musical hardware.

Instead of you having to manually translate weird hexadecimal numbers or doing scary masking operations on incoming MIDI messages, zMIDI does the job for you and provides you with enumerated types in an Event-driven model, which makes both more sense in a JavaScript environment and allows for easier development by providing an adequate abstraction layer.

zMIDI is used by WebSID and Efflux, which you can try out live. See the demos section at the end of this README.

Installation

You can get zMIDI via NPM:

npm install zmidi

zMIDI has been written in modern vanilla JavaScript but comes with TypeScript annotations. The annotations rely on the type annotations for the WebMIDI API. You can install these in your project using:

npm install --save-dev @types/webmidi

Project integration

zMIDI is compatible with ES6 Modules, CommonJS, AMD/RequireJS or can be included in the browser via script tags:

ES6 module

import { zMIDI, zMIDIEvent, MIDINotes } from "zmidi";

CommonJS:

const ZMIDILib = require( "zmidi" );
const { zMIDI, zMIDIEvent, MIDINotes } = zMIDILib;

(you can subsequently use a tool like Browserify to build for the browser).

RequireJS

Use zmidi.amd.js inside the dist/-folder for a prebuilt, minimized AMD library transpiled to ES5.

require( [ "zmidi.amd" ], function( zMIDILib ) {
    // do something with zMIDILib-properties:
    // "zMIDI", "zMIDIEvent", "MIDINotes"    
});

Browser:

Use zmidi.min.js inside the dist/-folder for a prebuilt, minimized library transpiled to ES5.

<script type="text/javascript" src="./dist/zmidi.min.js"></script>
<script type="text/javascript">

    // do something with globally available actors:
    // "zMIDI", "zMIDIEvent", "MIDINotes"

</script>

Usage

Ensuring WebMIDI is available at the browser level

WebMIDI is still a W3C draft not implemented globally. Chrome users have already enjoyed this feature for years across desktop and mobile platforms with Edge and Opera users following suit.

You can consult this page to view the latest on browser support.

Really making sure WebMIDI is available at the application level

Query the result of zMIDI.isSupported() to really, really make sure it is available!

Making sure you meet Chrome's security standards

As of M75, Web MIDI API will now ask for permissions. As such, any app using it will have to be served over HTTPS. Chrome’s permission requiring feature is available only on secure origins so effectively only on these the MIDI API will be allowed. The secure origins meet the following format:

(https, *, *)
(wss, *, *)
(*, localhost, *)
(*, 127/8, *)
(*, ::1/128, *)
(file, *, — )
(chrome-extension, *, — )

Documentation / Wiki

You can view the online documentation here on Github :

https://github.com/igorski/zMIDI/wiki

Demos

To quickly see what zMIDI is capable of, you can try the following URL with a MIDI keyboard attached to your computer :

https://rawgit.com/igorski/zMIDI/master/examples/index.html

those on macOS might find this guide on creating a virtual MIDI output valuable.

for a demo that packs some more punch, try the following applications: