Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Created February 14, 2016 22:25
Show Gist options
  • Save GavinJoyce/7525dd28efde68ff2a8e to your computer and use it in GitHub Desktop.
Save GavinJoyce/7525dd28efde68ff2a8e to your computer and use it in GitHub Desktop.
ableton push colors
var midi = require('midi');
var input = new midi.input();
for(var i=0; i<input.getPortCount(); i++) {
console.log(`PORT ${i}: ${input.getPortName(i)}`);
}
////
var MidiStream = require('midi-stream');
var push = MidiStream('Ableton Push 2 User Port');
function write(data) {
console.log('WRITE', data);
push.write(data);
};
function play(channel, note, velocity, at) {
setTimeout(() => write([channel, note, velocity]), at * 1000);
}
for(var i=0; i<=127; i++) {
for(var j=36; j<=99; j++) {
play(144, j, i, (i / 4) + (j/100));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment