Giter Site home page Giter Site logo

josegallegos07 / launchpad-webmidi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lostinbrittany/launchpad-webmidi

0.0 2.0 0.0 23 KB

Interacting with a Novation Launchpad from your browser with the web MIDI API.

License: MIT License

HTML 2.56% JavaScript 97.44%

launchpad-webmidi's Introduction

Launchpad WebMIDI

Interacting with a Novation Launchpad from your browser with the web MIDI API.

This library is based on launchpad-mini library for Node. Node modules have been replaced with ES modules, Node midi replaced with Web MIDI API, and the connection workflow has been adapted, but most of the original library API works as usual. You can use launchpad-mini doc as a guid euntil the doc here will be completed.

Installation

  • Install via bower:

    bower install --save LostInBrittany/launchpad-webmidi
  • Install via yarn:

    yarn add https://github.com/LostInBrittany/launchpad-webmidi.git
  • Install via npm:

    npm install --save git+https://[email protected]/LostInBrittany/launchpad-webmidi.git

Usage

Currenly we use rollup to generate several versions of launchpad-webmidi:

  • A self-executing function, suitable for inclusion as a <script> tag
  • An ES module file
  • An UMD file

You can use the version you prefer in your app, we suggest using the ES module if your build tool understand it.

Example using ES Modules

<script type="module">
    import Launchpad from '../dist/launchpad-webmidi.es.js';

    let pad = new Launchpad();
    pad.connect().then(() => {     // Auto-detect Launchpad
        console.log('Launchpad connected')
        pad.reset(2);             // Make Launchpad glow yellow
        pad.on('key', k => {
            console.log(`Key ${k.x},${k.y} down: ${k.pressed}`, k);
            // Make button red while pressed, green after pressing
            pad.col(k.pressed ? pad.red : pad.green, k);
        });
    });
</script>

You can see the full example in examples/basic-with-esm.html and a slightly more complex one on examples/switch-color-with-esm.html.

Example using UMD

<script src='../dist/launchpad-webmidi.umd.js'></script>
<script>
    let pad = new Launchpad();
    pad.connect().then(() => {     // Auto-detect Launchpad
        console.log('Launchpad connected')
        pad.reset(2);             // Make Launchpad glow yellow
        pad.on('key', k => {
            console.log(`Key ${k.x},${k.y} down: ${k.pressed}`, k);
            // Make button red while pressed, green after pressing
            pad.col(k.pressed ? pad.red : pad.green, k);
        });
    });
</script>

You can see the full example in examples/basic-with-umd.html and a slightly more complex one on examples/switch-color-with-umd.html.

License

MIT License

launchpad-webmidi's People

Contributors

lostinbrittany avatar

Watchers

James Cloos avatar Jose Gallegos avatar

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.