| 1 | |
| 2 | <refentry id="peak"> |
| 3 | <indexterm id="IndexPeak"><primary>peak</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>peak</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>peak</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Maintains the output equal to the highest absolute value received. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | These opcodes maintain the output k-rate variable as the peak absolute level so far received. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>kres <command>peak</command> asig</synopsis> |
| 29 | |
| 30 | <synopsis>kres <command>peak</command> ksig</synopsis> |
| 31 | </refsect1> |
| 32 | |
| 33 | <refsect1> |
| 34 | <title>Performance</title> |
| 35 | <para> |
| 36 | <emphasis>kres</emphasis> -- Output equal to the highest absolute value received so far. This is effectively an input to the opcode as well, since it reads <emphasis>kres</emphasis> in order to decide whether to write something higher into it. |
| 37 | </para> |
| 38 | |
| 39 | <para> |
| 40 | <emphasis>ksig </emphasis> -- k-rate input signal. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | <emphasis>asig </emphasis> -- a-rate input signal. |
| 45 | </para> |
| 46 | </refsect1> |
| 47 | |
| 48 | <refsect1> |
| 49 | <title>Examples</title> |
| 50 | <para> |
| 51 | Here is an example of the peak opcode. It uses the file <ulink url="examples/peak.csd"><citetitle>peak.csd</citetitle></ulink>, and <ulink url="examples/drumsMlp.wav"><citetitle>drumsMlp.wav</citetitle></ulink>. |
| 52 | <example> |
| 53 | <title>Example of the peak opcode.</title> |
| 54 | <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> |
| 55 | <xi:include href="examples-xml/peak.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 56 | </example> |
| 57 | |
| 58 | Its output should include lines like this: |
| 59 | <screen> |
| 60 | i 1 time 0.00000: 0.00118 |
| 61 | i 1 time 0.50068: 0.71418 |
| 62 | i 1 time 1.00136: 0.80155 |
| 63 | i 1 time 1.50204: 0.89209 |
| 64 | i 1 time 2.00272: 0.89209 |
| 65 | i 1 time 2.50340: 0.89209 |
| 66 | </screen> |
| 67 | </para> |
| 68 | </refsect1> |
| 69 | |
| 70 | <refsect1> |
| 71 | <title>See also</title> |
| 72 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Envelope followers</citetitle></link></para> |
| 73 | </refsect1> |
| 74 | |
| 75 | <refsect1> |
| 76 | <title>Credits</title> |
| 77 | <para> |
| 78 | <simplelist> |
| 79 | <member>Author: Robin Whittle</member> |
| 80 | <member>Australia</member> |
| 81 | <member>May 1997</member> |
| 82 | </simplelist> |
| 83 | </para> |
| 84 | <para>Example written by &namekevin;.</para> |
| 85 | </refsect1> |
| 86 | </refentry> |