next up previous contents index
Next: Examples Up: Audio and control computations Previous: Operations on control streams   Contents   Index

Control operations in Pd

So far we have used Pd mostly for processing audio signals, although as early as Figure 1.6 we have had to make the distinction between Pd's notion of audio signals and of control streams: thin connections carry control streams and thick ones carry audio. Control streams in Pd appear as sequences of messages. The messages may contain data (most often, one or more numbers), or not. A numeric control stream (section 3.3) appears as a (thin) connection that carries numbers as messages.

Messages not containing data make up time sequences. So that you can see messages with no data, in Pd they are given the (arbitrary) symbol ``bang".

Figure 3.12: The four control operations in Pd: (a) delay; (b) merging; (c) pruning; (d) resynchronizing.
\begin{figure}\psfig{file=figs/fig03.12.ps}\end{figure}

The four types of control operations described in the previous section can be expressed in Pd as shown in Figure 3.12. Delays are accomplished using two explicit delay objects:


\fbox{ $\mathrm{del}$\ },
\fbox{ $\mathrm{delay}$\ }: simple delay. You can specify the delay time in a creation argument or via the right inlet. A ``bang" in the left inlet sets the delay, which then outputs ``bang" after the specified delay in milliseconds. The delay is simple in the sense that sending a bang to an already set delay resets it to the new output time, canceling the previously scheduled one.


\fbox{ $\mathrm{pipe}$\ }: compound delay. Messages coming in the left inlet appear on the output after the specified delay, which is set by the first creation argument. If there are more creation arguments, they specify one or more inlets for numeric or symbolic data the messages will contain. Any number of messages may be stored by $\mathrm{pipe}$ simultaneously, and messages may be reordered as they are output depending on the various delay times given for them.

Merging of control streams in Pd is accomplished not by explicit objects but by Pd's connection mechanism itself. This is shown in part (b) of the figure.

Pd offers several objects for pruning control streams, of which two are shown in part (c) of the figure:


\fbox{ $\mathrm{moses}$\ }: prune for numeric range. Numeric messages coming in the left inlet appear on the left output if they are smaller than a threshold value (set by a creation argument or by the right inlet), and out the right inlet otherwise.


\fbox{ $\mathrm{select}$\ },
\fbox{ $\mathrm{sel}$\ }: prune for specific numbers. Numeric messages coming in the left inlet produce a ``bang" on the output only if they match a test value exactly. The test value is set either by creation argument or from the right inlet.

Finally, as for the case of merging, Pd takes care of resynchronizing control streams implicitly in its connection mechanism, as illustrated by part (d) of the figure. Most objects with more than one inlet synchronize all other inlets to the leftmost one. So the $\mathrm{float}$ object shown in the figure resynchronizes its right-hand-side inlet (which takes numbers) to its left-hand-side one. Sending a ``bang" to the left inlet outputs the most recent number $\mathrm{float}$ has received beforehand.


next up previous contents index
Next: Examples Up: Audio and control computations Previous: Operations on control streams   Contents   Index
Miller Puckette 2005-02-21