Debian Codegraph @

opcodes/maxaccum.xml

raw symbols SCIP
1
2 <refentry id="maxaccum">
3 <indexterm id="IndexMaxaccum"><primary>maxaccum</primary></indexterm>
4 <refentryinfo><title>Signal Modifiers:Comparators and Accumulators</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>maxaccum</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>maxaccum</refname>
13 <refpurpose>
14 Accumulates the maximum value of audio signals.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 <emphasis>maxaccum</emphasis> compares two audio-rate variables and stores the maximum value between them into the first.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis><command>maxaccum</command> aAccumulator, aInput</synopsis>
28 </refsect1>
29
30 <refsect1>
31 <title>Performance</title>
32 <para>
33 <emphasis>aAccumulator</emphasis> -- audio variable to store the maximum value
34 </para>
35
36 <para>
37 <emphasis>aInput</emphasis> -- signal that aAccumulator is compared to
38 </para>
39
40 <para>
41 The <emphasis>maxaccum</emphasis> opcode is designed to accumulate the maximum 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>max</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>maxaccum</emphasis> keeps the maximum value instead of adding the signals together. <emphasis>maxaccum</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 zero (perhaps by using the <emphasis>clear</emphasis> opcode). Care must be taken however if aInput is negative at any point, in which case the accumulator should be initialized and reset to some large enough negative value that will always be less 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 maxaccum opcode. It uses the file <ulink url="examples/maxaccum.csd"><citetitle>maxaccum.csd</citetitle></ulink>.
59 <example>
60 <title>Example of the maxabs 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/maxaccum.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>