Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 5fcfcb7517038d1f44ab4e478e6e61fa > files > 2389

csound-doc-6.10.0-1.mga7.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>loopxseg</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" />
    <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" />
    <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="looptseg.html" title="looptseg" />
    <link rel="next" href="lorenz.html" title="lorenz" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">loopxseg</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="looptseg.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="lorenz.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="loopxseg"></a>
      <div class="titlepage"></div>
      <a id="IndexLoopxseg" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">loopxseg</span>
        </h2>
        <p>loopxseg — 
      Generate control signal consisting of exponential segments delimited by two or more specified points.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472918747960"></a>
        <h2>Description</h2>
        <p>
      Generate control signal consisting of exponential 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">
        <a id="idm281472918673224"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ksig <span class="command"><strong>loopxseg</strong></span> kfreq, ktrig, iphase, ktime0, kvalue0 [, ktime1] [, kvalue1] \
      [, ktime2] [, kvalue2] [...]</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472918670968"></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>loopxseg</em></span> opcode is similar to <a class="link" href="expseg.html" title="expseg"><em class="citetitle">expseg</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">
        <a id="idm281472918658184"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the loopxseg opcode. It uses the file <a class="ulink" href="examples/loopxseg.csd" target="_top"><em class="citetitle">loopxseg.csd</em></a>.

      </p>
        <div class="example">
          <a id="idm281472918656328"></a>
          <p class="title">
            <strong>Example 486. Example of the loopxseg 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>
            <div class="refsect1">
              <a id="idm281472745179816"></a>
              <pre class="programlisting">
<span class="nt">&lt;CsoundSynthesizer&gt;</span>
<span class="nt">&lt;CsOptions&gt;</span>
<span class="c1">; Select audio/midi flags here according to platform</span>
-odac      <span class="c1">;;;realtime audio out</span>
<span class="c1">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="c1">; For Non-realtime ouput leave only the line below:</span>
<span class="c1">; -o loopxseg.wav -W ;;; for file output any platform</span>
<span class="nt">&lt;/CsOptions&gt;</span>
<span class="nt">&lt;CsInstruments&gt;</span>

<span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span>
<span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span>
<span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span>
<span class="vg">0dbfs</span>  <span class="o">=</span> <span class="mi">1</span>

<span class="kd">instr</span> <span class="nf">1</span>
k<span class="n">freq</span>  <span class="nb">rspline</span>  <span class="mf">0.01</span><span class="p">,</span><span class="mi">20</span><span class="p">,</span><span class="mf">0.2</span><span class="p">,</span><span class="mi">1</span>   <span class="c1">; freq. of loop repetition created by random spline</span>
k<span class="n">trig</span>  <span class="nb">init</span>     <span class="mi">0</span>   <span class="c1">; loop restart trigger (not used)</span>
i<span class="n">phase</span> <span class="o">=</span>        <span class="mi">0</span>   <span class="c1">; initial phase</span>
<span class="c1">; loop of filter cutoff values (oct format). Rescaled further down.</span>
k<span class="n">cfoct</span> <span class="nb">loopxseg</span>  k<span class="n">freq</span><span class="p">,</span> k<span class="n">trig</span><span class="p">,</span> i<span class="n">phase</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span>
k<span class="n">env</span>  <span class="nb">linseg</span>   <span class="mi">0</span><span class="p">,</span><span class="mf">0.01</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="nb">p3</span><span class="o">-</span><span class="mf">5.01</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">0</span>
a<span class="n">sig</span>  <span class="nb">vco2</span>     <span class="mf">0.2</span><span class="o">*</span>k<span class="n">env</span><span class="p">,</span><span class="nb">cpsmidinn</span><span class="p">(</span><span class="mi">48</span><span class="p">),</span><span class="mi">0</span>
k<span class="n">dep</span>  <span class="nb">rspline</span>  <span class="mi">5</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mf">0.2</span><span class="p">,</span><span class="mi">1</span>  <span class="c1">; filter depth created by a random spline</span>
k<span class="n">cf</span>   <span class="nb">port</span>     <span class="nb">cpsoct</span><span class="p">((</span>k<span class="n">cfoct</span><span class="o">*</span>k<span class="n">dep</span><span class="p">)</span><span class="o">+</span><span class="mi">4</span><span class="p">),</span> <span class="mf">0.001</span>  <span class="c1">; smooth filter changes</span>
a<span class="n">sig</span>  <span class="nb">moogladder</span>  a<span class="n">sig</span><span class="p">,</span>k<span class="n">cf</span><span class="p">,</span><span class="nb">rnd</span><span class="p">(</span><span class="mf">0.6</span><span class="p">)</span>
a<span class="n">L</span><span class="p">,</span>a<span class="n">R</span> <span class="nb">pan2</span>     a<span class="n">sig</span><span class="p">,</span><span class="nb">rnd</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
      <span class="nb">outs</span>     a<span class="n">L</span><span class="p">,</span> a<span class="n">R</span>
<span class="kd">endin</span>

<span class="nt">&lt;/CsInstruments&gt;</span>
<span class="nt">&lt;CsScore&gt;</span>
<span class="nb">i</span> <span class="mi">1</span>  <span class="mi">0</span> <span class="mi">60</span>
<span class="nb">e</span>
<span class="nt">&lt;/CsScore&gt;</span>
<span class="nt">&lt;/CsoundSynthesizer&gt;</span>
</pre>
            </div>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472918652040"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="lpshold.html" title="lpshold"><em class="citetitle">lpshold</em></a>
      <a class="link" href="loopseg.html" title="loopseg"><em class="citetitle">loopseg</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472918649064"></a>
        <h2>Credits</h2>
        <p>Author: John ffitch</p>
        <p>New in Version 5.12</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="looptseg.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="lorenz.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">looptseg </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> lorenz</td>
        </tr>
      </table>
    </div>
  </body>
</html>