0.0.1 • Published 7 years ago

node-ableton-push2 v0.0.1

Weekly downloads
6
License
ISC
Repository
github
Last release
7 years ago

NodeJs MIDI control library for Ableton Push 2

Parses MIDI messages from Ableton Push 2.
Includes MIDI mapping of buttons for Push 2.

Uses easymidi to parse and send MIDI messages to Push2.

Intentions for future development:
  • Add documentation for using Push2 and MidiMonitor classes
  • Add event listener wrappers to Push2 class
  • Add sysex commands for further control of lights (setting palette, etc).
  • Add support for Push 1. Maybe?

Installation

$ npm install node-ableton-push2

Usage

var ableton = require('node-ableton-push2');

var push2 = new ableton.Push2(port='both'); // Yay! A New Ableton Push 2!!
push2.monitor(); 	// Monitor and parse MIDI messages, printing them to console.log
push2.stopMonitor(); 		// Removes event listeners

push2.setColor([2,3],30); 		// Set track 2, scene 3 to color 30
push2.setColor("play",127); 	// Set play key to color 127 (red)
push2.setColor("record",17); 	// Set record key to color 17 (blueish)
push2.setColor("1/16t",70); 	// Set 1/16t button to color 70

// Listen to all MIDI messages 
push2.on('message', function(msg){console.log(msg);});

// Specific message types are supported, as in easymidi:
// noteon note [0-127] velocity [0-127] channel [0-15]
push2.on('noteon', function(msg){console.log("noteon",msg);});  
// noteoff note [0-127] velocity [0-127] channel [0-15]
push2.on('noteoff', function(msg){console.log("noteoff",msg);});
// poly aftertouch note [0-127]  velocity [0-127]  channel [0-15]
push2.on('poly aftertouch', function(msg){console.log("poly aftertouch",msg);});
// cc controller [0-127] value [0-127] channel [0-15]
push2.on('cc', function(msg){console.log("cc",msg);});
// program  number [0-127]  channel [0-15]
push2.on('program', function(msg){console.log("program",msg);});
// channel aftertouch  pressure [0-127] channel [0-15]
push2.on('channel aftertouch', function(msg){console.log("channel aftertouch",msg);});
// pitch  value [0-16384] channel [0-15]
push2.on('pitch', function(msg){console.log("pitch",msg);});
// position  value [0-16384] channel [0-15]
push2.on('position', function(msg){console.log("position",msg);});

Handy example scripts

First probe MIDI ports to make sure node can see your Push 2 with:

$ cd node-ableton-push2
$ node examples/show_ports.js

Input ports:
	Ableton Push 2 Live Port
	Ableton Push 2 User Port
Output ports:
	Ableton Push 2 Live Port
	Ableton Push 2 User Port

Monitor messages from Push 2.

$ node examples/monitor_push.js

Ableton Push 2 User Port { channel: 0, note: 36, velocity: 56, _type: 'noteon' }
 pad 1,8 pressed, velocity: 56
Ableton Push 2 User Port { channel: 0, note: 36, velocity: 0, _type: 'noteoff' }
 pad 1,8 released
Ableton Push 2 User Port { channel: 0, controller: 85, value: 127, _type: 'cc' }
 play: 127
Ableton Push 2 User Port { channel: 0, controller: 85, value: 0, _type: 'cc' }
 play: 0
...
^C

(Exit with ctrl+C)

References

Summary of MIDI Messages
Ableton Push 2 MIDI And Display Interface Manual

Message Reference

The following table from easymidi docs describes the MIDI message types that are supported and the parameters of each:

TypeParameterParameterParameter
noteonnote 0-127velocity 0-127channel 0-15
noteoffnote 0-127velocity 0-127channel 0-15
poly aftertouchnote 0-127velocity 0-127channel 0-15
cccontroller 0-127value 0-127channel 0-15
programnumber 0-127channel 0-15
channel aftertouchpressure 0-127channel 0-15
pitchvalue 0-16384channel 0-15
positionvalue 0-16384
mtctype 0-7value 0-15
selectsong 0-127
clock
start
continue
stop
reset