MSP Plugin Tutorial 3: AMXD Plug-ins
Max for Live in Max
Max for Live allows Maxers to create patches that can be used in Ableton Live projects. Many folks have created clever and interesting patches and are sharing them in as .amxd flies. The amxd~ object allows us to add these files to Max patchers, using them as plug-ins.
The amxd~ object
The bare amxd~ object is not very impressive, as it consists of nothing but inlets and outlets. Before it can be used, it must be loaded with an .amxd file. These can be found in the plug-ins toolbox on the left toolbar—select Live Device as the type, find the one you want and drag it onto the amxd~ object. Note that unlike VST plug-ins, Live Devices can only be loaded when the patcher is unlocked. When you load one, the object will expand to contain the device's user interface:
A live device only needs a few connections to work. For an effects device, all that is required is audio in and audio out.
As you can see, the device presents a complete interface. The little plus sign even saves a snapshot for you. This will be kept if the patch is saved and closed. (Click the bullseye to return to the saved settings.)
Parameter access is very much like the vst~ object:- Double click on the Parameters
subpatch in the blue region of the main patch.
The getparams
message returns a list of all parameters from the right outlet. The parameter names are all preceeded by "info param", so those two words need to be stripped off by a pair of route objects. In the subpatch, the names are used to stuff a umenu object as described in Plugin Tutorial 1. You can then use the umenu to choose a particular parameter to examine and set. Unlike parameters in vst~, amxd~ parameters vary in range, so we need to be aware of the minimum and maximum allowable values when making adjustments. The getinfo
message accompanied by a parameter name will retrieve the min and max values and possibly some other information. These also require some routing to place the numbers where they belong, over on the green side of the patch. Getvalue
fetches the current setting of the named parameter. All of this happens when the parameter name is chosen.
Adjusting the number box labeled "set parameter value" will do just that. Note it also repeats the most recent getvalue
request to keep that display up to date.
Live Device softsynths
The right half of the tutorial patch has an example of a synthesizer Device. As you can see, it responds to midievent
messages as described in Plugin Tutorial 2. Most Live Devices are fairly simple, so they won't necessarily respond to a wide range of messages. It's really up the author of the patch.
Getting exterrnal MIDI into an amxd~ is simpler than with vst~. All we need to do is connect a midiin object directly to the right inlet. All of the parsing chores are handled internally.
Deconstructing Live Devices
Since amxd devices were originally Max patches, why can't we open them up and see what makes them tick? Well, in fact we can.
- Right click on the loaded device and choose
Open Original
from theObjects
submenu.
The first thing you will see is a patcher in presentation mode. Switch to patching mode, and the internal logic will be revealed. This is actually a rather complex patch, with a poly~ based FM synthesizer and several subpatches full of logic to handle MIDI and midievent parsing. The only special objects are the plugout~ and various M4L user controls.
Summary
The amxd~ object completes the circle of Max to Live, allowing us to bring patches created in Max for Live back to Max. Live Devices function as simple plug-ins.