miller-book/node49.html

242 lines
8.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 2002-2-1 (1.71)
original version by: Nikos Drakos, CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Control operations in Pd</TITLE>
<META NAME="description" CONTENT="Control operations in Pd">
<META NAME="keywords" CONTENT="book">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="book.css">
<LINK REL="next" HREF="node50.html">
<LINK REL="previous" HREF="node48.html">
<LINK REL="up" HREF="node40.html">
<LINK REL="next" HREF="node50.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1273"
HREF="node50.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="file:/usr/local/share/lib/latex2html/icons/next.png"></A>
<A NAME="tex2html1267"
HREF="node40.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="file:/usr/local/share/lib/latex2html/icons/up.png"></A>
<A NAME="tex2html1261"
HREF="node48.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="file:/usr/local/share/lib/latex2html/icons/prev.png"></A>
<A NAME="tex2html1269"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="file:/usr/local/share/lib/latex2html/icons/contents.png"></A>
<A NAME="tex2html1271"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="file:/usr/local/share/lib/latex2html/icons/index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1274"
HREF="node50.html">Examples</A>
<B> Up:</B> <A NAME="tex2html1268"
HREF="node40.html">Audio and control computations</A>
<B> Previous:</B> <A NAME="tex2html1262"
HREF="node48.html">Operations on control streams</A>
&nbsp; <B> <A NAME="tex2html1270"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1272"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00790000000000000000">
Control operations in Pd</A>
</H1>
<P>
So far we have used Pd mostly for processing audio signals, although as early
as Figure <A HREF="node16.html#fig01.10">1.10</A> 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
<A NAME="3697"></A>
<I>messages</I>. The messages may contain data (most often, one or more
numbers), or not. A
<A NAME="3699"></A>
<I>numeric control stream</I>
(Section <A HREF="node43.html#sect3.controlstreams">3.3</A>) appears as a (thin) connection that
carries numbers as messages.
<P>
Messages not containing data make up <I>time sequences</I>. So that you can
see messages with no data, in Pd they are given the (arbitrary) symbol ``bang".
<P>
<DIV ALIGN="CENTER"><A NAME="fig03.12"></A><A NAME="3705"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 3.12:</STRONG>
The four control operations in Pd: (a) delay; (b) merging;
(c) pruning; (d) resynchronizing.</CAPTION>
<TR><TD><IMG
WIDTH="332" HEIGHT="224" BORDER="0"
SRC="img337.png"
ALT="\begin{figure}\psfig{file=figs/fig03.12.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
The four types of control operations described in the previous section can
be expressed in Pd as shown in Figure <A HREF="#fig03.12">3.12</A>.
<A NAME="3709"></A>
<I>Delays</I>
are accomplished
using two explicit delay objects:
<P>
<BR><!-- MATH
$\fbox{ $\mathrm{del}$\ }$
-->
<IMG
WIDTH="45" HEIGHT="41" ALIGN="MIDDLE" BORDER="0"
SRC="img338.png"
ALT="\fbox{ $\mathrm{del}$\ }">,
<BR><!-- MATH
$\fbox{ $\mathrm{delay}$\ }$
-->
<IMG
WIDTH="61" HEIGHT="41" ALIGN="MIDDLE" BORDER="0"
SRC="img339.png"
ALT="\fbox{ $\mathrm{delay}$\ }">:
<A NAME="3843"></A>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 <I>simple</I>
in the sense that sending a bang to an already set delay resets it to a new
output time, canceling the previously scheduled one.
<P>
<BR><!-- MATH
$\fbox{ $\mathrm{pipe}$\ }$
-->
<IMG
WIDTH="54" HEIGHT="40" ALIGN="MIDDLE" BORDER="0"
SRC="img340.png"
ALT="\fbox{ $\mathrm{pipe}$\ }">:
<A NAME="3844"></A>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 <TT>pipe</TT> simultaneously, and messages may be reordered as
they are output depending on the various delay times given for them.
<P>
<A NAME="3721"></A>
<I>Merging</I>
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 with number boxes as an example. In general, whenever more than one
connection is made to a control inlet, the control streams are merged.
<P>
Pd offers several objects for
<A NAME="3723"></A>
<I>pruning</I> control streams, of which two are shown in part (c) of the
figure:
<P>
<BR><!-- MATH
$\fbox{ $\mathrm{moses}$\ }$
-->
<IMG
WIDTH="65" HEIGHT="33" ALIGN="MIDDLE" BORDER="0"
SRC="img341.png"
ALT="\fbox{ $\mathrm{moses}$\ }">:
<A NAME="3845"></A>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.
<P>
<BR><!-- MATH
$\fbox{ $\mathrm{select}$\ }$
-->
<IMG
WIDTH="63" HEIGHT="41" ALIGN="MIDDLE" BORDER="0"
SRC="img342.png"
ALT="\fbox{ $\mathrm{select}$\ }">,
<BR><!-- MATH
$\fbox{ $\mathrm{sel}$\ }$
-->
<IMG
WIDTH="42" HEIGHT="41" ALIGN="MIDDLE" BORDER="0"
SRC="img343.png"
ALT="\fbox{ $\mathrm{sel}$\ }">:
<A NAME="3846"></A>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.
<P>
Finally, Pd takes care of
<A NAME="3734"></A>
<I>resynchronizing</I>
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 <TT>float</TT> 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 <TT>float</TT> has received beforehand.
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1273"
HREF="node50.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="file:/usr/local/share/lib/latex2html/icons/next.png"></A>
<A NAME="tex2html1267"
HREF="node40.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="file:/usr/local/share/lib/latex2html/icons/up.png"></A>
<A NAME="tex2html1261"
HREF="node48.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="file:/usr/local/share/lib/latex2html/icons/prev.png"></A>
<A NAME="tex2html1269"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="file:/usr/local/share/lib/latex2html/icons/contents.png"></A>
<A NAME="tex2html1271"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="file:/usr/local/share/lib/latex2html/icons/index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1274"
HREF="node50.html">Examples</A>
<B> Up:</B> <A NAME="tex2html1268"
HREF="node40.html">Audio and control computations</A>
<B> Previous:</B> <A NAME="tex2html1262"
HREF="node48.html">Operations on control streams</A>
&nbsp; <B> <A NAME="tex2html1270"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1272"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>