Sophie

Sophie

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

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>schedkwhen</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="scanu.html" title="scanu" />
    <link rel="next" href="schedkwhennamed.html" title="schedkwhennamed" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">schedkwhen</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="scanu.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="schedkwhennamed.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="schedkwhen"></a>
      <div class="titlepage"></div>
      <a id="IndexSchedkwhen" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">schedkwhen</span>
        </h2>
        <p>schedkwhen — 
      Adds a new score event generated by a k-rate trigger.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472893397768"></a>
        <h2>Description</h2>
        <p>
      Adds a new score event generated by a k-rate trigger.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472893354328"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>schedkwhen</strong></span> ktrigger, kmintim, kmaxnum, kinsnum, kwhen, kdur \
      [, ip4] [, ip5] [...]</pre>
        <pre class="synopsis"><span class="command"><strong>schedkwhen</strong></span> ktrigger, kmintim, kmaxnum, "insname", kwhen, kdur \
      [, ip4] [, ip5] [...]</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472893350904"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em><span class="quote">“<span class="quote">insname</span>”</span></em></span> -- A string (in double-quotes) representing a named instrument.
    </p>
        <p>
      <span class="emphasis"><em>ip4, ip5, ...</em></span> -- Equivalent to p4, p5, etc., in a score <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472893347336"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ktrigger</em></span> -- triggers a new score event. If <span class="emphasis"><em>ktrigger</em></span> = 0, no new event is triggered.
    </p>
        <p>
      <span class="emphasis"><em>kmintim</em></span> -- minimum time between generated events, in seconds. If <span class="emphasis"><em>kmintim</em></span> &lt;= 0, no time limit exists. If the <span class="emphasis"><em>kinsnum</em></span> is negative (to turn off an instrument), this test is bypassed.
    </p>
        <p>
      <span class="emphasis"><em>kmaxnum</em></span> -- maximum number of simultaneous instances of instrument <span class="emphasis"><em>kinsnum</em></span> allowed. If the number of existant instances of <span class="emphasis"><em>kinsnum</em></span> is &gt;= <span class="emphasis"><em>kmaxnum</em></span>, no new event is generated. If <span class="emphasis"><em>kmaxnum</em></span> is &lt;= 0, it is not used to limit event generation. If the <span class="emphasis"><em>kinsnum</em></span> is negative (to turn off an instrument), this test is bypassed.
    </p>
        <p>
      <span class="emphasis"><em>kinsnum</em></span> -- instrument number. Equivalent to p1 in a score <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a>.
    </p>
        <p>
      <span class="emphasis"><em>kwhen</em></span> -- start time of the new event. Equivalent to p2 in a score <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a>. Measured from the time of the triggering event. <span class="emphasis"><em>kwhen</em></span> must be &gt;= 0. If <span class="emphasis"><em>kwhen</em></span> &gt; 0, the instrument will not be initialized until the actual time when it should start performing.
    </p>
        <p>
      <span class="emphasis"><em>kdur</em></span> -- duration of event. Equivalent to p3 in a score <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a>. If <span class="emphasis"><em>kdur</em></span> = 0, the instrument will only do an initialization pass, with no performance. If <span class="emphasis"><em>kdur</em></span> is negative, a held note is initiated. (See <a class="link" href="ihold.html" title="ihold"><em class="citetitle">ihold</em></a> and <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a>.)
    </p>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="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>While waiting for events to be triggered by <span class="emphasis"><em>schedkwhen</em></span>, the performance must be kept going, or Csound may quit if no score events are expected. To guarantee continued performance, an <a class="link" href="f.html" title="f Statement (or Function Table Statement)"><em class="citetitle">f0 statement</em></a> may be used in the score.</p>
              </td>
            </tr>
          </table>
        </div>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="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> Note that the <span class="emphasis"><em>schedkwhen</em></span> opcode can't accept string p-fields. If you need to pass strings when instantiating an instrument, use the <a class="link" href="scoreline.html" title="scoreline"><em class="citetitle">scoreline</em></a> or <a class="link" href="scoreline_i.html" title="scoreline_i"><em class="citetitle">scoreline_i</em></a> opcode.</p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idm281472893325016"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the schedkwhen opcode. It uses the file <a class="ulink" href="examples/schedkwhen.csd" target="_top"><em class="citetitle">schedkwhen.csd</em></a>.

      </p>
        <div class="example">
          <a id="idm281472893323160"></a>
          <p class="title">
            <strong>Example 854. Example of the schedkwhen 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="idm281472713671736"></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>
