<!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>Switch-and-ramp</TITLE>
<META NAME="description" CONTENT="Switch-and-ramp">
<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="previous" HREF="node62.html">
<LINK REL="up" HREF="node61.html">
<LINK REL="next" HREF="node64.html">
</HEAD>

<BODY >
<!--Navigation Panel-->
<A ID="tex2html1487"
  HREF="node64.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="next.png"></A> 
<A ID="tex2html1481"
  HREF="node61.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="up.png"></A> 
<A ID="tex2html1477"
  HREF="node62.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="prev.png"></A> 
<A ID="tex2html1483"
  HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="contents.png"></A> 
<A ID="tex2html1485"
  HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="index.png"></A> 
<BR>
<B> Next:</B> <A ID="tex2html1488"
  HREF="node64.html">Polyphony</A>
<B> Up:</B> <A ID="tex2html1482"
  HREF="node61.html">Continuous and discontinuous control</A>
<B> Previous:</B> <A ID="tex2html1478"
  HREF="node62.html">Muting</A>
 &nbsp; <B>  <A ID="tex2html1484"
  HREF="node4.html">Contents</A></B> 
 &nbsp; <B>  <A ID="tex2html1486"
  HREF="node201.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H2><A ID="SECTION00832000000000000000">
Switch-and-ramp</A>
</H2>

<P>
The
<A ID="4648"></A>
<I>switch-and-ramp</I>
technique also seeks to remove discontinuities resulting from discontinuous
control changes, but does so in a different way: by synthesizing an opposing
discontinuity which we add to cancel the original one out.  Figure
<A HREF="#fig04.06">4.6</A> shows an example in which a synthetic  percussive sound (an
enveloped sinusoid) starts a note in the middle of a previous one.  The attack
of the sound derives not from the amplitude envelope but from the initial phase
of the sinusoid, as is often appropriate for percussive sounds.  The lower
graph in the figure shows a compensating audio signal with an opposing
discontinuity, which can be added to the upper one to remove the discontinuity.
The advantages of this technique over muting are, first, that there need be no
delay between the decision to make an attack and the sound of the attack; and
second, that any artifacts arising from this technique are more likely to be
masked by the new sound's onset.

<P>

<DIV ALIGN="CENTER"><A ID="fig04.06"></A><A ID="4653"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.6:</STRONG>
The switch-and-ramp technique for canceling out discontinuous changes.
A discontinuity (upper graph) is measured and canceled out with a signal
having the opposite discontinuity (lower graph), which then decays smoothly.</CAPTION>
<TR><TD><IMG
 WIDTH="298" HEIGHT="121" BORDER="0"
 SRC="img369.png"
 ALT="\begin{figure}\psfig{file=figs/fig04.06.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>

<P>
Figure <A HREF="#fig04.07">4.7</A> shows how the switch-and-ramp technique can be realized
in a block diagram.  The box marked with ellipsis ("...") may hold any
synthesis algorithm, which we wish to interrupt discontinuously so that it
restarts from zero (as in, for example, part (a) of the previous figure).  At
the same time that we trigger whatever control changes are necessary (exemplified by
the top ADSR generator), we also reset and trigger another ADSR generator
(middle right) to cancel out the discontinuity.  The discontinuity is minus the
last value of the synthesis output just before it is reset to zero.

<P>

<DIV ALIGN="CENTER"><A ID="fig04.07"></A><A ID="4659"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.7:</STRONG>
Block diagram for the switch-and-ramp technique.</CAPTION>
<TR><TD><IMG
 WIDTH="256" HEIGHT="373" BORDER="0"
 SRC="img370.png"
 ALT="\begin{figure}\psfig{file=figs/fig04.07.ps}\end{figure}"></TD></TR>
</TABLE>
</DIV>

<P>
To do this we measure the level the ADSR generator must now jump to.  This is
its own current level (which might not be zero) minus the discontinuity (or
equivalently, <I>plus</I> the synthesis output's last value).  The two are
added (by the <TT>+~</TT> object at bottom), and then a snapshot is taken. 
The cancelling envelope generator (at right) is reset discontinuously to this
new value, and then triggered to ramp back to zero.  The <TT>+~</TT> object's
output (the sum of the synthesizer output and the discontinuity-cancelling
signal) is the de-clicked signal.

<P>
<HR>
<!--Navigation Panel-->
<A ID="tex2html1487"
  HREF="node64.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
 SRC="next.png"></A> 
<A ID="tex2html1481"
  HREF="node61.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
 SRC="up.png"></A> 
<A ID="tex2html1477"
  HREF="node62.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
 SRC="prev.png"></A> 
<A ID="tex2html1483"
  HREF="node4.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
 SRC="contents.png"></A> 
<A ID="tex2html1485"
  HREF="node201.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index"
 SRC="index.png"></A> 
<BR>
<B> Next:</B> <A ID="tex2html1488"
  HREF="node64.html">Polyphony</A>
<B> Up:</B> <A ID="tex2html1482"
  HREF="node61.html">Continuous and discontinuous control</A>
<B> Previous:</B> <A ID="tex2html1478"
  HREF="node62.html">Muting</A>
 &nbsp; <B>  <A ID="tex2html1484"
  HREF="node4.html">Contents</A></B> 
 &nbsp; <B>  <A ID="tex2html1486"
  HREF="node201.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Miller Puckette
2006-12-30
</ADDRESS>
</BODY>
</HTML>