| 1 | |
| 2 | <refentry id="envlpxr"> |
| 3 | <indexterm id="IndexEnvlpxr"><primary>envlpxr</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Envelope Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>envlpxr</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>envlpxr</refname> |
| 11 | <refpurpose> |
| 12 | The <emphasis>envlpx</emphasis> opcode with a final release segment. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | <emphasis>envlpxr</emphasis> is the same as <link linkend="envlpx"><citetitle>envlpx</citetitle></link> except that the final segment is entered only on sensing a MIDI note release. The note is then extended by the decay time. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ares <command>envlpxr</command> xamp, irise, idec, ifn, iatss, iatdec [, ixmod] [,irind]</synopsis> |
| 26 | |
| 27 | <synopsis>kres <command>envlpxr</command> kamp, irise, idec, ifn, iatss, iatdec [, ixmod] [,irind]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>irise</emphasis> -- rise time in seconds. A zero or negative value signifies no rise modification. |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>idec</emphasis> -- decay time in seconds. Zero means no decay. |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>ifn</emphasis> -- function table number of stored rise shape with extended guard point. |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>iatss</emphasis> -- attenuation factor determining the |
| 46 | exponential change in value over time during the pseudo steady state |
| 47 | period between the end of the rise and the beginning of the decay |
| 48 | (at the note's release). A factor greater than 1 causes an exponential |
| 49 | growth and a factor less than 1 creates an exponential decay. A factor |
| 50 | of 1 will maintain a true steady state at the last rise value; 0 is illegal. |
| 51 | The value will change by |
| 52 | <emphasis>abs</emphasis>(<emphasis>iatss</emphasis>) per second. |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | <emphasis>iatdec</emphasis> -- the ratio of the value |
| 57 | at the end of the decay period to the value at its beginning (when |
| 58 | the note is released). It must be positive and is normally of the |
| 59 | order of .01. A large or excessively small value is apt to produce |
| 60 | a cutoff which is audible. A zero or negative value is illegal. |
| 61 | </para> |
| 62 | |
| 63 | <para> |
| 64 | <emphasis>ixmod</emphasis> (optional, between +- .9 or so) -- exponential curve modifier, influencing the steepness of the exponential trajectory during the steady state. Values less than zero will cause an accelerated growth or decay towards the target (e.g. <emphasis>subito piano</emphasis>). Values greater than zero will cause a retarded growth or decay. The default value is zero (unmodified exponential). |
| 65 | </para> |
| 66 | |
| 67 | <para> |
| 68 | <emphasis>irind </emphasis> (optional) -- independence flag. If left zero, the release time (<emphasis>idec</emphasis>) will influence the extended life of the current note following a note-off. If non-zero, the <emphasis>idec</emphasis> time is quite independent of the note extension (see below). The default value is 0. |
| 69 | </para> |
| 70 | </refsect1> |
| 71 | |
| 72 | <refsect1> |
| 73 | <title>Performance</title> |
| 74 | <para> |
| 75 | <emphasis>kamp, xamp</emphasis> -- input amplitude signal. |
| 76 | </para> |
| 77 | |
| 78 | <para> |
| 79 | <emphasis>envlpxr</emphasis> is an example of the special Csound <quote>r</quote> units that contain a note-off sensor and release time extender. When each senses a score event termination or a MIDI noteoff, it will immediately extend the performance time of the current instrument by <emphasis>idec</emphasis> seconds unless it is made independent by <emphasis>irind</emphasis>. Then it will begin a decay from wherever it was at the time. |
| 80 | </para> |
| 81 | |
| 82 | <para> |
| 83 | You can use other pre-made envelopes which start a release |
| 84 | segment upon receiving a note off message, like <link |
| 85 | linkend="linsegr"><citetitle>linsegr</citetitle></link> and |
| 86 | <link linkend="expsegr"><citetitle>expsegr</citetitle></link>, |
| 87 | or you can construct more complex envelopes using <link |
| 88 | linkend="xtratim"><citetitle>xtratim</citetitle></link> and |
| 89 | <link |
| 90 | linkend="release"><citetitle>release</citetitle></link>. Note |
| 91 | that you do not need to use <link linkend="xtratim"><citetitle>xtratim</citetitle></link> if you are using <emphasis>envlpxr</emphasis>, since the time is extended automatically. |
| 92 | </para> |
| 93 | |
| 94 | <formalpara> |
| 95 | <title>Multiple <quote>r</quote> units</title> |
| 96 | <para> |
| 97 | When two or more <quote>r</quote> units occur in the same instrument it is usual to have only one of them influence the overall note duration. This is normally the master amplitude unit. Other units controlling, say, filter motion can still be sensitive to note-off commands while not affecting the duration by making them independent (<emphasis>irind</emphasis> non-zero). Depending on their own <emphasis>idec</emphasis> (release time) values, independent <quote>r</quote> units may or may not reach their final destinations before the instrument terminates. If they do, they will simply hold their target values until termination. If two or more <quote>r</quote> units are simultaneously master, note extension is by the greatest <emphasis>idec</emphasis>. |
| 98 | </para> |
| 99 | </formalpara> |
| 100 | </refsect1> |
| 101 | |
| 102 | <refsect1> |
| 103 | <title>Examples</title> |
| 104 | <para> |
| 105 | Here is an example of the envlpxr opcode. It uses the file <ulink url="examples/envlpxr.csd"><citetitle>envlpxr.csd</citetitle></ulink>. |
| 106 | |
| 107 | <example> |
| 108 | <title>Example of the envlpxr opcode.</title> |
| 109 | <xi:include href="examples-xml/envlpxr.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 110 | </example> |
| 111 | </para> |
| 112 | </refsect1> |
| 113 | |
| 114 | <refsect1> |
| 115 | <title>See Also</title> |
| 116 | <para> |
| 117 | <link linkend="SiggenEnvelope"><citetitle>Envelope Generators</citetitle></link> |
| 118 | </para> |
| 119 | </refsect1> |
| 120 | |
| 121 | <refsect1> |
| 122 | <title>Credits</title> |
| 123 | <para>Thanks goes to &nameluis; for pointing out a mistake with <emphasis>iatss</emphasis>.</para> |
| 124 | </refsect1> |
| 125 | </refentry> |