| 1 | |
| 2 | <refentry id="linsegr"> |
| 3 | <indexterm id="IndexLinsegr"><primary>linsegr</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Linear and Exponential Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>linsegr</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>linsegr</refname> |
| 13 | <refpurpose> |
| 14 | Trace a series of line segments between specified points including a release segment. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Trace a series of line segments between specified points including a release segment. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ares <command>linsegr</command> ia, idur1, ib [, idur2] [, ic] [...], irel, iz</synopsis> |
| 28 | |
| 29 | <synopsis>kres <command>linsegr</command> ia, idur1, ib [, idur2] [, ic] [...], irel, iz</synopsis> |
| 30 | </refsect1> |
| 31 | |
| 32 | <refsect1> |
| 33 | <title>Initialization</title> |
| 34 | <para> |
| 35 | <emphasis>ia</emphasis> -- starting value. |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>ib, ic</emphasis>, etc. -- value after <emphasis>dur1</emphasis> seconds, etc. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | <emphasis>idur1</emphasis> -- duration in seconds of first segment. A zero or negative value will cause all initialization to be skipped. |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>idur2, idur3</emphasis>, etc. -- duration in seconds of subsequent segments. A zero or negative value will terminate the initialization process with the preceding point, permitting the last-defined line or curve to be continued indefinitely in performance. The default is zero. |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | <emphasis>irel, iz</emphasis> -- duration in seconds and final value of a note releasing segment. |
| 52 | </para> |
| 53 | |
| 54 | <para> |
| 55 | For Csound versions prior to 5.00, the release time cannot be longer than 32767/<link linkend="kr"><citetitle>kr</citetitle></link> seconds. This limit has been extended to (2<superscript>31</superscript>-1)/kr. |
| 56 | </para> |
| 57 | </refsect1> |
| 58 | |
| 59 | <refsect1> |
| 60 | <title>Performance</title> |
| 61 | <para> |
| 62 | These units generate control or audio signals whose values can pass through 2 or more specified points. The sum of <emphasis>dur</emphasis> values may or may not equal the instrument's performance time: a shorter performance will truncate the specified pattern, while a longer one will cause the last-defined segment to continue on in the same direction. |
| 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | <emphasis>linsegr</emphasis> is amongst the Csound <quote>r</quote> units that contain a note-off sensor and release time extender. When each senses an event termination or MIDI noteoff, it immediately extends the performance time of the current instrument by <emphasis>irel </emphasis>seconds, and sets out to reach the value <emphasis>iz</emphasis> by the end of that period (no matter which segment the unit is in). <quote>r</quote> units can also be modified by MIDI noteoff velocities. For two or more extenders in an instrument, extension is by the greatest period. |
| 67 | </para> |
| 68 | <para> |
| 69 | You can use other pre-made envelopes which start a release |
| 70 | segment upon receiving a note off message, like <link |
| 71 | linkend="linenr"><citetitle>linenr</citetitle></link> and <link |
| 72 | linkend="expsegr"><citetitle>expsegr</citetitle></link>, or you |
| 73 | can construct more complex envelopes using <link |
| 74 | linkend="xtratim"><citetitle>xtratim</citetitle></link> and |
| 75 | <link |
| 76 | linkend="release"><citetitle>release</citetitle></link>. Note |
| 77 | that you do not need to use <link linkend="xtratim"><citetitle>xtratim</citetitle></link> if you are using <emphasis>linsegr</emphasis>, since the time is extended automatically. |
| 78 | </para> |
| 79 | </refsect1> |
| 80 | |
| 81 | <refsect1> |
| 82 | <title>Examples</title> |
| 83 | <para> |
| 84 | Here is an example of the linsegr opcode. It uses the file <ulink url="examples/linsegr.csd"><citetitle>linsegr.csd</citetitle></ulink>. |
| 85 | |
| 86 | <example> |
| 87 | <title>Example of the linsegr 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/linsegr.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 90 | </example> |
| 91 | </para> |
| 92 | </refsect1> |
| 93 | |
| 94 | <refsect1> |
| 95 | <title>See also</title> |
| 96 | <para><link linkend="SiggenLineexp"><citetitle>Linear and Exponential Generators</citetitle></link></para> |
| 97 | </refsect1> |
| 98 | |
| 99 | <refsect1> |
| 100 | <title>Credits</title> |
| 101 | <para>Author: &namebarry;</para> |
| 102 | <para>December 2002, December 2006. Thanks to &nameistvan;, added documentation about the maximum release time.</para> |
| 103 | <para>New in Csound 3.47</para> |
| 104 | </refsect1> |
| 105 | </refentry> |