miller-book/node44.html

182 lines
6.8 KiB
HTML
Raw Normal View History

<!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 from audio signals to numeric control streams</TITLE>
<META NAME="description" CONTENT="Converting from audio signals to numeric 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="node45.html">
<LINK REL="previous" HREF="node43.html">
<LINK REL="up" HREF="node40.html">
<LINK REL="next" HREF="node45.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1203"
HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A NAME="tex2html1197"
HREF="node40.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A NAME="tex2html1191"
HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A NAME="tex2html1199"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A NAME="tex2html1201"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1204"
HREF="node45.html">Control streams in block</A>
<B> Up:</B> <A NAME="tex2html1198"
HREF="node40.html">Audio and control computations</A>
<B> Previous:</B> <A NAME="tex2html1192"
HREF="node43.html">Control streams</A>
&nbsp; <B> <A NAME="tex2html1200"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1202"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00740000000000000000">
Converting from audio signals to numeric control streams</A>
</H1>
<P>
We sometimes need to convert in the other direction, from an audio signal to a
sporadic one. To go in this direction, we somehow provide a series of logical
times (a time sequence), as well as an audio signal. For output we want
a control stream combining the time sequence with values taken from the
audio signal. We do this when we want to incorporate the signal's value as
part of a control computation.
<P>
For example, we might be controlling the amplitude of a signal using a
<TT>line~</TT> object as in Example A03.line.pd (Page
<A HREF="node21.html#sect1.ex.3"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]"
SRC="crossref.png"></A>). Suppose we wish to turn off the sound at a fixed rate
of speed instead of in a fixed amount of time. For instance, we might want to
re-use the network for another sound and wish to mute it as quickly as possible
without audible artifacts; we probably can ramp it off in less time if the
current amplitude is low than if it is high. To do this we must confect a
message to the <TT>line~</TT> object to send it to zero in an amount of
time we'll calculate on the basis of its current output value. This will
2022-04-12 23:17:03 -03:00
require, first of all, that we "sample" the <TT>line~</TT> object's
output (an audio signal) into a control stream.
<P>
The same issues of time delay and accuracy appear as for sporadic to audio
conversion. Again there will be a tradeoff between immediacy and accuracy.
Suppose as before that we are calculating audio in blocks of 4 samples, and
suppose that at logical time 6 we want to look at the value of an audio signal,
and use it to change the value of another one. As shown in Figure
<A HREF="node42.html#fig03.02">3.2</A> (part b), the most recently calculated value of the signal will
be for index 3 and the earliest index at which our calculation can affect a
signal is 4. We can therefore carry out the whole affair with a delay of only
one sample. However, we can't choose exactly <I>which</I> sample--the update
can occur only at a block boundary.
<P>
As before, we can trade immediacy for increased time accuracy. If it matters
exactly at which sample we carry out the audio-to-control-to-audio computation,
we read the sample of index 2 and update the one at index 6. Then if we want
to do the same thing again at logical time 7, we read from index 3 and update
at index 7, and so on. In general, if the block size is <IMG
WIDTH="16" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img311.png"
ALT="$B$">, and for any
index <IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$">, we can always read the sample at index <IMG
WIDTH="45" HEIGHT="30" ALIGN="MIDDLE" BORDER="0"
SRC="img329.png"
ALT="$n-B$"> and affect the
one at index <IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$">. There is thus a round-trip delay of <IMG
WIDTH="16" HEIGHT="14" ALIGN="BOTTOM" BORDER="0"
SRC="img311.png"
ALT="$B$"> samples in going
from audio to control to audio computation, which is the price incurred for
being able to name the index <IMG
WIDTH="13" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img75.png"
ALT="$n$"> exactly.
<P>
If we wish to go further, to being able to specify a fraction of a sample, then
(as before) we can use interpolation--at a slight further increase in delay.
In general, as in the case of sporadic-to-audio conversion, in most cases the
simplest solution is the best, but occasionally we have to do extra work.
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1203"
HREF="node45.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A NAME="tex2html1197"
HREF="node40.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A NAME="tex2html1191"
HREF="node43.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A NAME="tex2html1199"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A NAME="tex2html1201"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1204"
HREF="node45.html">Control streams in block</A>
<B> Up:</B> <A NAME="tex2html1198"
HREF="node40.html">Audio and control computations</A>
<B> Previous:</B> <A NAME="tex2html1192"
HREF="node43.html">Control streams</A>
&nbsp; <B> <A NAME="tex2html1200"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A NAME="tex2html1202"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>