var midiConnector = require('midi-launchpad').connect(midiport);
A simple node module to use the Novation Launchpad.
Add any bugs to the issues page on github.
npm install midi-launchpad
require the module and set the midi port to use
var midiConnector = require('midi-launchpad').connect(midiport);
wait for the connector to be ready
midiConnector.on("ready",function(launchpad) {
console.log("Launchpad ready");
});
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;
turn all buttons off
launchpad.clear();
light up all buttons
launchpad.allLight(color);
get a button
var button = launchpad.getButton(1,1);
light up a button
button.light(color);
display a chatacter on the launchpad
launchpad.displayCharacter("S", color);
display a string by flashing between the characters
launchpad.displayString("@sydlawrence", color);
use the launchpad as a scrolling display
launchpad.scrollString("@sydlawrence", color);
render specific colors in specific buttons all at once
launchpad.renderBytes(
[
" gg gg ",
"g g g g",
"ggg ggg",
" g ",
" g ",
"g gg g",
" g g ",
" gggg ",
the top special row
"rrr rrr",
]
);
button press
button.on("press", function() {
console.log("ouch, my eye -_ಠ");
});
button release
button.on("release", function() {
console.log("thanks, that's better ಠ_ಠ");
});
any press
launchpad.on("press", function(btn) {
console.log("Pressed: "+
"x:" +btn.x +", "+
"y:" +btn.y +", "+
"state:" +btn.getState() +", "+
"special:" +btn.special
);
});
any release
launchpad.on("release", function(btn) {
console.log("Released: "+
"x:" +btn.x +", "+
"y:" +btn.y +", "+
"state:" +btn.getState() +", "+
"special:" +btn.special
);
});