Sophie

Sophie

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

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>cpsxpch</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="cpstuni.html" title="cpstuni" />
    <link rel="next" href="cpumeter.html" title="cpumeter" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">cpsxpch</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="cpstuni.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="cpumeter.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="cpsxpch">
      <a id="cpsxpch"></a>
      <div class="titlepage"></div>
      <a id="IndexCpsxpch" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">cpsxpch</span>
        </h2>
        <p>cpsxpch — 
       Converts a pitch-class value into cycles-per-second (Hz) for equal divisions of any interval.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp17126528"></a>
        <h2>Description</h2>
        <p>
      Converts a pitch-class value into cycles-per-second (Hz) for equal divisions of any interval. There is a restriction of no more than 100 equal divisions.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp17127472"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">icps <span class="command"><strong>cpsxpch</strong></span> ipch, iequal, irepeat, ibase</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp17128600"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ipch</em></span> -- Input number of the form 8ve.pc, indicating an 'octave' and which note in the octave.
    </p>
        <p>
      <span class="emphasis"><em>iequal</em></span> -- if positive, the number of equal intervals into which the 'octave' is divided. Must be less than or equal to 100. If negative, is the number of a table of frequency multipliers.
    </p>
        <p>
      <span class="emphasis"><em>irepeat</em></span> -- Number indicating the interval which is the 'octave.' The integer 2 corresponds to octave divisions, 3 to a twelfth, 4 is two octaves, and so on. This need not be an integer, but must be positive.
    </p>
        <p>
      <span class="emphasis"><em>ibase</em></span> -- The frequency which corresponds to pitch 0.0
    </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>
        </p>
                <div class="orderedlist">
                  <ol class="orderedlist" type="1">
                    <li class="listitem">
                      <p>The following are essentially the same
            </p>
                      <pre class="programlisting">
ia  <span class="op">=</span>  <span class="opc">cpspch</span>(8.02)
ib     <span class="opc">cps2pch</span>  8.02, 12
ic     <span class="opc">cpsxpch</span>  8.02, 12, 2, 1.02197503906</pre>
                      <p>
            </p>
                    </li>
                    <li class="listitem">
                      <p>
              These are opcodes not functions
            </p>
                    </li>
                    <li class="listitem">
                      <p>
              Negative values of <span class="emphasis"><em>ipch</em></span> are allowed, but not negative <span class="emphasis"><em>irepeat</em></span>, <span class="emphasis"><em>iequal</em></span> or <span class="emphasis"><em>ibase</em></span>.
            </p>
                    </li>
                  </ol>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp17137032"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the cpsxpch opcode. It uses the file <a class="ulink" href="examples/cpsxpch.csd" target="_top"><em class="citetitle">cpsxpch.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp17138016"></a>
          <p class="title">
            <strong>Example 139. Example of the cpsxpch 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 cpsxpch.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">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  <span class="comment">; Use a normal twelve-tone scale.</span>
  ipch <span class="op">=</span> 8.02
  iequal <span class="op">=</span> 12
  irepeat <span class="op">=</span> 2
  ibase <span class="op">=</span> 1.02197503906

  icps <span class="opc">cpsxpch</span> ipch, iequal, irepeat, ibase

  <span class="opc">print</span> icps
<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:  icps = 293.666</pre>
        <p>
    </p>
        <p>
      Here is an example of the cpsxpch opcode using a 10.5 ET scale. It uses the file <a class="ulink" href="examples/cpsxpch_105et.csd" target="_top"><em class="citetitle">cpsxpch_105et.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp17141352"></a>
          <p class="title">
            <strong>Example 140. Example of the cpsxpch opcode using a 10.5 ET scale.</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>
<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 cpsxpch_105et.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">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  <span class="comment">; Use a 10.5ET scale.</span>
  ipch <span class="op">=</span> 4.02
  iequal <span class="op">=</span> 21
  irepeat <span class="op">=</span> 4
  ibase <span class="op">=</span> 16.35160062496

  icps <span class="opc">cpsxpch</span> ipch, iequal, irepeat, ibase

  <span class="opc">print</span> icps
<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:  icps = 4776.824</pre>
        <p>
    </p>
        <p>
      Here is an example of the cpsxpch opcode using a Pierce scale centered on middle A. It uses the file <a class="ulink" href="examples/cpsxpch_pierce.csd" target="_top"><em class="citetitle">cpsxpch_pierce.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp17143464"></a>
          <p class="title">
            <strong>Example 141. Example of the cpsxpch opcode using a Pierce scale centered on middle A.</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>
<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 cpsxpch_pierce.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">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  <span class="comment">; Use a Pierce scale centered on middle A.</span>
  ipch <span class="op">=</span> 2.02
  iequal <span class="op">=</span> 12
  irepeat <span class="op">=</span> 3
  ibase <span class="op">=</span> 261.62561

  icps <span class="opc">cpsxpch</span> ipch, iequal, irepeat, ibase

  <span class="opc">print</span> icps
<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:  icps = 2827.762</pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp17144904"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="cpspch.html" title="cpspch"><em class="citetitle">cpspch</em></a>,
      <a class="link" href="cps2pch.html" title="cps2pch"><em class="citetitle">cps2pch</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp17146464"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>University of Bath/Codemist Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
          <tr>
            <td>1997</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.492</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="cpstuni.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="cpumeter.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">cpstuni </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> cpumeter</td>
        </tr>
      </table>
    </div>
  </body>
</html>