<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>samphold</title> <link rel="stylesheet" href="csound.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="scale.html" title="scale" /> <link rel="next" href="sandpaper.html" title="sandpaper" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">samphold</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="scale.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="sandpaper.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="samphold"> <a id="samphold"></a> <div class="titlepage"></div> <a id="IndexSamphold" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">samphold</span> </h2> <p>samphold — Performs a sample-and-hold operation on its input. </p> </div> <div class="refsect1" title="Description"> <a id="id3171867"></a> <h2>Description</h2> <p> Performs a sample-and-hold operation on its input. </p> </div> <div class="refsect1" title="Syntax"> <a id="id3171878"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>samphold</strong></span> asig, agate [, ival] [, ivstor]</pre> <pre class="synopsis">kres <span class="command"><strong>samphold</strong></span> ksig, kgate [, ival] [, ivstor]</pre> </div> <div class="refsect1" title="Initialization"> <a id="id3172659"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ival, ivstor</em></span> (optional) -- controls initial disposition of internal save space. If <span class="emphasis"><em>ivstor</em></span> is zero the internal <span class="quote">“<span class="quote">hold</span>”</span> value is set to <span class="emphasis"><em>ival</em></span> ; else it retains its previous value. Defaults are 0,0 (i.e. init to zero) </p> </div> <div class="refsect1" title="Performance"> <a id="id3172687"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kgate, xgate</em></span> -- controls whether to hold the signal. </p> <p> <span class="emphasis"><em>samphold</em></span> performs a sample-and-hold operation on its input according to the value of <span class="emphasis"><em>gate</em></span>. If <span class="emphasis"><em>gate != 0</em></span>, the input samples are passed to the output; if <span class="emphasis"><em>gate = 0</em></span>, the last output value is repeated. The controlling <span class="emphasis"><em>gate</em></span> can be a constant, a control signal, or an audio signal. </p> </div> <div class="refsect1" title="Examples"> <a id="id3172727"></a> <h2>Examples</h2> <p> </p> <div class="informalexample"> <pre class="programlisting"> asrc <span class="opc">buzz</span> 10000, 440, 20, 1 <span class="comment">; band-limited pulse train</span> adif <span class="opc">diff</span> asrc <span class="comment">; emphasize the highs</span> anew <span class="opc">balance</span> adif, asrc <span class="comment">; but retain the power</span> agate <span class="opc">reson</span> asrc, 0, 440 <span class="comment">; use a lowpass of the original</span> asamp <span class="opc">samphold</span> anew, agate <span class="comment">; to gate the new audiosig</span> aout <span class="opc">tone</span> asamp, 100 <span class="comment">; smooth out the rough edges</span></pre> </div> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="id3172819"></a> <h2>See Also</h2> <p> <a class="link" href="diff.html" title="diff"><em class="citetitle">diff</em></a>, <a class="link" href="downsamp.html" title="downsamp"><em class="citetitle">downsamp</em></a>, <a class="link" href="integ.html" title="integ"><em class="citetitle">integ</em></a>, <a class="link" href="interp.html" title="interp"><em class="citetitle">interp</em></a>, <a class="link" href="upsamp.html" title="upsamp"><em class="citetitle">upsamp</em></a> </p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="scale.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="sandpaper.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">scale </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> sandpaper</td> </tr> </table> </div> </body> </html>