Debian Codegraph @

opcodes/mxadsr.xml

raw symbols SCIP
1
2 <refentry id="mxadsr">
3 <indexterm id="IndexMxadsr"><primary>mxadsr</primary></indexterm>
4 <refentryinfo><title>Signal Generators:Envelope Generators</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>mxadsr</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>mxadsr</refname>
13 <refpurpose>
14 Calculates the classical ADSR envelope using the <emphasis>expsegr</emphasis> mechanism.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 Calculates the classical ADSR envelope using the <link linkend="expsegr"><citetitle>expsegr</citetitle></link> mechanism.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>ares <command>mxadsr</command> iatt, idec, islev, irel [, idel] [, ireltim]</synopsis>
28
29 <synopsis>kres <command>mxadsr</command> iatt, idec, islev, irel [, idel] [, ireltim]</synopsis>
30 </refsect1>
31
32 <refsect1>
33 <title>Initialization</title>
34 <para>
35 <emphasis>iatt</emphasis> -- duration of attack phase
36 </para>
37
38 <para>
39 <emphasis>idec</emphasis> -- duration of decay
40 </para>
41
42 <para>
43 <emphasis>islev</emphasis> -- level for sustain phase
44 </para>
45
46 <para>
47 <emphasis>irel</emphasis> -- duration of release phase
48 </para>
49
50 <para>
51 <emphasis>idel</emphasis> (optional, default=0) -- period of zero before the envelope starts
52 </para>
53
54 <para>
55 <emphasis>ireltim</emphasis> (optional, default=-1) -- Control release time after receiving a MIDI noteoff event. If less than zero, the longest release time given in the current instrument is used. If zero or more, the given value will be used for release time. Its default value is -1. (New in Csound 3.59 - not yet properly tested)
56 </para>
57 </refsect1>
58
59 <refsect1>
60 <title>Performance</title>
61 <para>
62 The envelope is in the range 0 to 1 and may need to be scaled further. The envelope may be described as:
63 <mediaobject>
64 <imageobject>
65 <imagedata fileref="images/xadsr2.png" format="PNG"/>
66 </imageobject>
67
68 <textobject>
69 <phrase>Picture of an exponential ADSR envelope.</phrase>
70 </textobject>
71
72 <caption>
73 <para>Picture of an exponential ADSR envelope.</para>
74 </caption>
75 </mediaobject>
76 </para>
77
78 <para>
79 The length of the sustain is calculated from the length of the note. This means <emphasis>adsr</emphasis> is not suitable for use with MIDI events. The opcode <link linkend="madsr"><citetitle>madsr</citetitle></link> uses the <link linkend="linsegr"><citetitle>linsegr</citetitle></link> mechanism, and so can be used in MIDI applications. The opcode <emphasis>mxadsr</emphasis> is identical to <link linkend="madsr"><citetitle>madsr</citetitle></link> except it uses exponential, rather than linear, line segments.
80 </para>
81 <para>
82 You can use other pre-made envelopes which start a release
83 segment upon receiving a note off message, like <link
84 linkend="linsegr"><citetitle>linsegr</citetitle></link> and
85 <link linkend="expsegr"><citetitle>expsegr</citetitle></link>,
86 or you can construct more complex envelopes using <link
87 linkend="xtratim"><citetitle>xtratim</citetitle></link> and
88 <link
89 linkend="release"><citetitle>release</citetitle></link>. Note
90 that you do not need to use <link linkend="xtratim"><citetitle>xtratim</citetitle></link> if you are using <emphasis>mxadsr</emphasis>, since the time is extended automatically.
91 </para>
92 <para>
93 <emphasis>mxadsr</emphasis> is new in Csound version 3.51.
94 </para>
95 </refsect1>
96
97 <refsect1>
98 <title>Examples</title>
99 <para>
100 Here is an example of the mxadsr opcode. It uses the file <ulink url="examples/mxadsr.csd"><citetitle>mxadsr.csd</citetitle></ulink>.
101 <example>
102 <title>Example of the mxadsr opcode.</title>
103 <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>
104 <xi:include href="examples-xml/mxadsr.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
105 </example>
106 </para>
107 <para>
108 Here is an example for the adsr-group, comparing the different adsr opcodes. It uses the file <ulink url="examples/adsr-group.csd"><citetitle>adsr-group.csd</citetitle></ulink>.
109 <example>
110 <title>Example of the adsr group.</title>
111 <xi:include href="examples-xml/adsr-group.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
112 </example>
113 </para>
114 </refsect1>
115
116 <refsect1>
117 <title>See Also</title>
118 <para>
119 <link linkend="SiggenEnvelope"><citetitle>Envelope Generators</citetitle></link>
120 </para>
121 </refsect1>
122
123 <refsect1>
124 <title>Credits</title>
125 <para>Author: &namejohn;</para>
126 <para>November 2002. Thanks to &namerasmus;, added documentation for the <emphasis>ireltim</emphasis> parameter.</para>
127 <para>November 2003. Thanks to &namekanata;, fixed the link to the <emphasis>linsegr</emphasis> opcode.</para>
128
129 </refsect1>
130 </refentry>