Sophie

Sophie

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

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>changed</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="chanctrl.html" title="chanctrl" />
    <link rel="next" href="changed2.html" title="changed2" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">changed</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="chanctrl.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="changed2.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="changed"></a>
      <div class="titlepage"></div>
      <a id="IndexChanged" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">changed</span>
        </h2>
        <p>changed — 
     k-rate signal change detector.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472947642184"></a>
        <h2>Description</h2>
        <p>
	This opcode outputs a trigger signal that informs when any one of its k-rate arguments has changed. Useful with valuator widgets or MIDI controllers.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472947640824"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ktrig <span class="command"><strong>changed</strong></span> kvar1 [, kvar2,..., kvarN]</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472947579768"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ktrig</em></span> - Outputs a value of 1 when any of the k-rate signals has changed, otherwise outputs 0.
    </p>
        <p>
      <span class="emphasis"><em>kvar1 [, kvar2,..., kvarN]</em></span> - k-rate variables to watch for changes.
    </p>
        <p> </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"> If any of the kvars is non-zero at the first k-cycle
    changed is called it will report a change.  For more consistent
    behaviour use <span class="emphasis"><em>changed2</em></span>.</td>
            </tr>
          </table>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472947575784"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the changed opcode. It uses the file <a class="ulink" href="examples/changed.csd" target="_top"><em class="citetitle">changed.csd</em></a>.

      </p>
        <div class="example">
          <a id="idm281472947574008"></a>
          <p class="title">
            <strong>Example 116. Example of the changed opcode.</strong>
          </p>
          <div class="example-contents">
            <div class="refsect1">
              <a id="idm281472781834920"></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">;;;RT audio out</span>
<span class="c1">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="c1">; For Non-realtime ouput leave only the line below:</span>
<span class="c1">; -o changed.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="kd">instr</span> <span class="nf">1</span>

k<span class="n">sig</span>  <span class="nb">oscil</span> <span class="mi">2</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mi">1</span>
k<span class="n">int</span>  <span class="o">=</span> <span class="nb">int</span><span class="p">(</span>k<span class="n">sig</span><span class="p">)</span>
k<span class="n">trig</span> <span class="nb">changed</span> k<span class="n">int</span>
      <span class="nb">printk</span> <span class="mf">0.2</span><span class="p">,</span> k<span class="n">int</span>
      <span class="nb">printk2</span> k<span class="n">trig</span>

<span class="kd">endin</span>

<span class="nt">&lt;/CsInstruments&gt;</span>
<span class="nt">&lt;CsScore&gt;</span>
<span class="nb">f</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1024</span> <span class="mi">10</span> <span class="mi">1</span>
<span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">20</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" />
            Its output should include lines like:
      </p>
        <pre class="screen">
 i   1 time     0.00267:     0.00000
 i1     0.00000
 i1     1.00000
 i1     0.00000
 i   1 time     0.20267:     1.00000
 i   1 time     0.40267:     1.00000
 i1     1.00000
 i1     0.00000
 i   1 time     0.60267:     1.00000
 i   1 time     0.80267:     1.00000
 i1     1.00000
 i1     0.00000
 i   1 time     1.00000:     0.00000
 i1     1.00000
 i1     0.00000
 i   1 time     1.20267:    -1.00000
 i   1 time     1.40267:    -1.00000
 i1     1.00000
 i1     0.00000
 i   1 time     1.60267:    -1.00000
 i   1 time     1.80000:    -1.00000
 i1     1.00000
 i1     0.00000
 i   1 time     2.00000:    -0.00000
 i1     1.00000
 i1     0.00000
 .........
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472947570792"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
        <p>Example written by Andrés Cabrera.</p>
        <p>New in Csound 7.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="chanctrl.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="changed2.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">chanctrl </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> changed2</td>
        </tr>
      </table>
    </div>
  </body>
</html>