Max for Live Ultimate Zen Guide
Max for Live Ultimate Zen Guide
Julien Bayle
Buy on Leanpub

// START OF THE PREVIEW/SAMPLE DOCUMENT //

Introduction

I’m Julien Bayle1 and I have used Ableton Live Digital audio workstation since its first release. I was certified by Ableton2 in 2010 and I teach not only Ableton Live Suite3 but Max6 and Max for Live both to individuals and groups. I have released an eight and a half hour long training DVD about Ableton Live 9 & Push4

Push & Live on the field

Push & Live on the field

Max for Live was released in 2011, and I have had lots of requests to write a book since then. Here we are! It is starting now and I hope that you will be totally happy and satisfied after reading this guide. I want you to be able to design your own Audio & MIDI FX but also your own sound generators and custom interfaces inside Ableton Live !

In the first part of this guide, I’m going to explain Max for Live basics: what Max for Live exactly is, what the differences with Max6, formerly named Max/MSP, are and also how it works with Ableton Live itself.

In the second part, we will look at something already known by some of you: the famous (but cryptic) Live Object Model, also named LOM within Max for Live’s Coding Mafia. It is the inner structure of Live itself. We can reach, request and manipulate Live’s parameters thru it by using two ways: Max for Live itself, but also the (also famous) MIDI Remote Scripts. We will explore Live’s Application Programming Interface (also named Live API) and how to program it.

In the third part, I will talk about JavaScript as another way to reach and work with Live’s API. You’ll like this part because it will push you into another field of programming within Max for Live.

In the fourth and final part, I will show you how we can easily design and build Max for Live devices like MIDI instruments, sound generators, MIDI Fx and Audio Fx and also how we can play and control Live using API from within the devices.

You can also follow me on twitter & facebook

Are you ready?

About

This guide is published & provided by the leanpub.com web platform but all rights are reserved to Julien Bayle under © Julien Bayle 2013.

Copying or publication of any part of this guide is not allowed, at the moment

Being published on leanpub.com, this guide can easily be revised and updated. You will **automatically be notified about any updates in the future.

Stay Tuned.

About the review & edit of the book

This book has been entirely reviewed and edited by Mark Towers and I want especially thank him for such involvement, serious, expertise and kindness !

Mark Towers teaching Ableton Live in Leicester

Mark Towers teaching Ableton Live in Leicester

Mark Towers is an Ableton Certified Trainer from the UK, he runs a Foundation Degree in Creative Sound Technology at Leicester College/De Montfort University, and teaches Ableton, Sound Design and Programming with Max 6 and Max for Live. Mark also specialises in Electronic Music Composition & Performance.

You can visit his website at marktowers.net

FAQ

Version

The guide version is 1.05

1.05

  • better quality for snapshots
  • some typos fixed

This guide is not

  • a whole course about Max6
  • a whole course about Ableton Live
  • a whole course (nothing can beat a course thru skype or face-to-face: ask my students!)

This guide is

  • a guideline with the Max for Live world
  • the guide you need to completely understand what Max for Live is and how it works with Ableton Live itself.
  • THE tutorial which will drive you to create your own Max for Live devices perfectly fitting inside Ableton Live (presets’ storage, parameters’ automation, Live API etc)
  • THE ONLY tutorial published & written by an Ableton Certified Trainer about Ableton Live

If you find a mistake or a typo in this guide

Please write to me using this page: http://julienbayle.net/contact

If you would like to find out about courses on Ableton Live, Max6

Please write to me using this page: http://julienbayle.net/contact

1 Max for Live Basics

Max for Live isn’t a concept or a magical spell. There are lots of video tutorials out there that don’t really explain it, so I will do that and I’m going to explain precisely what it is.

1.1 What ?

My own Max for Live definition is:

Max for Live is an interactive visual programming environment directly usable within Ableton Live for designing devices.

We are going to review Ableton Live & we will revise it in the following pages, but at the moment, let’s begin by explaining what interactive visual programming environment means.

What is an interactive visual programming environment ?

There are a lots of programming languages. Each one of them have their own characteristics and paradigms which are basically the rules they are following and we have to follow in order to use them.

Here is, for instance, an example of something I coded in C++ language for a generative installation5:

C++ language is based on text coding

C++ language is based on text coding

