Specifications

3.3 Data flow control 27
appear, since the same number was sent when the input was 2. Without using
change
we would get {1, 1, 2, 2, 3, 3 ...} as output.
Send and receive objects
send mungo send midge
29 9 69
s mary
fig 3.13: Sends
Very useful for when patches get too visually dense,
or when you are working with patches spread across
many canvases.
send
and
receive
objects, abbreviated
as
s
and
r
work as named pairs. Anything that
goes into the send unit is tra nsmitted by an invisible wire and appears immedi-
ately on the receiver, so whatever goes into
send bob
reappears at
receive bob
.
29 9 69
receive mary r midger mungo
fig 3.14: Receives
Matching s e nds and receives have global names by
default and can exist in different canvases loaded at
the same time. So if the
receive
objects in Fig. 3.14
are in a different patch they will still pick up the
send values from Fig. 3.13. The relationship is one to many, so only one send
can have a particular name but can be picked up by multiple
receive
objects
with the same name. In the latest versions of Pd the destination is dynamic
and can be changed by a messag e on the rig ht inlet.
Broadcast messages
As we have just seen there is an invisible” environment through which messages
may travel as well as through wires. A message box containing a message that
begins with a semicolon is broadcast and Pd will route it to any destina tion that
matches the first symbol. This way, activating the message box
; foo 20
is the
same as sending a float message with a value of 20 to the object
s foo
.
Special message destinations
This method can be used to address arrays with special commands, to talk to
GUI elements that have a defined receive symbol or a s an alternative way to talk
to
receive
objects. If you want to change the s ize of arrays dynamically they
recognise a special resize message. There is also a special destination (which
always exists) called pd which is the audio engine. It can act on broadcast
messages like
; pd dsp 1
to turn on the audio computation from a patch. Some
examples ar e shown in Fig. 3.15
;
a1 sinesum 64 0.2 0.2
gain
64.00
;
gain 64
;
a2 resize 128;
a2 sinesum 128 0.1 0.2;
a2 normalize
a1
a2
fig 3.15: Special message broadcasts