Giter Site home page Giter Site logo

max4node's Introduction

Ableton Live API for Node.js (through Max for Live)

This module exposes the Live Object Model so that it can be consumed directly from Node.js. It works by communicating with a Max for Live device (included in the repo) through udp sockets.

Requirements

  • Ableton Live 9
  • Max for Live (tested with version 7, might work with 6)

By default, the module binds on ports 9000 and 9001, so they need to be free.

Install

npm install max4node

Setup

The Max for Live device is located in max_device/max4node.amxd.
Drop the device in a MIDI track (doesn't matter which one).

Usage

var Max4Node = require('max4node');

var max = new Max4Node();
max.bind();
Get values

Get Master Track volume.

max.get({
  path: 'live_set master_track mixer_device volume',
  property: 'value'
})
.once('value', function(val) {
  console.log('Master track volume: ' + val);
});
Set values

Arm the first track.

max.set({
  path: 'live_set tracks 0',
  property: 'arm',
  value: true
});
Call functions

Play a clip.

max.call({
  path: 'live_set tracks 0 clip_slots 3 clip',
  method: 'fire'
});
Observe a value

Fire the callback with the updated position of the clip (if it's playing).

max.observe({
  path: 'live_set 0 clip_slots 3 clip',
  property: 'playing_position'
})
.on('value', function(val) {
  console.log('Playing position: ' + val);
});
Count

Number of clips in the track.

max.count({
  path: 'live_set tracks 0',
  property: 'clip_slots'
})
.once('value', function(count) {
  console.log(count + ' clips');
});
Promises

Promise based versions of get and count are available through max.promise().

max.promise().get({
  path: 'live_set master_track mixer_device volume',
  property: 'value'
})
.then(function(val) {
  console.log('Master track volume: ' + val);
});

max.promise().count({
  path: 'live_set tracks 0',
  property: 'clip_slots'
})
.then(function(count) {
  console.log(count + ' clips');
});

Testing

Testing is done with fake sockets, so you don't need to open Ableton and Max.

npm test

Big ups

I would have never been able to come up with the Max device without looking at the code of Fingz, an awesome project that you should definitely check out.
I learned a lot about Max from it, debugging in Max is as painful as listening to Justin Bieber, but it's the only way we have to access the Ableton API in a reliable manner (control surfaces programming is a joke, and not officially supported).

License

Copyright (c) 2015, Marco Sampellegrini [email protected]

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

max4node's People

Contributors

alpacaaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

max4node's Issues

Max4Node listeners lose connection with Live after a period of time

I've been able to produce a situation where Max4Node loses its connection to Ableton Live after a period of 15โ€“20 minutes of continuous use. At this time, Max4node doesn't report any errors when this happens. The solution so far is a simple restart of my node app.

This is a fairly vague issue right now, but I'll post additional details as I uncover them.

Observer is unstable on Max 6.1

Although Max 6.1 isn't really supported, I'm raising this as a ticket to help out anyone who runs into this issue in the future.

Although max.observe will work for the first few minutes of use, Max 6.1 appears to stop sending messages to max4node, resulting in this error in max4node:

_this.emitters[obj.callback].emit('value', obj.value);

TypeError: Cannot call method 'emit' of undefined
at Socket.<anonymous> (node_modules/max4node/max4node.js:41:42)
at Socket.emit (events.js:98:17)
at UDP.onMessage (dgram.js:441:8)

Rebooting Live will work for a few more minutes.

track not firing in Ableton project

I am aware this might just be me not knowing what I am doing...

I am attempting to control ableton via your nodejs package, and want to just fire a clip, but nothing is happening.

I also need to figure out how to let the audio go through the live device generated by this package... so I can still hear the audio.. because I noticed I hear nothing when device is activated in Ableton Live 10.

Any help is greatly appreciated, here's my code and it's output.

var Max4Node = require('max4node');

var max = new Max4Node();
max.bind();
console.log("bind returned")

max.call({
    path: 'live_set tracks 0 clip_slots 1 clip',
    method: 'fire'
});

max.count({
    path: 'live_set tracks 0',
    property: 'clip_slots'
}).once('value', function(count) {
    console.log(count + ' clips');
});

console.log("Done.")

Getting this console output

% node test_max_connect.js
bind returned
Done.
9 clips

9 clips IS the correct number.. so that is good.. but now I just need to figure out more of why the audio is not playing..

no sound is played, nor can I see my levels going up as if audio were being produced..

Slow performance of observe function โ€” 4.7 Hz

Code:

// Fire the callback with the updated position of the clip (if it's playing).
max.observe({
  path: 'live_set tracks 1 clip_slots 0 clip',
  property: 'playing_position'
})
.on('value', function(val) {
  console.log('Playing position: ' + val);
  clipPlayingPosition = val;
});

I get 70 events every 8 beats with 120 BPM. So update frequency is roughly 1/120_70/8_60 ~= 4.7 Hz. This is far away from 100 Hz in midi clock.

Is it a limitation of Max? Live? Live Object Model? Node?

"on" function fails to fire - Ableton Live 10 Max 4 Live 8.x

I've started to add logging, using post() and successfully zeroed into why the device sometimes doesn't work.. it has to do with the mechanism used to "ready" the device

I'll see if I can fix it, but wanted to ask for suggestions on if there should be a PR.. or a branch for Ableton Live 10 M4L

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.