Sophie

Sophie

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

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>cps2pch</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="cosinv.html" title="cosinv" />
    <link rel="next" href="cpsmidi.html" title="cpsmidi" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">cps2pch</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="cosinv.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="cpsmidi.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="cps2pch">
      <a id="cps2pch"></a>
      <div class="titlepage"></div>
      <a id="IndexCps2pch" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">cps2pch</span>
        </h2>
        <p>cps2pch — 
      Converts a pitch-class value into cycles-per-second (Hz) for equal divisions of the octave.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp16677728"></a>
        <h2>Description</h2>
        <p>
      Converts a pitch-class value into cycles-per-second (Hz) for equal divisions of the octave.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp16707384"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">icps <span class="command"><strong>cps2pch</strong></span> ipch, iequal</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp16708464"></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>
        <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.
            </p>
                    </li>
                  </ol>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp16714880"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the cps2pch opcode. It uses the file <a class="ulink" href="examples/cps2pch.csd" target="_top"><em class="citetitle">cps2pch.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp16715864"></a>
          <p class="title">
            <strong>Example 127. Example of the cps2pch 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 cps2pch.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

  icps <span class="opc">cps2pch</span> ipch, iequal

  <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 cps2pch opcode using a table of frequency multipliers. It uses the file <a class="ulink" href="examples/cps2pch_ftable.csd" target="_top"><em class="citetitle">cps2pch_ftable.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp16719200"></a>
          <p class="title">
            <strong>Example 128. Example of the cps2pch opcode using a table of frequency multipliers.</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 cps2pch_ftable.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
  ipch <span class="op">=</span> 8.02

  <span class="comment">; Use Table #1, a table of frequency multipliers.</span>
  icps <span class="opc">cps2pch</span> ipch, <span class="op">-</span>1

  <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">; Table #1: a table of frequency multipliers.</span>
<span class="comment">; Creates a 10-note scale of unequal divisions.</span>
<span class="stamnt">f</span> 1 0 16 -2 1 1.1 1.2 1.3 1.4 1.6 1.7 1.8 1.9

<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 = 313.951</pre>
        <p>
    </p>
        <p>
      Here is an example of the cps2pch opcode using a 19ET scale. It uses the file <a class="ulink" href="examples/cps2pch_19et.csd" target="_top"><em class="citetitle">cps2pch_19et.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp16721304"></a>
          <p class="title">
            <strong>Example 129. Example of the cps2pch opcode using a 19ET 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 cps2pch_19et.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 19ET scale.</span>
  ipch <span class="op">=</span> 8.02
  iequal <span class="op">=</span> 19

  icps <span class="opc">cps2pch</span> ipch, iequal

  <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 = 281.429</pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp16722720"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="cpspch.html" title="cpspch"><em class="citetitle">cpspch</em></a>, 
      <a class="link" href="cpsxpch.html" title="cpsxpch"><em class="citetitle">cpsxpch</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp16724280"></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="cosinv.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="cpsmidi.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">cosinv </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> cpsmidi</td>
        </tr>
      </table>
    </div>
  </body>
</html>