Introduction to getting, setting, and observing Live parameters with Max for Live.
download
https://github.com/tkzic/max-for-live-projects
folder: lom
patch: aaa-lom-examples
tutorial
This example device shows several ways of working with Ableton Live parameters in a M4L patch. It can be a confusing process. And there are many different ways to accomplish the same result.
The examples here will use the LOM (Live Object Model) directly, and via builtin LiveAPI abstractions and choosers – available from the context menu that appears when you <ctrl> click inside of an open patcher window.
live.observer
The snippet above shows how to continuously monitor Live’s tempo.
- live.this.device sends out a bang when the device loads
- the “path live_set” message tells live.path to get an id number for the current set. This id is sent to the right inlet of live.observer, telling it we want to observe the current Live set
- the “property tempo” message asks live.observer for the current tempo value
- If the tempo changes it will be automatically updated
live.object (set)
The snippet above shows how to set Live’s tempo.
- Get the Live set path id using the same method as shown for live.observer
- the “set tempo” message sends a tempo value to live.object
live.object (get)
The snippet above shows how to get Live’s tempo.
- Get the Live set path id using the same method as shown for live.observer
- the “get tempo” message requests the current tempo value from live.object
live.object (call)
The snippet above shows how to start or stop the Live transport by calling functions.
- Get the Live set path id using the same method as shown for live.observer
- the “call start_playing” message tells live.object to start the Live transport. “start_playing” is the name of a function builtin to the Live set.
LiveAPI abstractions
The LiveAPI abstractions provide convenient shortcuts to working with Live parameters. Copy them into your patch by <ctrl> clicking inside an open (unlocked) patcher window – and selecting “Paste from -> LiveAPI abstractions”
Observing the Live transport
The snippet above shows how to monitor whether the Live transport is running
- paste the abstraction into your patch as explained above
Selecting the master track
The snippet above shows how to select the Master track
- paste the abstraction into your patch as explained above
LiveAPI choosers
The LiveAPI choosers provide convenient shortcuts to selecting Live parameters from menu objects. Copy them into your patch by <ctrl> clicking inside an open (unlocked) patcher window – and selecting “Paste from -> LiveAPI choosers”
Setting device parameters remotely with live.remote
The snippet above shows how to remotely set the volume on the master track
- paste the chooser into your patch as explained above
- connect the left outlet of “substitute” to the right inlet of live.remote
- send values to live.remote to change the selected parameter