midi-controller
Create buttons and note matrices from duplex midi streams for midi controllers such as Launchpad.
Install
$ npm install midi-controller
Example
var MidiStream = var MidiController = var duplexStream = var launchpad = // clear launchpadduplexStream var colors = green: 60 red: 13 amber: 63 amberLow: 29 var learnButton = launchpad // after 10 seconds change the button's off color to amberLow // flash the learn button red every second (with 100ms duration) // map launchpad grid to chromatic midi notes (starting at 30)var mapping = var offset = 30for var y=0;y<8;y++ for var x=0;x<8;x++ var id = y*16 + x mapping var noteMatrix = launchpadnoteMatrix noteMatrix // echo the notes back to light up buttons // screen synthvar onNotes = {}{ onNotesnote = }{ if onNotesnote onNotesnote = null } // highlight pressed notes when mixer button held downvar selectionReleases = var selecting = false noteMatrix var mixerButton = launchpad