Sophie

Sophie

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

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>cpstuni</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="cpstun.html" title="cpstun" />
    <link rel="next" href="cpsxpch.html" title="cpsxpch" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">cpstuni</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="cpstun.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="cpsxpch.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="cpstuni">
      <a id="cpstuni"></a>
      <div class="titlepage"></div>
      <a id="IndexCpstuni" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">cpstuni</span>
        </h2>
        <p>cpstuni — 
      Returns micro-tuning values at init-rate.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp17028056"></a>
        <h2>Description</h2>
        <p>
      Returns micro-tuning values at init-rate.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp17028776"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">icps <span class="command"><strong>cpstuni</strong></span> index, ifn</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp17083136"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>icps</em></span> -- Return value in cycles per second.
    </p>
        <p>
      <span class="emphasis"><em>index</em></span> -- An integer number denoting an index of scale.
    </p>
        <p>
      <span class="emphasis"><em>ifn</em></span> -- Function table containing the parameters (numgrades, interval, basefreq, basekeymidi) and the tuning ratios.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp17085232"></a>
        <h2>Performance</h2>
        <p>
      These opcodes are similar to <a class="link" href="cpstmid.html" title="cpstmid"><em class="citetitle">cpstmid</em></a>, but work without necessity of MIDI.
    </p>
        <p>
      <span class="emphasis"><em>cpstuni</em></span> works at init-rate. It allows fully customized micro-tuning scales. It requires a function table number containing the tuning ratios, and some other parameters stored in the function table itself.
    </p>
        <p>
      The <span class="emphasis"><em>index</em></span> argument should be filled with integer numbers expressing the grade of given scale to be converted in cps. The function table <span class="emphasis"><em>ifn</em></span> should be generated by <a class="link" href="GEN02.html" title="GEN02"><em class="citetitle">GEN02</em></a> and the first four values stored in this function are parameters that express:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p>numgrades -- The number of grades of the micro-tuning scale.</p>
            </li>
            <li class="listitem">
              <p>interval -- The frequency range covered before repeating the grade ratios, for example 2 for one octave, 1.5 for a fifth etcetera.</p>
            </li>
            <li class="listitem">
              <p>basefreq -- The base frequency of the scale in cycles per second.</p>
            </li>
            <li class="listitem">
              <p>basekey -- The integer index of the scale to which to assign basefreq unmodified.</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      After these four values, the user can begin to insert the tuning ratios.  For example, for a standard 12-grade scale with the base-frequency of 261 cps assigned to the key-number 60, the corresponding f-statement in the score to generate the table should be:

      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="comment">;           numgrades    basefreq     tuning-ratios (eq.temp) .......</span>
<span class="comment">;                  interval    basekey</span>
<span class="stamnt">f</span>1 0 64 -2  12     2     261   60     1   1.059463 1.12246 1.18920 ..etc...</pre>
        </div>
        <p>
    </p>
        <p>
Another example with a 24-grade scale with a base frequency of 440 assigned
to the key-number 48, and a repetition interval of 1.5:

      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="comment">;                  numgrades       basefreq      tuning-ratios .......</span>
<span class="comment">;                          interval       basekey</span>
<span class="stamnt">f</span>1 0 64 -2         24      1.5     440    48     1   1.01  1.02  1.03   ..etc...</pre>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp17095048"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the cpstuni opcode. It uses the file <a class="ulink" href="examples/cpstuni.csd" target="_top"><em class="citetitle">cpstuni.csd</em></a>.

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

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Table #1, a normal 12-tone equal temperament scale.</span>
<span class="comment">; numgrades = 12 (twelve tones)</span>
<span class="comment">; interval = 2 (one octave)</span>
<span class="comment">; basefreq = 261.659 (Middle C)</span>
<span class="comment">; basekeymidi = 60 (Middle C)</span>
gitemp <span class="ohdr">ftgen</span> 1, 0, 64, <span class="op">-</span>2, 12, 2, 261.659, 60, 1.00, \
             1.059, 1.122, 1.189, 1.260, 1.335, 1.414, \
             1.498, 1.588, 1.682, 1.782, 1.888, 2.000

<span class="comment">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  <span class="comment">; Use Table #1.</span>
  ifn <span class="op">=</span> 1

  <span class="comment">; If the base key (note #60) is C, then 9 notes </span>
  <span class="comment">; above it (note #60 + 9 = note #69) should be A.</span>
  index <span class="op">=</span> 69

  i1 <span class="opc">cpstuni</span> index, ifn

  <span class="opc">print</span> i1
<span class="oblock">endin</span>


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

<span class="comment">; Play Instrument #1 for one second.</span>
<span class="stamnt">i</span> 1 0 1
<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" />

      Its output should include lines like this:
      </p>
        <pre class="screen">instr 1:  i1 = 440.110</pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp17098752"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="cpstmid.html" title="cpstmid"><em class="citetitle">cpstmid</em></a>,
      <a class="link" href="cpstun.html" title="cpstun"><em class="citetitle">cpstun</em></a>,
      <a class="link" href="GEN02.html" title="GEN02"><em class="citetitle">GEN02</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp17100800"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
        <p>Example written by Kevin Conder.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="cpstun.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="cpsxpch.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">cpstun </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> cpsxpch</td>
        </tr>
      </table>
    </div>
  </body>
</html>