Live API Snippets
Max contains a set of helpful abstractions that demonstrate how to interact with the Live API in the devices you create. These abstractions provide programming examples and starting points for constructing your own patches that interact directly with the Live application. They are grouped by the part of a Live Session they can access and control.
Finding the Live API example abstractions
The Live API examples can be accessed a few different ways:
- Use the Max for Live API Snippets Overview patch. This patch lists all of the abstractions currently available by type. Click on the link above, or in the Max menubar, go to Extras->Max for Live API Snippets.
- Use the Max File Browser. In the Max menubar, go to File->Show File Browser to open the Max File Browser and search for the abstraction in the top search bar. To see a list of all Max for Live abstractions, search for 'package:"Max for Live" tag:abstraction'.
- Access and use the abstractions via Snippets. In a blank space in a patcher, right-click to bring up a contextual menu. Mouse over 'Paste From', then 'Max for Live', and select the abstraction you wish to use in your patch.
- Use the links below. If you are reading this documentation within Max you can just click on the links below to open the abstractions.
- M4L.api.dB2Value.maxpat: Convert dBs to a value that sets a volume or gain control.
- M4L.api.ObserveTransport.maxpat: Monitors the status of Live's transport (is the song playing or not).
- M4L.api.ToggleTransport.maxpat: : Stops Live's transport when the song is playing - start it if not.
- M4L.api.SaveInteger.maxpat: Saves an integer number with the Live set and restores it without letting anything through when set.
- M4L.api.SaveLivePath.maxpat: Stores a path in a Live set.
- M4L.api.GetAllTrackIds.maxpat: Creates a list of all track IDs.
- M4L.api.GetVisibleTrackCount.maxpat: Gets the number of the visible tracks in the current Live set.
- M4L.api.GetSelectedTrackIndex.maxpat: Gets the index of the currently selected (highlighted) track in the Live set.
- M4L.api.SetSelectedTrackIndex.maxpat: Sets the selected track to a given index. The index will be mapped against the list of visible tracks.
- M4L.api.SelectMasterTrack.maxpat: Selects the Master Track of the current Live set.
- M4L.api.SelectNextTrack.maxpat: A bang message selects the next track in the current Live Set.
- M4L.api.SelectPreviousTrack.maxpat: A bang message selects the previous track in the current Live Set.
- M4L.api.ChangeTrackVolume.maxpat: Changes the volume of the currently selected track by a given value.
- M4L.api.FireSelectedScene.maxpat: Fires the currently selected Scene.
- M4L.api.GetSceneCount.maxpat: Gets the total number of scenes in the current Live Set.
- M4L.api.GetSelectedSceneIndex.maxpat: Gets the index of the currently selected/highlighted scene.
- M4L.api.SelectNextScene.maxpat: Selects the scene next to the currently selected/highlighted one.
- M4L.api.SelectPreviousScene.maxpat: Selects the scene previous to the currently selected/highlighted one.
- M4L.api.SetSelectedSceneIndex.maxpat: Sets the selected scene to a given index.
- M4L.api.FireSelectedClip.maxpat: Fires the clip that is determined by the currently selected (highlighted) scene and track.
- M4L.api.GetSelectedNotes.maxpat: Locates the clip that is currently selected in the Clip View, read out all its selected MIDI notes and fill them into a Jitter Matrix.
- M4L.api.ReplaceSelectedNotes.maxpat: Replaces any selected MIDI notes
- M4L.api.ReverseNotes.maxpat: Reverses an input matrix of MIDI notes
- M4L.api.InvertNotes.maxpat: Inverts an input matrix of MIDI notes
- M4L.api.MoveInScale.maxpat: Moves a selection of MIDI notes without leaving the given scale
- M4L.api.BuildChord.maxpat: Builds a chord on each input note
- M4L.api.BuildArpeggio.maxpat: Builds an arpeggio on each input note
- M4L.api.DeviceParameter.maxpat: This patch represents a Live device parameter. It accepts a parameter ID as input and can set and get values in unscaled and raw format and output its min/max values.
- M4L.api.DeviceParameterRemote.maxpat: This patch represents a device parameter
- M4L.api.GetAllDeviceIds.maxpat: Takes a list of track IDs as input, scan all those tracks for their devices and output a list of device IDs.
- M4L.api.GetDeviceNames.maxpat: Takes a list of device ids as input and generate two lists of device names, one with no special format and the other ready to be input into a umenu object.
- M4L.api.GetParameterNames.maxpat: Takes a list of parameter ids as input and generate two lists of parameter names, one with no special format and the other ready to be input into a umenu object.
- M4L.api.SelectDevice.maxpat: Builds a menu of all available devices.
- M4L.api.SelectParameter.maxpat: Creates a list of all available parameters and fills it into a umenu object. Use this patch inside a bpatcher object to display the menu. Outputs the id of the selected parameter (to be input in a M4L.api.DeviceParameter.maxpat object).
Cue Point Abstractions
|Max For Live
|Max For Live