Created
February 14, 2016 22:25
-
-
Save GavinJoyce/7525dd28efde68ff2a8e to your computer and use it in GitHub Desktop.
ableton push colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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