-
Notifications
You must be signed in to change notification settings - Fork 29
/
adsr.xml
128 lines (105 loc) · 4.19 KB
/
adsr.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<refentry id="adsr">
<indexterm id="IndexAdsr"><primary>adsr</primary></indexterm>
<refentryinfo><title>Signal Generators:Envelope Generators</title></refentryinfo>
<refmeta>
<refentrytitle>adsr</refentrytitle>
</refmeta>
<refnamediv>
<refname>adsr</refname>
<refpurpose>
Calculates the classical ADSR envelope using linear segments.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
Calculates the classical ADSR envelope using linear segments.
</para>
</refsect1>
<refsect1>
<title>Syntax</title>
<synopsis>ares <command>adsr</command> iatt, idec, islev, irel [, idel]</synopsis>
<synopsis>kres <command>adsr</command> iatt, idec, islev, irel [, idel]</synopsis>
</refsect1>
<refsect1>
<title>Initialization</title>
<para>
<emphasis>iatt</emphasis> -- duration of attack phase
</para>
<para>
<emphasis>idec</emphasis> -- duration of decay
</para>
<para>
<emphasis>islev</emphasis> -- level for sustain phase
</para>
<para>
<emphasis>irel</emphasis> -- duration of release phase
</para>
<para>
<emphasis>idel</emphasis> -- period of zero before the envelope starts
</para>
</refsect1>
<refsect1>
<title>Performance</title>
<para>
The envelope generated is the range 0 to 1 and may need to be scaled
further, depending on the amplitude required. If using
<link linkend="Zerodbfs"><citetitle>0dbfs</citetitle></link> = 1, scaling down
will probably be required since playing more than one note might result in clipping.
If not using <link linkend="Zerodbfs"><citetitle>0dbfs</citetitle></link>, scaling
to a large amplitude (e.g. 32000) might be required.
</para>
<para>
The envelope may be described as:
<mediaobject>
<imageobject>
<imagedata fileref="images/adsr.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>Picture of an ADSR envelope.</phrase>
</textobject>
<caption>
<para>Picture of an ADSR envelope.</para>
</caption>
</mediaobject>
</para>
<para>
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.
</para>
<para>
<emphasis>adsr</emphasis> is new in Csound version 3.49.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Here is an example of the adsr opcode. It uses the file <ulink url="examples/adsr.csd"><citetitle>adsr.csd</citetitle></ulink>.
<example>
<title>Example of the adsr opcode.</title>
<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>
<xi:include href="examples-xml/adsr.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
</para>
<para>
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>.
<example>
<title>Example of the adsr group.</title>
<xi:include href="examples-xml/adsr-group.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="madsr"><citetitle>madsr</citetitle></link>,
<link linkend="mxadsr"><citetitle>mxadsr</citetitle></link>,
<link linkend="xadsr"><citetitle>xadsr</citetitle></link>
</para>
</refsect1>
<refsect1>
<title>Credits</title>
<para>Author: &namejohn;</para>
<para>New in version 3.49</para>
</refsect1>
</refentry>