This type of programming language requires a specific proramming workflow:

  • we write the code
  • we include some external programming libraries
  • we compile
  • we test

This series of steps is done cyclically: we modify, we compile, we modify again etc. There is something I like to call a design disruption that comes from this necessary compilation step which requires to stop coding and to compile & test before we begin to code again.

An interactive visual programming environment is interesting because it doesn’t have any design disruption. As soon as we modify the program, we are seeing directly the consequences of our modification

A visual environment also provides a way to learn programming more easily and less abstractly. Indeed, we don’t have to create complex abstract structures for which we would have to remember each part & detail but we are moving objects and linking them together.

Here is an example of what I mean with a picture:

A Javascript text *code* and its *visual* equivalent

A Javascript text code and its visual equivalent

On the left, there is a piece of JavaScript code. We are declaring a function named add_five which requires an argument. Then, this function is called with the number 2 as an argument and the result is stored inside the variable result which is displayed using the function display() that is not visible defined and declared here. display() is only here as an example showing that we have to call or use functions to display things in usual text-based programming language because the UI is often separated from the code itself (UI means User Interface).

On the right, the same thing but designed with Max6. There are two UI objects providing both features of displaying and modifying quantities. The object [+ 5] is the equivalent of the function add_five and adds 5 to any values incoming from the top. Then, [+ 5] emits the calculation result to the bottom.

BUT

I don’t mean that one type is better than the other.

Neither one has less features than the other.

Interactive visual programming is just simpler to learn and less abstract than the other, especially for people with no programming background.

Max6 & Max for Live

Some of you will have already heard about Max6, formerly named Max/MSP.

Max6 is the latest version of what long-time users still call Max/MSP.

In the following pages, I will use the term Max to denote Max6 in order to mean Max6 environment. But I will use Max for Live too, because it is very different from Max itself as we are going to find out.

Max vs Max for Live

I’m going to explain why Max for Live is not equivalent to Max6.

Max framework & Max runtime

Max is a development environment available here: http://cycling74.com/shop

Max is an autonomous framework that doesn’t require you to own an Ableton Live license, and even if you had one, it wouldn’t be necessary to launch Live to use Max.

When we program with Max, we create patches that we can edit & modify. A patch is a set of objects more or less linked together.

If we want to share a patch with another user who doesn’t own a Max’license himself, we can create an autonomous Max application. This application is basically our patch, a set of dependencies (all objects required by the patch to be loaded) and the Max’ runtime.

runtime is available for free here:

http://cycling74.com/downloads/runtime in case we want to launch and use a collective. A collective is just the patch with all dependencies, but without the runtime.

Check the next figure, it illustrates how this works:

Max, Max Runtime, Patch, Collective and Application

Max, Max Runtime, Patch, Collective and Application

Ableton Live & Max for Live

If you understand what the previous figure means, you won’t have any problem to understand the next pages.

Max for Live doesn’t provide any runtime.

More precisely, the only software able to open, edit & run Max for Live patches is Ableton Live.

Actually, we refer to these patches as Max for Live Devices instead of just saying Max for Live patches because these latter sit within Max for Live devices.

These devices are stored as files containing patches required by them to work, and also all dependencies required too, especially in the case of those devices that have been frozen. We will take a closer look at this later in this book.

For now, we are going to explore another figure in order to understand clearly what these different entities are:

  • liveset (file with the extension .als storing all liveset’s data like clips’ parameters, devices’ parameters, MIDI mapping and much more)
  • liveset project (folder containing one or more livesets, samples related to these livesets and much more)
  • device (file with the extension .amxd containing all elements required by the patch to be loaded and used as a device in Live)
  • device in edit mode inside a … Max-style editing window
Liveset, liveset project, device and device in edit mode

Liveset, liveset project, device and device in edit mode

You could think of Max for Live’s runtime as being Ableton Live itself and Max for Live’s editor as being Max run by Live.

One of the first direct consequence is :

as soon as we load a Max for Live device, we can also edit it !

You can also click on the edit button of a Max for Live device and you’ll see the underlying Max patcher open and provide you with the whole patch related to this device.

Max for Live's device EDIT button

Max for Live’s device EDIT button

Now we are a bit more aware of how Max for Live, and Max & Ableton Live are related, let’s continue with licensing.

