greird / node-midi-launchpad

A simple node module for the Novation Launchpad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Launchpad Node Module: midi-launchpad

Sample

Docs

Docs are available at: http://sydlawrence.github.io/node-midi-launchpad/

Installation

npm install midi-launchpad

Usage

var midiConnector = require('midi-launchpad').connect();

// wait for the connector to be ready
midiConnector.on("ready",function(launchpad) {
  console.log("Launchpad ready, let's do something");
});

You can also manualy specify the midiport if needed: var midiConnector = require('midi-launchpad').connect(midiport); Note that midiport should be an integer.

Colors

  • launchpad.colors.off;
  • launchpad.colors.red.low;
  • launchpad.colors.red.medium;
  • launchpad.colors.red.high;
  • launchpad.colors.green.low;
  • launchpad.colors.green.medium;
  • launchpad.colors.green.high;
  • launchpad.colors.orange.low;
  • launchpad.colors.orange.medium;
  • launchpad.colors.orange.high;
  • launchpad.colors.yellow.low;
  • launchpad.colors.yellow.medium;
  • launchpad.colors.yellow.high;

You can also call for a random color : launchpad.randomColor()

Functions

turn off all the lights

launchpad.clear();

light up all buttons

launchpad.allLight(color);

display a chatacter on the launchpad

launchpad.displayCharacter("S", color);

display a mini digit the left or right side of the launchpad

launchpad.displayDigit(5, color, position); // position should be "left" or "right"

display a string by flashing between the characters

launchpad.displayString("@sydlawrence", color);

use the launchpad as a scrolling display

launchpad.scrollString("@sydlawrence", delay, color);

render specific colors in specific buttons all at once

  • " " to keep the state of the LED unchanged
  • 0 tu turn it "off"
  • y for yellow
  • r for red
  • g for green
  • o for orange
launchpad.renderBytes(
  [
    " gg  gg ",
    "g g  g g",
    "ggg  ggg",
    "    g   ",
    "    g   ",
    "g  gg  g",
    " g    g ",
    "  gggg  ",
    "rrr  rrr"  // the special row at the top
  ]
);

Buttons

get a button

var button = launchpad.getButton(1,1);

light up a button

button.light(color);

get the current color

button.getState();
button.x; // the x co-ord
button.y; // the y co-ord
button.special; // if the button is "special"

Events

button.on("press", callback);
button.on("release", callback);
launchpad.on("press", callback);
launchpad.on("release", callback);

Credits

© 2013 Syd Lawrence, We Make Awesome Sh


 /\___/\
( o   o )
(  =^=  )
(        )
(         )
(          )))))))))))

e   e  e eeee    eeeeeee eeeee eeeee eeee    eeeee e   e e  eeeee
8   8  8 8       8  8  8 8   8 8   8 8         8   8   8 8  8   "
8e  8  8 8eee    8e 8  8 8eee8 8e  8 8eee      8e  8eee8 8e 8eeee
88  8  8 88      88 8  8 88  8 88  8 88        88  88  8 88    88
88ee8ee8 88ee    88 8  8 88  8 88ee8 88ee      88  88  8 88 8ee88

githalytics.com alpha

About

A simple node module for the Novation Launchpad

License:MIT License


Languages

Language:JavaScript 100.0%