A library for communicating with Ableton Live via WebSockets, works both in Node and in the Browser.
npm install --save ableton-live
Drag and drop external/LiveAPI.amxd to any track in Ableton Live (f.ex, Master Track)
Done!
import { AbletonLive } from 'ableton-live';
// polyfill for a browser API compatible WebSocket
if (process) {
global.WebSocket = require('ws');
}
import { AbletonLive } from 'ableton-live';
// or
const { AbletonLive } = require('ableton-live');
import { AbletonLive } from 'ableton-live';
const live = new AbletonLive();
const main = async () => {
try {
await live.connect();
const tracks = await live.song.children('tracks');
const clips = await tracks[0].getClips();
const notes = await clips[0].getNotes();
notes.forEach((note) => console.log(note.pitch));
} catch (error) {
console.error(error);
}
};
main();
Found at https://ricardomatias.net/ableton-live/
A loose fork of ableton-js, which was a great source of inspiration on how to approach handling Live's Object Model.
When not receiving try running sudo lsof -i :send_port_number and make sure only Max is using it.
tests/live/ runs against a real Live 12 instance, using Node's built-in test runner:
external/LiveAPI.amxd on the Master track.pnpm test:live. It builds the Node bundle and then runs the suite against ws://127.0.0.1:9001. Override with LIVE_HOST / LIVE_PORT.The suite changes the set (tempo, names, mute, device parameters, a temporary MIDI track and scene, and transport start/stop) and puts each change back. Don't save the set while it runs.