Use & licensing

In order to use Max for Live, we have to own an Ableton Live license, obviously. But not only, of course.

I only own Max for Live

Then, I can use and edit Max for Live’s devices.

But I cannot use Max outside of Ableton Live, I mean: as the pure Max framework.

I only own Max

I CANNOT use Max for Live’s devices, nor edit them, of course.

Obviously, I can use Max independently outside of Live or even connected to Live using MIDI or audio by using audio inter-application routing application like Soundflower6 on OSX or Jack7 on OSX or Windows.

I own Max & Max for Live

I can use Max for Live’s devices.

I can also use Max patches independently of Live and make them communicate with Max for Live’s devices using OSC, for instance.

1.2 Ableton Live Basics

Ableton Live is an audio & MIDI workstation. We call this kind of software a DAW (standing for Digital Audio Workstation).

Let’s explore what Ableton Live is a litte more.

Projects & livesets

A project is a folder inside of which we can store livesets.

It can contain multiple livesets and it is a convenient way to organize our music.

We can find imported audio sample files and also samples created within the liveset itself. When we use the feature Collect All & Save, all presets and elements required by the liveset are copied inside this project folder too in order to make it totally independent from any external files.

I’d suggest reading the Live manual if you want more details about these fundamentals.

Tracks

Live’s livesets are structured around the tracks’ concept, whatever the mode we use (session or arrangement modes)

A track can be an audio or a MIDI track.

Each track can contain a set of clips which are the most basic unit inside of which we can have MIDI sequences or audio samples, depending on the type of track. MIDI tracks can contain MIDI clips and audio tracks can contain audio clips.

In a track, only one clip can be playing at a time.

Each track also contains a mixer and a send FX section, and of course a devices’ chain that can be seen at the bottom of the screen in both modes.

An audio track can contain:

  • audio clips inside the clips area (clipslots in session mode or timeline in arrangement mode)
  • audio effects inside the devices’ chain

A MIDI track can contain:

  • MIDI clips in the clips area (clipslots in session mode or timeline in arrangement mode)
  • MIDI effects inside the devices’ chain, before the MIDI instrument
  • MIDI instrument inside the devices’ chain
  • audio effects inside the devices’ chain, after the MIDI instrument

Devices

We have refered to devices since the beginning of this book but we didn’t define them…

Devices are those entities that we can drag from Live’s browser and drop on to the tracks’ device chain.

We can see in the browser (on the left) a big list of categories. Version 9 of Live can be a bit confusing at first sight.

Live's Browser

Live’s Browser

We find the different devices within each of the following categories:

  • Instruments
  • Audio Effects
  • MIDI Effects
  • Max for Live
  • Plug-ins

Category names are quite self-explanatory.

In the Instruments category , we can find Live’s native instrument devices like Operator, Analog or Sampler. They receive MIDI messages from Live itself through MIDI clips or from outside (from another application within the same computer or from another computer or MIDI controller) and can produce audio depending on the MIDI messages received.

In the Audio Effects category: there are Live’s native audio effects like delays, compressors or beat-repeat. They can process audio signals.

In the MIDI Effects category: there are Live’s native MIDI effects like Pitch, Chord and some others. They can transform MIDI messages.

The Plug-ins category contains all non-native devices like VST for OSX and Windows or Audio-Units (AU) for OSX plugins. They are add-on devices usable in Live but that are not delivered with Live or even designed by Ableton.

Then, we have the Max for Live category.

There are 3 types of devices in this category:

  • Max MIDI Effect
  • Max Instrument
  • Max Audio Effect

We have the same classification in 3 categories.

Max for Live's 3 different types

Max for Live’s 3 different types

Why?

Because any device that we want to use has to be placed in a device’s chain in Live. And, as we have just seen, a device’s chain belongs to a track and a track can be either a MIDI or an audio track with all consequences raised.

When I’m teaching Ableton Live, I use the following image to illustrate the concept of MIDI effects, MIDI Instruments, and Audio Effects, look at this now:

MIDI & Audio in Live's devices chain

MIDI & Audio in Live’s devices chain

Bar graphs represent MIDI signals and VU-meters represent audio signals.

If we start from the left that is the entry point of a signal inside the devices’ chain (the signal can come from inside Live itself or outside, as I said), we can see a Bar graph.

