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/node29.html

225 lines
8.2 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>Enveloping samplers</TITLE>
<META NAME="description" CONTENT="Enveloping samplers">
<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="node30.html">
<LINK REL="previous" HREF="node28.html">
<LINK REL="up" HREF="node26.html">
<LINK REL="next" HREF="node30.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A ID="tex2html974"
HREF="node30.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A ID="tex2html968"
HREF="node26.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A ID="tex2html962"
HREF="node28.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A ID="tex2html970"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A ID="tex2html972"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A ID="tex2html975"
HREF="node30.html">Timbre stretching</A>
<B> Up:</B> <A ID="tex2html969"
HREF="node26.html">Wavetables and samplers</A>
<B> Previous:</B> <A ID="tex2html963"
HREF="node28.html">Sampling</A>
&nbsp; <B> <A ID="tex2html971"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A ID="tex2html973"
HREF="node201.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A ID="SECTION00630000000000000000"></A>
<A ID="sect2.enveloping"></A>
<BR>
Enveloping samplers
</H1>
<P>
In the previous section we considered reading a wavetable either sporadically
or repeatedly to make a sampler. In most real applications we must deal with
getting the samples to start and stop cleanly, so that the output signal
doesn't jump discontinuously at the beginnings and ends of samples. This
discontinuity can sound like a click or a thump depending on the wavetable.
<P>
The easiest way to do this, assuming we will always play a wavetable completely
from beginning to end, is simply to prepare it in advance so that it
fades in cleanly at the beginning and out cleanly at the end. This may even
be done when the wavetable is sampled live, by multiplying the
input signal by a line segment envelope timed to match the length of the
recording.
<P>
In many situations, however, it is either inconvenient or impossible to
pre-envelope the wavetable--for example, we might want to play only part of
it back, or we may want to change the sharpness of the enveloping
dynamically. In Section <A HREF="node12.html#sect1.synth">1.5</A> we had already seen how
to control the amplitude of sinusoidal oscillators using multiplication by a
ramp function (also known as an envelope generator), and we built this notion
into the wavetable oscillators of Figures <A HREF="node27.html#fig02.03">2.3</A> and <A HREF="node27.html#fig02.04">2.4</A>.
This also works fine for turning samplers on and off to avoid discontinuities,
but with one major difference: whereas in wavetable synthesis, we were free to
assume that the waveform lines up end to end, so that we may choose
any envelope timing we want, in the case of sampling using unprepared waveforms,
we are obliged to get the envelope generator's output to zero by the time we
reach the end of the wavetable for the first time. This situation is pictured
in Figure <A HREF="#fig02.06">2.6</A>.
<P>
<DIV ALIGN="CENTER"><A ID="fig02.06"></A><A ID="2243"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.6:</STRONG>
Differing envelope requirements for oscillators and samplers: (a)
in an oscillator, the envelope can be chosen to conform to any desired
timescale; (b) when the wavetable is a recorded sound, it's up to you
to get the envelope to zero before you hit the end of the wavetable for the
first time. </CAPTION>
<TR><TD><IMG
WIDTH="453" HEIGHT="278" BORDER="0"
SRC="img218.png"
ALT="\begin{figure}\psfig{file=figs/fig02.06.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
In situations where an arbitrary wavetable must be repeated as needed, the
simplest way to make the looping work continuously is to arrange for amplitude
change to be synchronized with the looping, using a separate wavetable (the
envelope). This may be implemented as shown in Figure <A HREF="#fig02.07">2.7</A>. A single
sawtooth oscillator is used to calculate lookup indices for two wavetables, one
holding the recorded sound, and the other, an envelope shape. The main thing
to worry about is getting the inputs of the two wavetables each into its own
appropriate range.
<P>
<DIV ALIGN="CENTER"><A ID="fig02.07"></A><A ID="2500"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.7:</STRONG>
A sampler as in Figure <A HREF="node28.html#fig02.05">2.5</A>, but with an additional
wavetable lookup for enveloping.</CAPTION>
<TR><TD><IMG
WIDTH="325" HEIGHT="440" BORDER="0"
SRC="img219.png"
ALT="\begin{figure}\psfig{file=figs/fig02.07.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
In many situations it is desirable to combine two or more copies of the looping
wavetable sampler at the same frequency and at a specified phase relationship.
This may be done so that when any particular one is at the end of its segment,
one or more others is in the middle of the same segment, so that the aggregate
is continuously making sound. To accomplish this, we need a way to generate
two or more sawtooth waves at the desired phase relationship that we can use in
place of the oscillator at the top of Figure <A HREF="#fig02.07">2.7</A>. We can start with
a single sawtooth wave and then produce others at fixed phase relationships
with the first one. If we wish a sawtooth which is, say, <IMG
WIDTH="11" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$a$"> cycles ahead of
the first one, we simply add the parameter <IMG
WIDTH="11" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$a$"> and then take the fractional
part, which is the desired new sawtooth wave, as shown in Figure <A HREF="#fig02.08">2.8</A>.
<P>
<DIV ALIGN="CENTER"><A ID="fig02.08"></A><A ID="2256"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.8:</STRONG>
A technique for generating two or more sawtooth waves with
fixed phase relationships between
them. The relative phase is controlled by the parameter <IMG
WIDTH="11" HEIGHT="13" ALIGN="BOTTOM" BORDER="0"
SRC="img4.png"
ALT="$a$"> (which takes the
value 0.3 in the graphed signals). The "wrap" operation computes the fractional
part of its input.</CAPTION>
<TR><TD><IMG
WIDTH="603" HEIGHT="402" BORDER="0"
SRC="img220.png"
ALT="\begin{figure}\psfig{file=figs/fig02.08.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>
<P>
<HR>
<!--Navigation Panel-->
<A ID="tex2html974"
HREF="node30.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="next.png"></A>
<A ID="tex2html968"
HREF="node26.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="up.png"></A>
<A ID="tex2html962"
HREF="node28.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="prev.png"></A>
<A ID="tex2html970"
HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="contents.png"></A>
<A ID="tex2html972"
HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
SRC="index.png"></A>
<BR>
<B> Next:</B> <A ID="tex2html975"
HREF="node30.html">Timbre stretching</A>
<B> Up:</B> <A ID="tex2html969"
HREF="node26.html">Wavetables and samplers</A>
<B> Previous:</B> <A ID="tex2html963"
HREF="node28.html">Sampling</A>
&nbsp; <B> <A ID="tex2html971"
HREF="node4.html">Contents</A></B>
&nbsp; <B> <A ID="tex2html973"
HREF="node201.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>