You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
miller-book/node52.html

183 lines
6.6 KiB

<!DOCTYPE html>
<!--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>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<TITLE>Converting controls to signals</TITLE>
<META NAME="description" CONTENT="Converting controls to signals">
<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="node53.html">
<LINK REL="previous" HREF="node51.html">
<LINK REL="up" HREF="node50.html">
<LINK REL="next" HREF="node53.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1321"
HREF="node53.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A NAME="tex2html1315"
HREF="node50.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A NAME="tex2html1309"
HREF="node51.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A NAME="tex2html1317"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A NAME="tex2html1319"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1322"
HREF="node53.html">Non-looping wavetable player</A>
<B> Up:</B> <A NAME="tex2html1316"
HREF="node50.html">Examples</A>
<B> Previous:</B> <A NAME="tex2html1310"
HREF="node51.html">Sampling and foldover</A>
&nbsp; <B> <A NAME="tex2html1318"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1320"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION007102000000000000000">
Converting controls to signals</A>
</H2>
<P>
Example C03.zipper.noise.pd (Figure <A HREF="node51.html#fig03.13">3.13</A>, part b) demonstrates the effect of
converting a slowly-updated control stream to an audio signal. This introduces
a new object:
<P>
<BR><!-- MATH
$\fbox{ $\mathrm{line}$}$
-->
<IMG
WIDTH="44" HEIGHT="41" ALIGN="MIDDLE" BORDER="0"
SRC="img345.png"
ALT="\fbox{ $\mathrm{line}$}">:
<A NAME="3847"></A>a ramp generator with control output. Like <TT>line~</TT>, <TT>line</TT> takes pairs of numbers as (target, time) pairs and ramps to the target in the
given amount of time; however, unlike <TT>line~</TT>, the output is
a numeric control stream, appearing, by default, at 20 msec time intervals.
<P>
In the example you can compare the sound of the rising and falling amplitude
controlled by the <TT>line</TT> output with one controlled by the audio
signal generated by <TT>line~</TT>.
<P>
The output of <TT>line</TT> is converted to an audio signal at the input of
the <TT>*~</TT> object. The conversion is implied here by connecting a
numeric control stream into a signal inlet. In Pd, implicit conversions from
numeric control streams to audio streams is done in the fast-as-possible mode
shown in Figure <A HREF="node43.html#fig03.04">3.4</A> (part a). The <TT>line</TT> output becomes a
staircase signal with 50 steps per second. The result is commonly called
``zipper noise".
<P>
Whereas the limitations of the <TT>line</TT> object for generating audio
signals were clearly audible even over such long time periods as 300 msec, the
signal variant, <TT>line~</TT>, does not yield audible problems until the time
periods involved become much shorter. Example C04.control.to.signal.pd (Figure <A HREF="node51.html#fig03.13">3.13</A>,
part c) demonstrates the effect of using <TT>line~</TT> to generate a 250 Hertz
triangle wave. Here the effects shown in Figure <A HREF="node43.html#fig03.05">3.5</A> come into
play. Since <TT>line~</TT> always aligns line segments to block boundaries, the
exact durations of line segments vary, and in this example the variation (on
the order of a millisecond) is a significant fraction of their
length.
<P>
A more precise object (and a more expensive one, in terms of computation time)
is provided for these situations:
<P>
<BR><!-- MATH
$\fbox{ $\mathrm{vline}\sim$}$
-->
<IMG
WIDTH="69" HEIGHT="41" ALIGN="MIDDLE" BORDER="0"
SRC="img346.png"
ALT="\fbox{ $\mathrm{vline}\sim$}">:
<A NAME="3848"></A>exact line segment generator. This third member of the ``line" family
outputs an audio signal (like <TT>line~</TT>), but aligns the endpoints of the signal to
the desired time points, accurate to a fraction of a sample. (The accuracy
is limited only by the floating-point numerical format used by Pd.) Further,
many line segments may be specified withing a single audio block;
<TT>vline~</TT> can generate waveforms at periods down to two samples
(beyond which you will just get foldover instead).
<P>
The <TT>vline~</TT> object can also be used for converting numeric
control streams to audio streams in the nearest-sample and two-point-interpolation
modes as shown in Figure <A HREF="node43.html#fig03.04">3.4</A> (parts b and
c). To get nearest-sample conversion, simply give <TT>vline~</TT> a
ramp time of zero. For linear interpolation, give it a ramp time of
one sample (0.0227 msec if the sample rate is 44100 Hertz).
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1321"
HREF="node53.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A NAME="tex2html1315"
HREF="node50.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A NAME="tex2html1309"
HREF="node51.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A NAME="tex2html1317"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A NAME="tex2html1319"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1322"
HREF="node53.html">Non-looping wavetable player</A>
<B> Up:</B> <A NAME="tex2html1316"
HREF="node50.html">Examples</A>
<B> Previous:</B> <A NAME="tex2html1310"
HREF="node51.html">Sampling and foldover</A>
&nbsp; <B> <A NAME="tex2html1318"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1320"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>