Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

IA4 Practice Paragraph IA.

4 - Subpatches and abstractions

at t he end of every note under 1000 milliseconds long. We w ill see soon how
to link t he durat ion of the envelope to the rate of th e metro . Meanw hile, save
the patch to disk; we w ill retu rn to it shortly.6

IA.4 SUBPATCHES AND ABSTRACTIONS


THE SUBPATCH
Little by little , as our understanding of Max/MSP has grow n, the comp lexity of
our patches created has also grown. Sooner o r later, the day w ill come when we
need to implement an algor ithm that w ill be too big for the computer screen!
Even at ou r current level, tracing t he path of data and understanding the behav-
ior of an algo rith m is starti ng to become difficu lt withi n the sea of litt le object
boxes that defines a complex Max algor ithm. Fortunately, the Max language
permits the creation of subpatches , wh ich are patches w holly contai ned w ith in
a single object box, wh ich ta ke the external form of an object box w ith inlets and
out lets. The object that enables the creation of subpatches is called patcher ,
and it is so commonly used that it can also be abbreviated with just the lett er 'p '.
Reopen t he patch from fig ure IA.22 (whi ch we suggested that you save), go into
edit mode, and create an object box in whic h you type "p random -minmax" (as
show n in fig ure IA.23).

r ~
p random-minmax

Fig. IA.23 The patcher object

Now press < Enter> or click in an empty spot in the Patcher W indow. An empty
window w ill appear, in edit mode, which has the t itle [random -minmax}.
The tit le of the wi ndow corresponds to the argument that we gave to the
patcher , and is typed in brackets to indicate that it is not a free-standing
Patcher W indow, but instead, a patch that is contained wit hin another patch.
Arrange t he w indows in a way t hat you can see t hem both (that is to say, in a
way that you can see both the w indow enti tled [random -minmax} and t he main
wi ndow th at conta ins the random-min max patcher t hat w e just created).
The argume nt g iven isn' t used in any special way by th e patcher, but it is
always a good idea to name any patcher in a way th at suggests the behavior
th at it implement s. In the current example, we are about to create a random
number generator that w ill generate number s that span an interval rangi ng
fr om some minim um to some maximum , and so we name it "ra ndom-m inmax" .
The [random -minmax] w indow shows t he int ernal implementat ion of this
patcher, and inside the w indow we wi ll implement the patch, putti ng it in
contact w ith the "o utside wor ld" (def ined, in th is case, as th e Patcher Wi ndow

6 A s we already pointed out in Section 1.1, it wou ld a very bad idea to save this patch using a
name that happens to mat ch an existing Max/MSP object. Therefore , do n't call th is patch "random.
maxpat", for example, or "me tro.maxpat" . The better way to go would be to use a name composed
of multiple words with spaces between t hem, such as "random sequence.maxpat " .
144

You might also like