| 1 | |
| 2 | <refentry id="minaccum"> |
| 3 | <indexterm id="IndexMinaccum"><primary>minaccum</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Comparators and Accumulators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>minaccum</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>minaccum</refname> |
| 13 | <refpurpose> |
| 14 | Accumulates the minimum value of audio signals. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | <emphasis>minaccum</emphasis> compares two audio-rate variables and stores the minimum value between them into the first. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis><command>minaccum</command> aAccumulator, aInput</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Performance</title> |
| 32 | <para> |
| 33 | <emphasis>aAccumulator</emphasis> -- audio variable to store the minimum value |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>aInput</emphasis> -- signal that aAccumulator is compared to |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | The <emphasis>minaccum</emphasis> opcode is designed to accumulate the minimum value from among many audio signals that may be in different note instances, different channels, or otherwise cannot all be compared at once using the <emphasis>min</emphasis> opcode. Its semantics are similar to <emphasis>vincr</emphasis> since <emphasis>aAccumulator</emphasis> is used as both an input and an output variable, except that <emphasis>minaccum</emphasis> keeps the minimum value instead of adding the signals together. <emphasis>minaccum</emphasis> performs the following operation on each pair of samples: |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <literallayout> |
| 46 | if (aInput < aAccumulator) aAccumulator = aInput |
| 47 | </literallayout> |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | <emphasis>aAccumulator</emphasis> will usually be a global audio variable. At the end of any given computation cycle (k-period), after its value is read and used in some way, the accumulator variable should usually be reset to some large enough positive value that will always be greater than the input signals to which it is compared. |
| 52 | </para> |
| 53 | </refsect1> |
| 54 | |
| 55 | <refsect1> |
| 56 | <title>Examples</title> |
| 57 | <para> |
| 58 | Here is an example of the minaccum opcode. It uses the file <ulink url="examples/minaccum.csd"><citetitle>minaccum.csd</citetitle></ulink>. |
| 59 | <example> |
| 60 | <title>Example of the minaccum opcode.</title> |
| 61 | <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> |
| 62 | <xi:include href="examples-xml/minaccum.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 63 | </example> |
| 64 | </para> |
| 65 | </refsect1> |
| 66 | |
| 67 | <refsect1> |
| 68 | <title>See also</title> |
| 69 | <para><link linkend="SigmodCompaccum"><citetitle>Comparators and Accumulators</citetitle></link></para> |
| 70 | </refsect1> |
| 71 | |
| 72 | <refsect1> |
| 73 | <title>Credits</title> |
| 74 | <para> |
| 75 | <simplelist> |
| 76 | <member>Author: &nameanthony;</member> |
| 77 | <member>March 2006</member> |
| 78 | </simplelist> |
| 79 | </para> |
| 80 | |
| 81 | <para>New in Csound version 5.01</para> |
| 82 | </refsect1> |
| 83 | </refentry> |