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