P Qe Favorites
P Qe Favorites
P Qe Favorites
Don't Panic
90% of the Max patches I have built use the same 50 basic objects. Beyond those, objects
are either very specialized, only slightly different from the standard object, or can be
duplicated by a few simple ones. The benefits of using specialized objects are often only
cosmetic, resulting in cleaner windows. Don't underestimate that value, because a simple
patch is easier to debug than a cluttered one. But making it work in the first place is
important too.
Here, in no particular order, are the objects I use (and see used) the most.
Input
Basic MIDI input. Almost all of my patches use one
of my trusty MIDI controllers. Usually there's an argument to ctlin to watch a single
control.
Stripnote gives only the note on messages. Don't forget to connect the inlets
to the left and center outlets of notein.
User Interface
Number boxes. When I'm developing a patch, I use these
everywhere. They let me inject test input at various stages and watch values change.
Toggles and buttons are nearly as common. They are easy to use when
expanded a bit.
Peter Elsea 9/24/10
Favorites
Sliders. When I'm going to control actions with a mouse, I use one of these.
Note the color difference between the audio gain control (left) and the ordinary data
slider. When I'm finishing a fancy application, I may replace the data slider with
something prettier, but not often.
Favorites
Display
Most of the UI objects also work for displaying data. Slider and multi-slider nicely show
current values, for instance. What I do the most is this:
Prepend is like append, but before. The prepend set object sends the message set
"whatever" to the message box, which will then display whatever it is. My patches are
littered with these things when they are under development. We type "prepend set" so
much that Max 5 message boxes have a right inlet that sets the message. Prepend set will
gradually disappear from my patches and writings, but there are plenty of other uses for
prepend.
Favorites
Math
Basic math objects. These are all pretty much the same. The argument
sets the type of the result and should give a reasonable behavior before anything arrives
at the right inlet. The only oddity is the construction !- means input is subtracted from the
argument rather than the other way around. The gotcha is don't send a list to this-- the
second item of the list will replace the argument. Another gotcha is in creating these:
Make sure you have the space between the operator and the argument.
There's no such thing as a +2 object, so that is a harmless error, but typing -2 gets you an
int box with -2 in it and that won't do any subtraction.
Managing Data
A common frustration with Max is to get a patch working, save it, but
discover that it won't work after it is re-opened. This is generally due to uninitialized
objects, parts of your patch that must be primed with certain values (such as metro rate)
to work properly. Loadbang addresses this problem by outputting a bang when the
patcher file is first opened. The bang can be used with message boxes to provide initial
settings to any objects than don't take arguments. This example with bag is typical:
Favorites
The gotcha with loadbang is that if you have several, you won't know which will bang
first. The answer to that is to have only one attached to send objects that distribute the
bang in a controlled order. Loadmess is a new version that will send more than a bang.
In some instances, the graphic versions of these are better, as they are open one way or
another when the patch is loaded. The gotcha with these two is that the graphic indicator
can be out of sync with what is actually happening.
Favorites
Route is a lot like select, but it will pass messages through if they are
appended to the selector. (The message "1 2 buckle my shoe" will produce "2 buckle my
shoe" at the left outlet of this one.) I created label to have a complimentary function for
this kind of action:
Int and float are for temporary storage of numbers. Generally this
is necessary when right to left operations make it difficult to present the right numbers at
the right time for some calculation. If you send the number to the right inlet, int and float
will hold the numbers until they are banged. If you just type a number into an object box,
int or float are what you get.
Coll is the general purpose data collection. Look at Max & Chords for
some examples of how I use it. Gotcha-- be sure to open the inspector and check "save
data with patcher".
But the truth is I avoid coll if I can. Most simple sets of data can be stored in a list, and
llist2 can be used to access them like this:
Fans of Terry Pratchett will recognize the Llamadosian spelling of Llist and a few other
lobjects that start with L. I should have done that from the beginning, but I was young
then. Hence Label, Loop and Like.
Peter Elsea 9/24/10
6
Favorites
(Items in lists are accessed by index numbers, which start at 0. So the fourth item in the
list has an index of 3.)
List management
I usually use pack to put together a list. It will
only send output when the left value is received. Pak will output every time any input
changes. This is handy sometimes, but it can result in a lot of spurious calculations.
Gotcha-- the arguments not only set the number of inlets and the default contents of the
output list, they set the type of every item. The Lobjects are full of specialized list
builders and converters but I still use these a lot.
Unpack takes lists apart again. Again, the arguments set the type of
the output.
Peter Elsea 9/24/10
Favorites
These take lists apart, sending one item out after another. The difference
is iter runs as fast as possible, unlist (an Lobject) synchronizes each item with a bang.
Thresh is the opposite of iter. Individual items received in a close group are
combined into a list. The argument sets the timing gap that will trigger list output. (The
help file is misleading.) Gotcha-- only 255 items can be collected. Any more than that
without a break will be lost. Lcatch deals with this by sending multiple lists. (A list can
only be 255 items long.)
Timing
Metro is the mother of all repetitive action. Effective use
relies on finesse in setting the timing period. See Max & Rhythm for details. Qmetro is a
variant used with graphics, especially jitter patches. Whereas metro is quite insistent that
its actions be done immediately, qmetro is more relaxed, allowing MIDI processing and
user interaction to happen first.
There is a second argument (third list member) that sets how often line puts out while it is
changing. This should be adjusted to match the times used for the ramps.
Counter counts messages. It's full of gotchas-It starts with zero, so it shows one less than the number of messages received.
If you give it an argument it counts up to and including that value, so counter 10
gives 11 counts per cycle.
Two arguments set start and end, so counter 1 1000000 will count things the way
you would expect. After it hits the end, the next number out is the start.
Favorites
The overflow and underflow (it can count backwards) outlets produce a 1
followed by a 0, so extra logic is needed to decode this to cascade counters.
There is a carry count outlet, which works when counting up but not down.
I generally use my own version, called Lcount.
Uzi is the tool for repeating processes. With an argument of 64, one bang in
causes 64 bangs out as fast as possible. The right outlet is the most useful, because it
numbers the bangs. Avoid hanging one uzi on another. It's easy to create a long process
(64x64 = 4096) that clogs up the computer, or at least makes mouse and display actions
unresponsive. I prefer to combine uzi with metro and lcount like this:
The - 1 box deals with my pet peeve with uzi. The numbers out the right count from 1
rather than 0, which is need for most iterative processes.
Encapsulations
Subpatchers, which confusingly are called patcher (p)
in an object box are a way to hide complex (not to say messy) parts of a patch. They have
another advantage-- if key parts of an algorithm are encapsulated like this, you can copy
and modify them, then use "Paste Replace" to try out different methods. Gotcha-- the
name does not mean anything. If you copy this and modify one of the copies, the original
is untouched. If you want that behavior, you must save the encapsulated section as a file.
Poly~ is an encapsulation of multiple copies of a subpatcher. Even
though it has the tilde, it's not dependent on MSP running. They are great for synthesis of
Peter Elsea 9/24/10
Favorites
course, but I've also found applications in Jitter, where I often want many copies of a GL
object.
Output
Makenote and noteout go together like peanut
butter and jelly. You see this at the bottom of practically every patch that uses MIDI:
The gotcha with makenote is its default arguments, which are 0. If you don't include a
velocity argument the velocity of 0 will be a note off. If you don't include a duration, the
note will be too short to be heard.
The gotcha with noteout is what happens when you change the MIDI channel. If you do
this while a note is sounding, the note off will go to the wrong channel. My suggestion is
don't change channels with noteout. Instead, use a makenote noteout pair for each
channel you need. If you want to change channels on the fly, use Lnote instead of
makenote.
Audio output is of course essential to MSP. It's easy to start audio with the
ezdac~ button, but you should also be familiar with the effect of the startwindow
message. Use adc~ when you need more than two channels of playback. Details on all of
these objects are in the BasicMSP essay.
The audio input as defined in DSP setup. I usually follow this with a
meter~.
10
Favorites
The functions based on buffer~ are central to live looping and other types of sample
playback. You can play an MP3 file by importing it to a buffer~. The gotcha? Accurately
typing the name of the buffer~. Capitalization matters.
Tapin~and tapout~ are basic to delay effects. Just
remember, the argument to tapin~ sets the maximum delay.
I don't do much math with audio signals, but the *~ is essential. It's the
equivalent of a volume control. I always put a gain~ slider at the bottom of the patch and
after inputs, but use *~ everywhere else. I use 0. for the argument when I want the patch
to start with no sound.
Cycle~ is the heart of synthesis. I also like to use the help file to test the
audio output.
Line~ is the basic envelope generator. Use with *~ and various messages.
There are a lot of good filters in MSP, but these are the ones I
use the most, probably because they have the most synthetic sound.
There's nothing like
banks of oscillators and filters to give the "computer music" sound. These are the heart of
many of my favorites.
Fundamental Lobjects
I started writing objects to make Max simpler, not more complex, but with more than 120
in the set, I have to admit to contributing to feature creep. They all seemed like a good
idea at the time but many are seldom used. A few are so useful that cycling '74 has added
their own versions to the standard objects and I keep mine only for backwards
compatibility3. As I look over my own patches, I see these the most often:
Someone suggested to me that the zl objects were derived by reverse engineering the
Lobjects. This works if you know that Elsea is pronounced "L-Z". It's not true, but
loadmess, pak, and vexpr were definitely preceded by Lobjects that did the same thing.
Peter Elsea 9/24/10
11
Favorites
Lclose does the trick I've been teaching with bag-- gives an
approved number nearest the input value. The gotcha is the actual approved values are
sent from the right outlet. The left outlet provides the positions of the results in the stored
list. I do this to be compatible with other objects that provide position and value.
Lcount came from frustration at trying to make counter do anything
beyond simple counting. I got my start in circuit design, and a chip called the 74193 was
a real powerhouse for building sequencers and clock displays. Lcount works much the
same way. I admit I got carried away, but since jitter came out I have found it invaluable
to be able to count to 2pi in increments of 0.1. The gotcha is the count value comes from
the center outlet.
Lcount counts from the start (defalut 0) to one before the end value. This is the way most
computer programs count-- counting 0 through 11 gives 12 events. The count comes from
the center outlet. The right outlet bangs when the count hits the end, and the left outlet
bangs when the count starts over. (Lcount will do other tricks like count by fractional
increments.)
12
Favorites
13
Favorites
The template 0 3 * will pull out every third item. The templates are changeable, so this
can compose an entire piece.
14