Giter Club home page Giter Club logo

zmidi's Introduction

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:

zmidi's People

Contributors

igorski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

imclab

zmidi's Issues

Sending MIDI data needs some love

the zMIDI.sendMessage()-method still requires knowledge of the MIDI message format. How about introducing more enumerated magic for easier two-way communication ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.