Because this device is included in-between two Bar graphs, that means we have a MIDI Effect here. It takes an incoming MIDI signal and outputs a MIDI signal: this is the basic definition of a MIDI Effect.

With the same reasoning, we can see that the next device is in-between a Bar graph on its left and a VU-Meter on its right. It receives a MIDI signal and produces an audio signal: this is a MIDI Instrument.

Then, the last device is in-between two VU-Meters. It is an audio Effect.

In the same way we are going to discover that Max for Live’s devices are nothing but Live’s devices, with specific features like edit mode of course, and this is why they have to be from one type or another such as MIDI effect or audio effect etc.

We are also going to see that in the case of a Max for Live device that doesn’t have to process MIDI or audio but to be an interface between Live and a Wiimote controller for instance, we can use any of the 3 types. Indeed, this won’t be important except for the place where we will want to place it in Live’s device chain.

Let’s continue with Live’s basics.

MIDI Mapping

MIDI Mapping provides a way to associate MIDI messages like Note or Control Change with a livesets’ parameters through Live’s GUI (GUI stands for Graphical User Interface)

MIDI Mapping Edit Mode enabled

MIDI Mapping Edit Mode enabled

We can enable the MIDI learn mode by clicking on the MIDI text button at the top right in Live’s GUI (or by pressing CMD + M on OSX & CTRL + M on Windows)

Once enabled, we can select either a parameter, elements like clipslots, but also scene selectors, we can then move a knob on our hardware controller. Then the mapping/association is made: the liveset parameter is linked to the hardware controller’s knob.

PAY ATTENTION HERE

The liveset’s MIDI mapping is stored inside the liveset itself and nowhere else !

Question: what can we do if we want a particular set of parameters to be mapped each time to the same set of knobs, whatever the liveset used ?

Indeed, because we may be playing our live performances quite often, we want to be able to retrieve our setup when we are working on a liveset, on stage etc. without having to remap everything everytime.

Of course, we can keep the same liveset and copy-paste it as a template. As we just saw, MIDI Mapping parameters will be copied with the liveset’s file itself. It works fine. A lot of people do that. But we can do better by using MIDI Remote Scripts.

By the way, be a little bit more patient here: Max for Live is coming. But we have to keep all of that in mind before we dive in completely !

MIDI Remote Scripts

Some of you probably already know about MIDI Remote Scripts.

We are talking about scripts for programming languages that don’t require a proper compilation step.

When we are typing JavaScript code, for instance, we don’t need to compile it before to test it: an interpreter can run it directly. JavaScript is often used within web pages with HTML and in that case, the interpreter is just our web browser itself.

What are those scripts ?

MIDI Remote Scripts are Python-based scripts. Python is a programming language. They are directly interpreted (and run) by Ableton Live itself and provide ways for:

  • controlling Live (act on Live)
  • grab feedback from Live (observe Live)

By checking the MIDI Sync tab in Live’s preferences, we can see in the top level part some parameters related to Control Surfaces (sometimes referenced as Remote Surfaces)

Enabling & Disabling MIDI Remote Scripts in Live

Enabling & Disabling MIDI Remote Scripts in Live

Each member of the list corresponds to a MIDI Remote Script available from Live’s installation folders.

Each one is named after a controller. We can see APC20, APC40, Push and also LividCode, for instance. The latter involves the Livid Instruments’ Code controller on which I am currently working on (a secret project, by the way)

Generally, these scripts are designed by the hardware’s designers themselves for hardware handling in Live.

For instance, APC40’s script provides a way to directly control the clip matrix using its buttons and also to grab all clips’ states.

Basically, these scripts are an interface between these controllers and Live itself.

Here is a minimalistic schematic summarizing these concepts.

Livid Code controlling Live through MIDI Remote scripts OR classic MIDI mapping

Livid Code controlling Live through MIDI Remote scripts OR classic MIDI mapping

Black arrows show the relationships between MIDI Mapping and MIDI Remote Scripts concepts AND Live’s Preferences window.

In blue, we can see the control/feedback themselves.

