<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="samphold">
  <refmeta>
    <refentrytitle>samphold</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>samphold</refname>
    <refpurpose>
      Performs a sample-and-hold operation on its input.
      <indexterm id="IndexSamphold"><primary>samphold</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Performs a sample-and-hold operation on its input.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ar <command>samphold</command> asig, agate [, ival] [, ivstor]</synopsis>

    <synopsis>kr <command>samphold</command> ksig, kgate [, ival] [, ivstor]</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ival, ivstor</emphasis> (optional) -- controls initial disposition of internal save space. If <emphasis>ivstor</emphasis> is zero the internal <quote>hold</quote> value is set to <emphasis>ival</emphasis> ; else it retains its previous value. Defaults are 0,0 (i.e. init to zero)
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>kgate, xgate</emphasis> -- controls whether to hold the signal.
    </para>

    <para>
      <emphasis>samphold</emphasis> performs a sample-and-hold operation on its input according to the value of <emphasis>gate</emphasis>. If <emphasis>gate !- 0</emphasis>, the input samples are passed to the output; If <emphasis>gate = 0</emphasis>, the last output value is repeated. The controlling <emphasis>gate</emphasis> can be a constant, a control signal, or an audio signal.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      <informalexample>
        <programlisting>
asrc  <emphasis>buzz</emphasis>      10000,440,20, 1     ; band-limited pulse train
adif  <emphasis>diff</emphasis>      asrc                ; emphasize the highs
anew  <emphasis>balance</emphasis>   adif, asrc          ;   but retain the power
agate <emphasis>reson</emphasis>     asrc,0,440          ; use a lowpass of the original
asamp <emphasis>samphold</emphasis>  anew, agate         ;   to gate the new audiosig
aout  <emphasis>tone</emphasis>      asamp,100           ; smooth out the rough edges
        </programlisting>
      </informalexample>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="diff"><citetitle>diff</citetitle></link>,
      <link linkend="downsamp"><citetitle>downsamp</citetitle></link>,
      <link linkend="integ"><citetitle>integ</citetitle></link>,
      <link linkend="interp"><citetitle>interp</citetitle></link>,
      <link linkend="upsamp"><citetitle>upsamp</citetitle></link>
    </para>
  </refsect1>
</refentry>
