| 1 | |
| 2 | <refentry id="loopxseg"> |
| 3 | <indexterm id="IndexLoopxseg"><primary>loopxseg</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Linear and Exponential Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>loopxseg</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>loopxseg</refname> |
| 11 | <refpurpose> |
| 12 | Generate control signal consisting of exponential segments delimited by two or more specified points. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Generate control signal consisting of exponential segments delimited by two or more specified points. The entire envelope is looped at <emphasis>kfreq</emphasis> rate. Each parameter can be varied at k-rate. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ksig <command>loopxseg</command> kfreq, ktrig, iphase, kvalue0, ktime0 [, kvalue1] [, ktime1] \ |
| 26 | [, kvalue2] [, ktime2] [...]</synopsis> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Performance</title> |
| 31 | <para> |
| 32 | <emphasis>ksig</emphasis> -- Output signal. |
| 33 | </para> |
| 34 | |
| 35 | <para> |
| 36 | <emphasis>kfreq</emphasis> -- Repeat rate in Hz or fraction of Hz. |
| 37 | </para> |
| 38 | |
| 39 | <para> |
| 40 | <emphasis>ktrig</emphasis> -- If non-zero, retriggers the envelope from start (see <link linkend="trigger"><citetitle>trigger opcode</citetitle></link>), before the envelope cycle is completed. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | <emphasis>iphase</emphasis> -- A value between 0 and 1 to say |
| 45 | where to start the loop. Zero, the commonest value, indicates |
| 46 | the beginning. |
| 47 | </para> |
| 48 | |
| 49 | <para> |
| 50 | <emphasis>ktime0...ktimeN</emphasis> -- Times of points; expressed in fraction of a cycle. |
| 51 | </para> |
| 52 | |
| 53 | <para> |
| 54 | <emphasis>kvalue0...kvalueN</emphasis> -- Values of points |
| 55 | </para> |
| 56 | |
| 57 | <para> |
| 58 | <emphasis>loopxseg</emphasis> opcode is similar to <link linkend="expseg"><citetitle>expseg</citetitle></link>, but the entire envelope is looped at <emphasis>kfreq</emphasis> rate. Notice that times are not expressed in seconds but in fraction of a cycle. Actually each duration represent is proportional to the other, and the entire cycle duration is proportional to the sum of all duration values. |
| 59 | </para> |
| 60 | |
| 61 | <para> |
| 62 | The sum of all duration is then rescaled according to <emphasis>kfreq</emphasis> argument. For example, considering an envelope made up of 3 segments, each segment having 100 as duration value, their sum will be 300. This value represents the total duration of the envelope, and is actually divided into 3 equal parts, a part for each segment. |
| 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | Actually, the real envelope duration in seconds is determined by <emphasis>kfreq</emphasis>. Again, if the envelope is made up of 3 segments, but this time the first and last segments have a duration of 50, whereas the central segment has a duration of 100 again, their sum will be 200. This time 200 represent the total duration of the 3 segments, so the central segment will be twice as long as the other segments. |
| 67 | </para> |
| 68 | |
| 69 | <para> |
| 70 | All parameters can be varied at k-rate. Negative frequency values are allowed, reading the envelope backward. <emphasis>ktime0</emphasis> should always be set to 0, except if the user wants some special effect. |
| 71 | </para> |
| 72 | </refsect1> |
| 73 | |
| 74 | <refsect1> |
| 75 | <title>Examples</title> |
| 76 | <para> |
| 77 | Here is an example of the loopxseg opcode. It uses the file <ulink url="examples/loopxseg.csd"><citetitle>loopxseg.csd</citetitle></ulink>. |
| 78 | |
| 79 | <example> |
| 80 | <title>Example of the loopxseg opcode.</title> |
| 81 | <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> |
| 82 | <xi:include href="examples-xml/loopxseg.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 83 | </example> |
| 84 | </para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>See also</title> |
| 89 | <para><link linkend="SiggenLineexp"><citetitle>Linear and Exponential Generators</citetitle></link></para> |
| 90 | </refsect1> |
| 91 | |
| 92 | <refsect1> |
| 93 | <title>Credits</title> |
| 94 | <para>Author: &namejohn;</para> |
| 95 | <para>New in Version 5.12</para> |
| 96 | </refsect1> |
| 97 | </refentry> |