Sophie

Sophie

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

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>trigseq</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="trigger.html" title="trigger" />
    <link rel="next" href="trirand.html" title="trirand" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">trigseq</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="trigger.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="trirand.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="trigseq">
      <a id="trigseq"></a>
      <div class="titlepage"></div>
      <a id="IndexTrigseq" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">trigseq</span>
        </h2>
        <p>trigseq — 
      Accepts a trigger signal as input and outputs a group of values.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp49444488"></a>
        <h2>Description</h2>
        <p>
      Accepts a trigger signal as input and outputs a group of values.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp49445168"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>trigseq</strong></span> ktrig_in, kstart, kloop, kinitndx, kfn_values, kout1 [, kout2] [...]</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp49455576"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ktrig_in</em></span> -- input trigger signal
    </p>
        <p>
      <span class="emphasis"><em>kstart</em></span> -- start index of looped section
    </p>
        <p>
      <span class="emphasis"><em>kloop</em></span> -- end index of looped section
    </p>
        <p>
      <span class="emphasis"><em>kinitndx</em></span> -- initial index
    </p>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Although <span class="emphasis"><em>kinitndx</em></span> is listed as k-rate, it is in fact accessed only at init-time. So if you are using a k-rate argument, it must be assigned with <a class="link" href="init.html" title="init"><em class="citetitle">init</em></a>.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      <span class="emphasis"><em>kfn_values</em></span> -- number of a table containing a sequence of groups of values
    </p>
        <p>
      <span class="emphasis"><em>kout1</em></span> -- output values
    </p>
        <p>
      <span class="emphasis"><em>kout2, ...</em></span> (optional) -- more output values
    </p>
        <p>
      This opcode handles timed-sequences of groups of values stored into a table.
    </p>
        <p>
      <span class="emphasis"><em>trigseq</em></span> accepts a trigger signal (<span class="emphasis"><em>ktrig_in</em></span>) as input and outputs group of values (contained in the <span class="emphasis"><em>kfn_values</em></span> table) each time <span class="emphasis"><em>ktrig_in</em></span> assumes a non-zero value. Each time a group of values is triggered, table pointer is advanced of a number of positions corresponding to the number of group-elements, in order to point to the next group of values. The number of elements of groups is determined by the number of <span class="emphasis"><em>koutX</em></span> arguments. 
    </p>
        <p>
      It is possible to start the sequence from a value different than the first, by assigning to <span class="emphasis"><em>kinitndx</em></span> an index different than zero (which corresponds to the first value of the table). Normally the sequence is looped, and the start and end of loop can be adjusted by modifying <span class="emphasis"><em>kstart</em></span> and <span class="emphasis"><em>kloop</em></span> arguments. User must be sure that values of these arguments (as well as <span class="emphasis"><em>kinitndx</em></span>) correspond to valid table numbers, otherwise Csound will crash because no range-checking is implemented. 
    </p>
        <p>
      It is possible to disable loop (one-shot mode) by assigning the same value both to <span class="emphasis"><em>kstart</em></span> and <span class="emphasis"><em>kloop</em></span> arguments. In this case, the last read element will be the one corresponding to the value of such arguments. Table can be read backward by assigning a negative <span class="emphasis"><em>kloop</em></span> value.
    </p>
        <p>
      <span class="emphasis"><em>trigseq</em></span> is designed to be used together with <a class="link" href="seqtime.html" title="seqtime"><em class="citetitle">seqtime</em></a> or <a class="link" href="trigger.html" title="trigger"><em class="citetitle">trigger</em></a> opcodes.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp49549296"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the trigseq opcode. It uses the file <a class="ulink" href="examples/trigseq.csd" target="_top"><em class="citetitle">trigseq.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp49550272"></a>
          <p class="title">
            <strong>Example 899. Example of the trigseq 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 RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o trigseq.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

giTimes	<span class="ohdr">ftgen</span>	91, 0, 128, <span class="op">-</span>2,     1, 1<span class="op">/</span>2, 1<span class="op">/</span>2, 1<span class="op">/</span>8, 1<span class="op">/</span>8, 1<span class="op">/</span>2,1<span class="op">/</span>2, 1<span class="op">/</span>16, 1<span class="op">/</span>16, 1<span class="op">/</span>16, 1<span class="op">/</span>16, 1<span class="op">/</span>16, 1<span class="op">/</span>16, 1<span class="op">/</span>16, 1<span class="op">/</span>16<span class="comment">; times</span>
giSeq	<span class="ohdr">ftgen</span> 	90, 0, 128, <span class="op">-</span>2,     1, 2,     .5, 3,    .25, 4,      .10, 5,       .05, 6, <span class="comment">;** sequence amplitude and freq-ratio bins</span>
 
	
<span class="oblock">instr</span>	1

icps	<span class="opc">init</span>	p4
iamp	<span class="opc">init</span>	.3

kloop	<span class="opc">init</span>	p5
initndx	<span class="opc">init</span>	p6
kloop2	<span class="opc">init</span>	p7
initndx2 <span class="opc">init</span>	p8
kdur	<span class="opc">init</span>	p9
iminTime <span class="opc">init</span>	p10
imaxTime <span class="opc">init</span>	p11
kampratio <span class="opc">init</span>  1
kfreqratio <span class="opc">init</span> 1