<span class="c1">; Audio out   Audio in</span>
-odac           -iadc    <span class="c1">;;;RT audio I/O</span>
<span class="c1">; For Non-realtime ouput leave only the line below:</span>
<span class="c1">; -o schedkwhen.wav -W ;;; for file output any platform</span>
<span class="nt">&lt;/CsOptions&gt;</span>
<span class="nt">&lt;CsInstruments&gt;</span>

<span class="c1">; Initialize the global variables.</span>
<span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span>
<span class="vg">kr</span> <span class="o">=</span> <span class="mi">44100</span>
<span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">1</span>
<span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">1</span>

<span class="c1">; Instrument #1 - oscillator with a high note.</span>
<span class="kd">instr</span> <span class="nf">1</span>
  <span class="c1">; Use the fourth p-field as the trigger.</span>
  k<span class="n">trigger</span> <span class="o">=</span> <span class="nb">p4</span>
  k<span class="n">mintim</span> <span class="o">=</span> <span class="mi">0</span>
  k<span class="n">maxnum</span> <span class="o">=</span> <span class="mi">2</span>
  k<span class="n">insnum</span> <span class="o">=</span> <span class="mi">2</span>
  k<span class="n">when</span> <span class="o">=</span> <span class="mi">0</span>
  k<span class="n">dur</span> <span class="o">=</span> <span class="mf">0.5</span>

  <span class="c1">; Play Instrument #2 at the same time, if the trigger is set.</span>
  <span class="nb">schedkwhen</span> k<span class="n">trigger</span><span class="p">,</span> k<span class="n">mintim</span><span class="p">,</span> k<span class="n">maxnum</span><span class="p">,</span> k<span class="n">insnum</span><span class="p">,</span> k<span class="n">when</span><span class="p">,</span> k<span class="n">dur</span>

  <span class="c1">; Play a high note.</span>
  a<span class="n">1</span> <span class="nb">oscils</span> <span class="mi">10000</span><span class="p">,</span> <span class="mi">880</span><span class="p">,</span> <span class="mi">1</span>
  <span class="nb">out</span> a<span class="n">1</span>
<span class="kd">endin</span>

<span class="c1">; Instrument #2 - oscillator with a low note.</span>
<span class="kd">instr</span> <span class="nf">2</span>
  <span class="c1">; Play a low note.</span>
  a<span class="n">1</span> <span class="nb">oscils</span> <span class="mi">10000</span><span class="p">,</span> <span class="mi">220</span><span class="p">,</span> <span class="mi">1</span>
  <span class="nb">out</span> a<span class="n">1</span>
<span class="kd">endin</span>


<span class="nt">&lt;/CsInstruments&gt;</span>
<span class="nt">&lt;CsScore&gt;</span>

<span class="c1">; Table #1, a sine wave.</span>
<span class="nb">f</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">16384</span> <span class="mi">10</span> <span class="mi">1</span>

<span class="c1">; p4 = trigger for Instrument #2 (when p4 &gt; 0).</span>
<span class="c1">; Play Instrument #1 for half a second, no trigger.</span>
<span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mf">0.5</span> <span class="mi">0</span>
<span class="c1">; Play Instrument #1 for half a second, trigger Instrument #2.</span>
<span class="nb">i</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mf">0.5</span> <span class="mi">1</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="idm281472893318872"></a>
        <h2>See also</h2>
        <p><a class="link" href="event.html" title="event"><em class="citetitle">event</em></a>,
    <a class="link" href="event_i.html" title="event_i"><em class="citetitle">event_i</em></a>,
    <a class="link" href="schedule.html" title="schedule"><em class="citetitle">schedule</em></a>,
    <a class="link" href="schedwhen.html" title="schedwhen"><em class="citetitle">schedwhen</em></a>,
    <a class="link" href="schedkwhennamed.html" title="schedkwhennamed"><em class="citetitle">schedkwhennamed</em></a>,
    <a class="link" href="scoreline.html" title="scoreline"><em class="citetitle">scoreline</em></a>,
    <a class="link" href="scoreline_i.html" title="scoreline_i"><em class="citetitle">scoreline_i</em></a></p>
      </div>
      <div class="refsect1">
        <a id="idm281472893311320"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Rasmus Ekman</td>
          </tr>
          <tr>
            <td>EMS, Stockholm, Sweden</td>
          </tr>
        </table>
        <p>
    </p>
        <p>Example written by Kevin Conder.</p>
        <p>New in Csound version 3.59</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="scanu.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="schedkwhennamed.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">scanu </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> schedkwhennamed</td>
        </tr>
      </table>
    </div>
  </body>
</html>