npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@guillaumearm/ableton-push2

v0.1.1

Published

NodeJs library for communicating with the Ableton Push 2 MIDI controller.

Downloads

2

Readme

NodeJs MIDI control library for Ableton Push 2

Control your Ableton Push 2 with JavaScript!

This project implements the functions described in the Ableton Push 2 MIDI And Display Interface Manual.
See the command list in roadmap.md for a list of functions and an indication of if they have been implemented yet or not.

Auto-generated API documentation (thanks to typedoc.)

See midi.md for documentation on access to low-level MIDI messages.

Intentions for future development:
  • Add sysex commands for further control of lights (setting palette, etc).
  • Add support for Push 1. Maybe?

Installation

$ npm install ableton-push2

Usage

Usage examples

Get a new Push2. Oh yeah.
var ableton = require('ableton-push2');

// port can be 'user' (default) or 'live'
var push2 = new ableton.Push2(port='user'); // Boom! A New Ableton Push 2!!
Monitor control messages from Push 2.
push2.monitor(); 	// Monitor and parse MIDI messages, printing them to console.log
push2.stopMonitor(); 		// Stops printing Push2 midi messages to console.
Set pad or button LED colors:
// First argument can be either a key name from push2keymap
// or it can also be an array containing [track,scene] with values [[1-8],[1-8]]
// paletteIdx: color palette index [1-127]
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

TODO: Update and document interface for addressing buttons.

Touch strip configuration

Get touch strip configuration
push2.getTouchStripConfiguration()
	.then((resp)=>{
	  console.log(resp);
	}).catch(console.error);
// Output:
// TouchStripConfiguration {
//   LEDsControlledByHost: 0,
//   hostSendsSysex: 0,
//   valuesSentAsModWheel: 0,
//   LEDsShowPoint: 1,
//   barStartsAtCenter: 1,
//   doAutoReturn: 1,
//   autoReturnToCenter: 1 }
Set touch strip configuration

Returns a Promise which resolves after verifying that the value was set correctly.

Set all options at once:

var newConfig = {
		'LEDsControlledByPushOrHost':1,
		'hostSendsSysex': 0,
		'valuesSentAsModWheel': 0,
		'LEDsShowPoint': 1,
		'barStartsAtCenter': 1,
		'doAutoReturn': 1,
		'autoReturnToCenter': 1,
};
push2.setTouchStripConfiguration(newConfig).then((conf)=>{
  console.log("Touch strip configuration successfully set to:",conf);
}).catch(console.error);

Or you can specify just a subset of properties to change. Others remain unchanged.

push2.setTouchStripConfiguration({'LEDsControlledByPushOrHost':1}).then((conf)=>{
  console.log("Touch strip configuration successfully set to:",conf);
}).catch(console.error);
// Output:
// Touch strip configuration successfully set to: TouchStripConfiguration {
// LEDsControlledByHost: 1,
// hostSendsSysex: 0,
// valuesSentAsModWheel: 0,
// LEDsShowPoint: 1,
// barStartsAtCenter: 1,
// doAutoReturn: 1,
// autoReturnToCenter: 1 }
Reset touch strip confg to defaults

Calling setTouchStripConfiguration with no arguments will reset to defaults.

push2.setTouchStripConfiguration(); // Resets to defaults

It is not necessary to handle the callback if you don't care to validate the result.

Touch strip configuration options

See Touch Strip Configuration Documentation for details on how they work.

Control display backlight

Get/set display backlight brightness

Display backlight brightness ranges from 0 to 255. Note that when Push 2 is on USB power the brightness is automatically reduced to 100.

Push2.getDisplayBrightness returns a Promise.

push2.getDisplayBrightness()
	.then((value)=>console.log("Display brightness: "+value))
	.catch((err)=>console.log("Error getting display brightness.",err));

Push2.setDisplayBrightness also returns a Promise which resolves after verifying that the value was set correctly.

push2.setDisplayBrightness(200)
	.then(()=>console.log("Display brightness successfully set."))
	.catch((err)=>console.log("Error setting display brightness.",err));

Monitor raw MIDI Messages

Events from easymidi are accessible from the Push2.midi property.

See midi.md for more on low-level access to MIDI messages.

// Listen to all MIDI messages
push2.midi.on('message', console.log);

// Or listen to specific midi messages (easymidi message type names)
push2.midi.on('noteon', function(msg){
	console.log(`"noteon": note: ${msg.note}, velocity:${msg.velocity}, channel:${msg.channel}`);
});

Handy example scripts

A few handy scripts are included in scripts/.

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

$ cd node-ableton-push2
$ node scripts/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 scripts/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