This is the 1st of a series of articles about hacking on Ableton Live with JavaScript. These articles assume you own Ableton Live 9 Suite and are comfortable coding JavaScript.
This article explains the setup to run JavaScript code inside Live. If you are already familiar with this setup, you can skip ahead to the next article.
We’re going to interact with Live directly through the LiveAPI, so our Max device will not alter the incoming signal. I usually use a MIDI effect in this situation, but you could use an audio effect. The important thing is the MIDI/audio input is passed directly to the MIDI/audio output. These instructions assume we’re using a MIDI effect.
Find “Max Midi Effect” under the Max for Live section of the Live browser inside the “Max MIDI Effect” folder. Drag it to a MIDI track (I recommend using a dedicated track to stay organized), then click its edit button. Max will launch, and after a few moments the Max Editor window will appear.
Double click in some empty space in the Max Editor window, and the Max Object Explorer will appear (if it doesn’t, make sure the device is unlocked by using the lock button in the lower left). Type “javascript” into the search box of the Object Explorer. Under the languages category we see “js”. Drag “js” into your device and type in a filename, so we have an object that looks like “js your-filename.js”.
Pro tip: Learn Max keyboard shortcuts. If you type “n” in an unlocked device, it will add an object. Then you can type “js your-filename.js” and hit enter to create a js object.
Every time you save the code in Max’s JavaScript editor, it will run. As a quick test, try this simple program:
post("Hello World!");
You should see “Hello World!” in the Max window, like in this screenshot:
Alright! Now you’re ready to write JavaScript programs inside Ableton Live. In the next article, we’ll learn how to set some useful utility code to help us debug our scripts.