Sophie

Sophie

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

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>metro</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="mediank.html" title="mediank" />
    <link rel="next" href="midglobal.html" title="midglobal" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">metro</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="mediank.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="midglobal.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="metro">
      <a id="metro"></a>
      <div class="titlepage"></div>
      <a id="IndexMetro" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">metro</span>
        </h2>
        <p>metro — 
     Trigger Metronome
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp30680744"></a>
        <h2>Description</h2>
        <p>
	Generate a metronomic signal to be used in any circumstance an isochronous trigger is needed.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp30681544"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ktrig  <span class="command"><strong>metro</strong></span>  kfreq [, initphase]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp30710792"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>initphase</em></span>  - initial phase value (in the 0 to 1 range)
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp30711728"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ktrig</em></span> - output trigger signal
    </p>
        <p>
      <span class="emphasis"><em>kfreq</em></span> - frequency of trigger bangs in cps
    </p>
        <p>
     <span class="emphasis"><em>metro</em></span> is a simple opcode that outputs a sequence of isochronous bangs (that is 1 values) each 1/kfreq seconds. Trigger signals can be used in any circumstance, mainly to temporize realtime algorithmic compositional structures.
     </p>
        <div class="note" title="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>
        <span class="emphasis"><em>metro</em></span> will produce a trigger signal of 1 when its phase is exactly 0 or 1. If you want to skip the initial trigger, use a very small value like 0.00000001.
     </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp30714904"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the metro opcode. It uses the file <a class="ulink" href="examples/metro.csd" target="_top"><em class="citetitle">metro.csd</em></a>
      </p>
        <div class="example">
          <a id="idp30715856"></a>
          <p class="title">
            <strong>Example 451. Example of the metro opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
-odac -B441 -b441
<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">kr</span>     <span class="op">=</span>        100
<span class="ohdr">ksmps</span>  <span class="op">=</span>        441
<span class="ohdr">nchnls</span> <span class="op">=</span>        2

       <span class="oblock">instr</span>    1
ktrig <span class="opc">metro</span> 0.2
<span class="opc">printk2</span> ktrig
	<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 20


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
            Here is another example of the metro opcode. It uses the file <a class="ulink" href="examples/metro-2.csd" target="_top"><em class="citetitle">metro-2.csd</em></a>
      </p>
        <div class="example">
          <a id="idp30717224"></a>
          <p class="title">
            <strong>Example 452. Another xample of the metro opcode.</strong>
          </p>
          <div class="example-contents">
            <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 metro-2.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

kpch    <span class="opc">random</span>   1,20		<span class="comment">;produce values at k-rate</span>
ktrig   <span class="opc">metro</span>    10		<span class="comment">;trigger 10 times per second</span>
kval	<span class="opc">samphold</span> kpch, ktrig 	<span class="comment">;change value whenever ktrig = 1 </span>
asig	<span class="opc">buzz</span>	 1, 220, kval, 1<span class="comment">;harmonics</span>
        <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="stamnt">f</span> 1 0 4096 10 1	<span class="comment">; sine</span>

<span class="stamnt">i</span> 1 0 10
<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="idp30718216"></a>
        <h2>See Also</h2>
        <p> More information on this opcode in the Floss Manuals: <a class="ulink" href="http://en.flossmanuals.net/csound/ch018_c-control-structures/" target="_top"><em class="citetitle">http://en.flossmanuals.net/csound/ch018_c-control-structures/</em></a></p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp30719360"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
        <p>First Example written by Andrés Cabrera.</p>
        <p>New in Csound 5 (Previously available only on CsoundAV)</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="mediank.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="midglobal.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">mediank </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> midglobal</td>
        </tr>
      </table>
    </div>
  </body>
</html>