| 1 | |
| 2 | <refentry id="samphold"> |
| 3 | <indexterm id="IndexSamphold"><primary>samphold</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Sample Level Operators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>samphold</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>samphold</refname> |
| 11 | <refpurpose> |
| 12 | Performs a sample-and-hold operation on its input. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Performs a sample-and-hold operation on its input. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ares <command>samphold</command> asig, agate [, ival] [, ivstor]</synopsis> |
| 26 | |
| 27 | <synopsis>kres <command>samphold</command> ksig, kgate [, ival] [, ivstor]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <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) |
| 34 | </para> |
| 35 | </refsect1> |
| 36 | |
| 37 | <refsect1> |
| 38 | <title>Performance</title> |
| 39 | <para> |
| 40 | <emphasis>kgate, xgate</emphasis> -- controls whether to hold the signal. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | <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. |
| 45 | </para> |
| 46 | </refsect1> |
| 47 | |
| 48 | <refsect1> |
| 49 | <title>Examples</title> |
| 50 | <para> |
| 51 | <informalexample> |
| 52 | <programlisting> |
| 53 | asrc <emphasis role="opc">buzz</emphasis> 10000, 440, 20, 1 <emphasis role="comment">; band-limited pulse train</emphasis> |
| 54 | adif <emphasis role="opc">diff</emphasis> asrc <emphasis role="comment">; emphasize the highs</emphasis> |
| 55 | anew <emphasis role="opc">balance</emphasis> adif, asrc <emphasis role="comment">; but retain the power</emphasis> |
| 56 | agate <emphasis role="opc">reson</emphasis> asrc, 0, 440 <emphasis role="comment">; use a lowpass of the original</emphasis> |
| 57 | asamp <emphasis role="opc">samphold</emphasis> anew, agate <emphasis role="comment">; to gate the new audiosig</emphasis> |
| 58 | aout <emphasis role="opc">tone</emphasis> asamp, 100 <emphasis role="comment">; smooth out the rough edges</emphasis></programlisting> |
| 59 | </informalexample> |
| 60 | </para> |
| 61 | <para> |
| 62 | Here is another example of the samphold opcode. It uses the file <ulink url="examples/samphold.csd"><citetitle>samphold.csd</citetitle></ulink>. |
| 63 | <example> |
| 64 | <title>Example of the samphold opcode.</title> |
| 65 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 66 | <xi:include href="examples-xml/samphold.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 67 | </example> |
| 68 | </para> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>See also</title> |
| 73 | <para><link linkend="SigmodSample"><citetitle>Sample Level Operators</citetitle></link></para> |
| 74 | </refsect1> |
| 75 | |
| 76 | </refentry> |