In the MIDI Remote Scripts method, we can see that the configuration is depending on Live itself, but in the MIDI Mapping method, the configuration is based on the liveset itself. Of course, in this latter case, the MIDI interface configuration is depending on Live itself too, but please keep in mind that MIDI Mapping IS stored inside the liveset’s file (the .als file)

Where can we find the MIDI Remote Scripts on our computer?

These scripts are within Live’s folder hierarchy.

On windows:

  • C:ProgramDataAbletonLive xResourcesMIDI Remote Scripts\ on Windows 7 & Vista
  • C:Documents and SettingsAll UsersApplication DataAbletonLiveX ResourcesMIDI Remote Scripts\ on Windows XP.

On OSX, we have to find the file Live.app in Macintosh HD/Applications/Live x.x.x./ and right-click on it, then choose Show Package Contents. At last, if we look inside this folder: Contents/App-Resources/MIDI Remote Scripts, we can see this:

MIDI Remote Scripts on OSX

MIDI Remote Scripts on OSX

Wouldn’t it look like the previous Remote Surfaces list we saw in Live’s preferences ? Of course, it is directly related.

Hack and Script’ edit

In the previous snapshot, we can see the opened folder LividCode and some files inside it with the extensions: .py and .pyc.

.py & .pyc file format

The file extension .py is related to Python scripts’ source codes. We can easily read and modify them. These are basic text files.

Actually, if we have a better look at the content of the folder, we can also see .pyc files. Those aren’t editable. They are binary files.

These are bytecodes8. They can be considered as executables, binary files are directly executable by the Python interpreter, which is Live itself, as we already discovered.

If we modify a Python script source code, the next time we launch Live, and choose the corresponding Remote Surface in Live’s Preferences, Live will take the .py source code and will pre-interprete it (this is a kind of pre-compilation) in order to optimize the execution and will create this .pyc bytecode file (one for each .py used)

Retrieve source codes from bytecodes

Obviously, as we are more or less hackers, we want to read what is in these source code .py files. Indeed, we first need to understand how the Live API works and how we can design our own MIDI Remote Scripts.

As an early 2013 beta-tester for Ableton’s PUSH controller, I especially wanted to read the source codes for this controller and I decompiled bytecodes early February 2013.

I published the whole sources and I’m doing my best to maintain and update them as soon as a new version of Live is released.

Everything is available here on Github:

https://github.com/gluon/AbletonLive9_RemoteScripts

I know this helped and still helps a lot of you and especially application developers like those who made Conductr9 for iPad.

Because nothing is officially documented, I tried to make some documentations:

I won’t teach you how to program using Python language here, but how to do the same things by using Max for Live itself.

Let’s dive now inside Max for Live.

1.3 Max for Live specific objects

Max for Live contains a specific set of objects available while patching. Some of the objects are only usable within Max for Live, but others can be used in Max too, outside of Live, I mean.

Here is a global picture with specific objects of Max for Live.

Max for Live specific objects

Max for Live specific objects

We can see two series of objects:

  • at the top, objects able to provide control/feedback from Live itself,
  • at the bottom, Graphical User Interface’s objects (GUI)

I will describe objects at the top in the next chapter.

live.arrows, live.button, live.text & live.tab are button type objects. We push, we select.

live.dial is basically a potentiometer, a knob.

live.number displays values but also provides a way to modify them.

live.menu presents a list to the user who can select an element in it.

live.drop makes the connection between a Max for Live device and the file system of the computer. We can drag’n’drop files on to this area and this object pops out the absolute path of those files. It is really interesting if we want to process files and to load them to memory [buffer~] objects in Max for Live for instance. There is no need to type a path, it finds it for you.

live.gain~ displays the audio signal level and provides a way to change the gain too.

live.meter~ only displays the audio signal level.

live.slider is a basic fader.

At last, live.grid & live.step are helpers and GUI to configure other objects.

live.grid works well with chucker~ by providing a display and control to cut an incoming signal into pieces and to replay those pieces in another order.

live.step is a step sequencer.

We will talk about these objects in the next pages of the book because it is very important to know how to use each of them.

Because Live brings some features I want you to master, for instance, if you want to create a Max for Live device and be able to automate some of its parameters in Live, or to save them with the liveset, you have to apply specific actions.

Now, let’s keep focused and explore the famous Live Object Model (LOM)

// START OF THE PREVIEW/SAMPLE DOCUMENT //