[PD] $ expansion

Maurizio Umberto Puxeddu umbpux at tin.it
Tue Sep 10 04:28:51 CEST 2002


You can use this, if you like it:

"In message or object boxes, Pd performs the so-called "dollar sign
expansion". A dollar sign followed by a number is a variable which is substituted with
a value supplied as part of the environment the message is passed in. This
expansion only happens at the beginning of an argument: "$1" and
"$3-bazoo" are expanded but "bazoo-$4" is not.

In the case of message boxes, the environment consists of the arguments of
the "list" message (possibly extrapolated from "bang," "float," or other)
that the message box is responding to. Thus, if a message box gets "23
skidoo" and if it contains the text, "$2 until $1," out comes the message,
"skidoo until 23".

Object boxes contain text which forms a message to be sent to Pd to
create and initialize the object. Here, $1, etc., are taken from the
context in which the patch was loaded. When the patch is a new document or
opened from a file the "$" variables are undefined. But if the patch is an
abstraction (see the next section) they are taked from the abstractions'
creation arguments.

As a special case of dollar sign expansion, inside abstractions $0 is
expanded to a counter which is guaranteed to be unique to that
abstraction. The dollar sign expansion mechanism and the special $0
variable can be used to make local objects. For example sends and
receives with names like "$0-bear" can be used as local send/receive
pairs."

Best,

Maurizio Umberto Puxeddu.





More information about the Pd-list mailing list