Specifications

21
CHAPTER 3
Using Pure Data
SECTION 3.1
Basic objects and principles of operation
Now we are familiar with the basics of Pd let’s look at some es sential objects
and rules for connecting them together. There are abo ut 20 message objects
you should try to learn by hear t because almost everything else is built from
them.
Hot and cold inlets
Most objects operating on messag e s have a “hot” inlet and (optionally) one or
more “cold” inlets. Messages received at the hot inlet, usually the leftmost one,
will cause computation to happen and output to be generated. Messages on a
cold inlet will update the internal value of an object but not cause it to output
the result yet. This seems strange at first, like a bug. The reason is so that we
can order evaluatio n. This means waiting for sub-parts of a program to finish
in the right order befo re proce e ding to the next step. From maths you know
that brackets describe the order of a calculation. The result of 4 ×10 −3 is not
the same as 4 × (10 − 3), we need to calculate the parenthesised parts first. A
Pd prog ram works the same way, you need to wait for the res ults from certain
parts before moving on.
10
33
* 5
+ 3
3
fig 3.1: Hot and
cold inlets
In Fig. 3.1 a new number box is added to right inlet of
*
.
This new value represents a constant multiplier k so we can
compute y = kx + 3. It overrides the 5 given as an initial
parameter when changed. In Fig. 3.1 it’s set to 3 so we have
y = 3x + 3. Experiment setting it to another value and
then changing the left number box. No tice that changes to
the right number b ox don’t immediately effect the output,
because it connects to the cold inlet of
*
, but changes to the left number b ox
cause the output to change, bec ause it is connected to the hot inlet of
*
.
Bad evaluation order
16
15
+
8
+
good
bad
8
fig 3.2: Bad ordering
A problem arises when messages fan out fro m a single
outlet into other operations. Look a t the two patches in
Fig. 3.2 . Can you tell the difference? It is impossible
to tell just by looking that one is a working patch and
the other c ontains a nasty error. Each is an attempt to
double the value of a number by connecting it to both