miller-book/node48.html

207 lines
7.7 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>Operations on control streams</TITLE>
<META NAME="description" CONTENT="Operations on control streams">
<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="node49.html">
<LINK REL="previous" HREF="node47.html">
<LINK REL="up" HREF="node40.html">
<LINK REL="next" HREF="node49.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1259"
HREF="node49.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="tex2html1253"
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="tex2html1247"
HREF="node47.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="tex2html1255"
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="tex2html1257"
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="tex2html1260"
HREF="node49.html">Control operations in Pd</A>
<B> Up:</B> <A NAME="tex2html1254"
HREF="node40.html">Audio and control computations</A>
<B> Previous:</B> <A NAME="tex2html1248"
HREF="node47.html">Audio signals as control</A>
&nbsp; <B> <A NAME="tex2html1256"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1258"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00780000000000000000">
Operations on control streams</A>
</H1>
<P>
So far we've discussed how to convert between control streams and audio
streams. In addition to this possibility, there are four types of
operations
you can perform on control streams to get other control streams. These control
stream operations have no corresponding operations on audio signals. Their
existence explains in large part why it is useful to introduce a whole
control structure in parallel with that of audio signals.
<P>
The first type consists of
<A NAME="3671"></A>
<I>delay</I>
operations, which offset the time values associated with a control stream.
In real-time systems the delays can't be negative in value. A control stream
may be delayed by a constant amount, or alternatively, you can delay each event
separately by different amounts.
<P>
Two different types of delay are used in practice:
<A NAME="3673"></A>
<I>simple</I> and
<A NAME="3675"></A>
<I>compound</I>. Examples of each are shown in Figure <A HREF="#fig03.10">3.10</A>. A simple
delay acting on a control stream schedules each event, as it comes in,
for a time in the future. However, if another event arrives at the input
before the first event is output, the first event is forgotten in favor of the
second. In a compound delay, each event at the input produces an output, even
if other inputs arrive before the output appears.
<P>
<DIV ALIGN="CENTER"><A NAME="fig03.10"></A><A NAME="3680"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 3.10:</STRONG>
Delay as an operation on a control stream: (a) block
diagram; (b) effect of a simple delay on a control stream; (c) effect
of a compound delay.</CAPTION>
<TR><TD><IMG
WIDTH="338" HEIGHT="384" BORDER="0"
SRC="img335.png"
ALT="\begin{figure}\psfig{file=figs/fig03.10.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
A second operation on control steams is
<A NAME="3683"></A><I>merging</I>:
taking two control streams and combining
all the events into a new one. Figure <A HREF="#fig03.11">3.11</A> (part a) shows how this
and the remaining operations are represented in block diagrams.
<P>
Part (b) of the figure shows the effect of merging two streams. Streams may
contain more than one event at the same time. If two streams to be merged
contain events at the same time, the merged stream contains them both, in a
well-defined order.
<P>
A third type of operation on control streams is
<A NAME="3686"></A><I>pruning</I>.
Pruning a control stream means looking at the associated data and letting only
certain elements through. Part (c) shows an example, in
which events (which each have an associated number) are passed through only if
the number is positive.
<P>
<DIV ALIGN="CENTER"><A NAME="fig03.11"></A><A NAME="3690"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 3.11:</STRONG>
Operations on control streams (besides delay): (a) block diagrams;
(b) merging; (c) pruning; (d) resynchronizing.</CAPTION>
<TR><TD><IMG
WIDTH="344" HEIGHT="533" BORDER="0"
SRC="img336.png"
ALT="\begin{figure}\psfig{file=figs/fig03.11.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
Finally, there is the concept of <A NAME="3693"></A>
<I>resynchronizing</I> one control stream to another, as shown in part (d).
Here one control stream (the source) contributes values which are
put onto the time sequence of a second one (the sync). The value given the
output is always the most recent one from the source stream. Note that any
event from the source may appear more than once (as suggested in the figure),
or, on the other hand, it might not appear at all.
<P>
Again, we have to consider what happens when the two streams each contain an
event at the same time. Should the sync even be considered as happening before
the source (so that the output gets the value of the previous source event)?
Or should the source event be considered as being first so that its value goes
to the output at the same time? How this should be disambiguated is a design
question, to which various software environments take various approaches. (In
Pd it is controlled explicitly by the user.)
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1259"
HREF="node49.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="tex2html1253"
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="tex2html1247"
HREF="node47.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="tex2html1255"
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="tex2html1257"
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="tex2html1260"
HREF="node49.html">Control operations in Pd</A>
<B> Up:</B> <A NAME="tex2html1254"
HREF="node40.html">Audio and control computations</A>
<B> Previous:</B> <A NAME="tex2html1248"
HREF="node47.html">Audio signals as control</A>
&nbsp; <B> <A NAME="tex2html1256"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1258"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>