| 1 | |
| 2 | <refentry id="max_k"> |
| 3 | <indexterm id="Indexmax_k"><primary>max_k</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Comparators and Accumulators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>max_k</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>max_k</refname> |
| 13 | <refpurpose> |
| 14 | Local maximum (or minimum) value of an incoming asig signal |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | <emphasis>max_k</emphasis> outputs the local maximum (or minimum) value of the incoming asig signal, checked in the time interval between ktrig has become true twice. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>knumkout <command>max_k</command> asig, ktrig, itype</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>itype</emphasis> - itype determinates the behaviour of max_k (see below) |
| 34 | </para> |
| 35 | |
| 36 | </refsect1> |
| 37 | <refsect1> |
| 38 | <title>Performance</title> |
| 39 | <para> |
| 40 | <emphasis>asig</emphasis> - incoming (input) signal |
| 41 | </para> |
| 42 | <para> |
| 43 | <emphasis>ktrig</emphasis> - trigger signal |
| 44 | </para> |
| 45 | <para> |
| 46 | max_k outputs the local maximum (or minimum) value of the incoming <emphasis>asig</emphasis> signal, checked in the time interval between <emphasis>ktrig</emphasis> has become true twice. <emphasis>itype</emphasis> determinates the behaviour of max_k:</para> |
| 47 | <para> |
| 48 | 1 - absolute maximum (sign of negative values is changed to positive before evaluation). |
| 49 | </para> |
| 50 | <para> |
| 51 | 2 - actual maximum. |
| 52 | </para> |
| 53 | <para> |
| 54 | 3 - actual minimum. |
| 55 | </para> |
| 56 | <para> |
| 57 | 4 - calculate average value of <emphasis>asig</emphasis> in the |
| 58 | time interval since the last trigger. |
| 59 | </para> |
| 60 | <para> |
| 61 | This opcode can be useful in several situations, for example to implement a vu-meter. |
| 62 | </para> |
| 63 | |
| 64 | </refsect1> |
| 65 | |
| 66 | <refsect1> |
| 67 | <title>Examples</title> |
| 68 | <para> |
| 69 | Here is an example of the max_k opcode. It uses the file <ulink url="examples/max_k.csd"><citetitle>max_k.csd</citetitle></ulink>. |
| 70 | <example> |
| 71 | <title>Example of the max_k opcode.</title> |
| 72 | <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> |
| 73 | <xi:include href="examples-xml/max_k.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 74 | </example> |
| 75 | </para> |
| 76 | </refsect1> |
| 77 | |
| 78 | <refsect1> |
| 79 | <title>See also</title> |
| 80 | <para><link linkend="SigmodCompaccum"><citetitle>Comparators and Accumulators</citetitle></link></para> |
| 81 | </refsect1> |
| 82 | |
| 83 | <refsect1> |
| 84 | <title>Credits</title> |
| 85 | <para>Written by &namegabriel;.</para> |
| 86 | <para>New in Csound 5 (Previously available only on |
| 87 | CsoundAV)</para> |
| 88 | <para>Fixed to agree with documentation in 5.15</para> |
| 89 | </refsect1> |
| 90 | </refentry> |