Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 2126

csound-doc-5.19.01-10.mga5.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>loopseg</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="loop_lt.html" title="loop_lt" />
    <link rel="next" href="loopsegp.html" title="loopsegp" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">loopseg</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="loop_lt.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="loopsegp.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="loopseg">
      <a id="loopseg"></a>
      <div class="titlepage"></div>
      <a id="IndexLoopseg" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">loopseg</span>
        </h2>
        <p>loopseg — 
      Generate control signal consisting of linear segments delimited by two or more specified points.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp28982696"></a>
        <h2>Description</h2>
        <p>
      Generate control signal consisting of linear segments delimited by two or more specified points. The entire envelope is looped at <span class="emphasis"><em>kfreq</em></span> rate. Each parameter can be varied at k-rate.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp29035504"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ksig <span class="command"><strong>loopseg</strong></span> kfreq, ktrig, iphase, ktime0, kvalue0 [, ktime1] [, kvalue1] \
      [, ktime2] [, kvalue2] [...]</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp29036664"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ksig</em></span> -- Output signal.
    </p>
        <p>
      <span class="emphasis"><em>kfreq</em></span> -- Repeat rate in Hz or fraction of Hz.
    </p>
        <p>
      <span class="emphasis"><em>ktrig</em></span> -- If non-zero, retriggers the envelope from start (see <a class="link" href="trigger.html" title="trigger"><em class="citetitle">trigger opcode</em></a>), before the envelope cycle is completed.
    </p>
        <p>
      <span class="emphasis"><em>iphase</em></span> -- A value between 0 and 1 to say
      where to start the loop.  Zero, the commonest value, indicates
      the beginning.
    </p>
        <p>
      <span class="emphasis"><em>ktime0...ktimeN</em></span> -- Times of points; expressed in fraction of a cycle.
    </p>
        <p>
      <span class="emphasis"><em>kvalue0...kvalueN</em></span> -- Values of points
    </p>
        <p>
      <span class="emphasis"><em>loopseg</em></span> opcode is similar to <a class="link" href="linseg.html" title="linseg"><em class="citetitle">linseg</em></a>, but the entire envelope is looped at <span class="emphasis"><em>kfreq</em></span> 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.  
    </p>
        <p>
      The sum of all duration is then rescaled according to <span class="emphasis"><em>kfreq</em></span> 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.
    </p>
        <p>
      Actually, the real envelope duration in seconds is determined by <span class="emphasis"><em>kfreq</em></span>. 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.
    </p>
        <p>
      All parameters can be varied at k-rate.  Negative frequency values are allowed, reading the envelope backward.  <span class="emphasis"><em>ktime0</em></span> should always be set to 0, except if the user wants some special effect.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp29043968"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the loopseg opcode. It uses the file <a class="ulink" href="examples/loopseg.csd" target="_top"><em class="citetitle">loopseg.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp29044944"></a>
          <p class="title">
            <strong>Example 405. Example of the loopseg opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac      <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o loopseg.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1

kfreq <span class="opc">line</span> 1, p3, 5	<span class="comment">; speed up</span>
kval  <span class="op">=</span> p4		<span class="comment">; value of second segment</span>
klp   <span class="opc">loopseg</span> kfreq, 0, 0, 0, 0, kval, 1, 1, 0
asig  <span class="opc">poscil3</span> klp, 440, 1
      <span class="opc">outs</span> asig, asig

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">; sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="stamnt">i</span> 1 0 5 .05
<span class="stamnt">i</span> 1 6 5 .5
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp29047224"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="lpshold.html" title="lpshold"><em class="citetitle">lpshold</em></a>
      <a class="link" href="loopxseg.html" title="loopxseg"><em class="citetitle">loopxseg</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp29048704"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>New in Version 4.13</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="loop_lt.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="loopsegp.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">loop_lt </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> loopsegp</td>
        </tr>
      </table>
    </div>
  </body>
</html>