# node-ableton-push2

> NodeJs library for communicating with Ableton Push 2 over MIDI.

Latest version **0.0.1** (published 2017-09-27) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install node-ableton-push2
pnpm add node-ableton-push2
yarn add node-ableton-push2
bun add node-ableton-push2
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-09-27 |
| First published | 2017-09-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51 |
| Author | Sam Hiatt [samhiatt@gmail.com] |
| Maintainers | samhiatt |

## Links

- npm: https://www.npmjs.com/package/node-ableton-push2
- Repository: https://github.com/samhiatt/node-ableton-push2
- Homepage: https://github.com/samhiatt/node-ableton-push2#readme
- Issues: https://github.com/samhiatt/node-ableton-push2/issues
- npm.io page: https://npm.io/package/node-ableton-push2

## Dependencies (1)

- [easymidi](https://npm.io/package/easymidi.md) git://github.com/samhiatt/node-easymidi.git

## Recent versions

- 0.0.1 (latest) — 2017-09-27
- 0.0.0 — 2017-09-27

## README

# 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](https://github.com/dinchak/node-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

```javascript
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](https://www.midi.org/specifications/item/table-1-summary-of-midi-message)  
[Ableton Push 2 MIDI And Display Interface Manual](https://github.com/Ableton/push-interface/blob/master/doc/AbletonPush2MIDIDisplayInterface.asc)  



### Message Reference
The following table from [easymidi docs](https://github.com/dinchak/node-easymidi/blob/master/README.md) describes the MIDI message types that are supported and the parameters of each:

| Type               | Parameter          | Parameter        | Parameter      |
|--------------------|--------------------|------------------|----------------|
| noteon             | note [0-127]       | velocity [0-127] | channel [0-15] |
| noteoff            | note [0-127]       | velocity [0-127] | channel [0-15] |
| poly aftertouch    | note [0-127]       | velocity [0-127] | channel [0-15] |
| cc                 | controller [0-127] | value [0-127]    | channel [0-15] |
| program            | number [0-127]     |                  | channel [0-15] |
| channel aftertouch | pressure [0-127]   |                  | channel [0-15] |
| pitch              | value [0-16384]    |                  | channel [0-15] |
| position           | value [0-16384]    |                  |                |
| mtc                | type [0-7]         | value [0-15]     |                |
| select             | song [0-127]       |                  |                |
| clock              |                    |                  |                |
| start              |                    |                  |                |
| continue           |                    |                  |                |
| stop               |                    |                  |                |
| reset              |                    |                  |                |

---
_Source: https://npm.io/package/node-ableton-push2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