ktime_unit <span class="opc">expseg</span> iminTime,p3<span class="op">/</span>8,iminTime,p3<span class="op">*</span> 3<span class="op">/</span>4,imaxTime,p3<span class="op">/</span>8,imaxTime


<span class="comment">;**ktrig	seqtime	ktime_unit, kstart, kloop, initndx, kfn_times </span>
<span class="comment">;ktrig	seqtime	1/ktime_unit, 0,      15, 0,      giTimes	</span>

ktrig	<span class="opc">metro</span>	ktime_unit

<span class="comment">;****	trigseq	ktrig_in,  kstart,  kloop, initndx,  kfn_values, kout1 [, kout2, kout3, ....,  koutN] </span>
	<span class="opc">trigseq</span>	ktrig, 	0, 	kloop2,initndx2,   giSeq,      kampratio, kfreqratio
	
<span class="comment">;atrig	= ktrig*10000</span>
	<span class="opc">schedkwhen</span> ktrig, <span class="op">-</span>1, <span class="op">-</span>1, 3, 0, kdur, kampratio<span class="op">*</span>iamp, kfreqratio<span class="op">*</span>icps
<span class="comment">;	schedkwhen ktrig, -1, -1, 2, 0, ktrig, kampratio*iamp, kfreqratio*icps</span>
	<span class="oblock">endin</span>

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

icps	<span class="opc">init</span>	p4
iamp	<span class="opc">init</span>	20000

kloop	<span class="opc">init</span>	p5
initndx	<span class="opc">init</span>	p6
kloop2	<span class="opc">init</span>	p7
initndx2 <span class="opc">init</span>	p8
kdur	<span class="opc">init</span>	p9
iminTime <span class="opc">init</span>	p10
imaxTime <span class="opc">init</span>	p11
kampratio <span class="opc">init</span>  1
kfreqratio <span class="opc">init</span> 1

ktime_unit <span class="opc">expseg</span> iminTime,p3<span class="op">/</span>8,iminTime,p3<span class="op">*</span> 3<span class="op">/</span>4,imaxTime,p3<span class="op">/</span>8,imaxTime


<span class="comment">;**ktrig	seqtime	ktime_unit, kstart, kloop, initndx, kfn_times </span>
ktrig	<span class="opc">seqtime</span>	1<span class="op">/</span>ktime_unit, 0,      15, 0,      giTimes	

<span class="comment">;ktrig	metro	ktime_unit</span>

<span class="comment">;****	trigseq	ktrig_in,  kstart,  kloop, initndx,  kfn_values, kout1 [, kout2, kout3, ....,  koutN] </span>
	<span class="opc">trigseq</span>	ktrig,      0, 	   kloop2, initndx2,   giSeq,    kampratio, kfreqratio
<span class="opc">printk2</span> ktrig
<span class="comment">;atrig	= ktrig*10000</span>
<span class="comment">;	schedkwhen ktrig, -1, -1, 2, 0, kdur, kampratio*iamp, kfreqratio*icps</span>
	<span class="opc">schedkwhen</span> ktrig, <span class="op">-</span>1, <span class="op">-</span>1, 3, 0, ktrig, kampratio<span class="op">*</span>iamp, kfreqratio<span class="op">*</span>icps
<span class="oblock">endin</span>

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

<span class="opc">print</span> p3
kenv	<span class="opc">expseg</span>	 1.04, p3,.04
a1	<span class="opc">foscili</span>	p4<span class="op">*</span><span class="opc">a</span>(kenv<span class="op">-</span>0.04), p5,1,1,kenv<span class="op">*</span>5, 2
	<span class="opc">outs</span>	a1, a1
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>2 0 8192 10 1

<span class="comment">;	icps	unused	unused	kloop2	initndx2 kdur iminTime	imaxTime</span>

<span class="stamnt">s</span>

<span class="stamnt">i</span>1 0  6	100	0	0	5	0	.2	3	15
<span class="stamnt">i</span>1 8  6	150	0	0	4	1	.1	4	30
<span class="stamnt">i</span>1 16 6	200	0	0	5	3	.25	8	50  
<span class="stamnt">i</span>1 24 6	300	0	0	3	0	.1	1	30  

<span class="stamnt">i</span>2 32 6	100	0	0	5	0	.2	1	1
<span class="stamnt">i</span>2 40 6 150	0	0	4	1	.1	.5	.5
<span class="stamnt">i</span>2 48 6	200	0	0	5	3	.25	3	.5  
<span class="stamnt">i</span>2 56 6	300	0	0	5	0	.1	1	8  

<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="idp49552552"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="seqtime.html" title="seqtime"><em class="citetitle">seqtime</em></a>,
      <a class="link" href="trigger.html" title="trigger"><em class="citetitle">trigger</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp49554048"></a>
        <h2>Credits</h2>
        <p>Author: Gabriel Maldonado</p>
        <p>November 2002. Added a note about the <span class="emphasis"><em>kinitndx</em></span> parameter, thanks to Rasmus Ekman.</p>
        <p>January 2003. Thanks to a note from Øyvind Brandtsegg, I corrected the credits.</p>
        <p>New in version 4.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="trigger.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="trirand.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">trigger </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> trirand</td>
        </tr>
      </table>
    </div>
  </body>
</html>