Sophie

Sophie

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

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>cent</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="cell.html" title="cell" />
    <link rel="next" href="centroid.html" title="centroid" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">cent</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="cell.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="centroid.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="cent">
      <a id="cent"></a>
      <div class="titlepage"></div>
      <a id="IndexCent" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">cent</span>
        </h2>
        <p>cent — 
      Calculates a factor to raise/lower a frequency by a given amount of cents.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp15328728"></a>
        <h2>Description</h2>
        <p>
      Calculates a factor to raise/lower a frequency by a given amount of cents.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp15329520"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>cent</strong></span>(x) </pre>
        <p>
      This function works at a-rate, i-rate, and k-rate.
    </p>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp15340216"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>x</em></span> -- a value expressed in cents.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp15341080"></a>
        <h2>Performance</h2>
        <p>
      The value returned by the <span class="emphasis"><em>cent</em></span> function is a factor. You can multiply a frequency by this factor to raise/lower it by the given amount of cents.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp15342184"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the cent opcode. It uses the file <a class="ulink" href="examples/cent.csd" target="_top"><em class="citetitle">cent.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp15343160"></a>
          <p class="title">
            <strong>Example 95. Example of the cent 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>
-odac     <span class="comment">;;;RT audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o cent.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	<span class="comment">; original pitch</span>
  
iroot <span class="op">=</span> 440	<span class="comment">; root note = A (440 Hz)</span>

<span class="opc">print</span> iroot	<span class="comment">;print out</span>

asig <span class="opc">oscili</span> 0.6, iroot, 1 
     <span class="opc">outs</span> asig, asig

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

<span class="oblock">instr</span> 2
  
iroot   <span class="op">=</span> 440	<span class="comment">; root note = A (440 Hz)</span>
icents  <span class="op">=</span> p4	<span class="comment">; change root note by 300 and 1200 cents</span>

ifactor <span class="op">=</span> <span class="opc">cent</span>(icents) <span class="comment">; calculate new note</span>
inew    <span class="op">=</span> iroot <span class="op">*</span> ifactor

<span class="opc">print</span> iroot	<span class="comment">; Print all</span>
<span class="opc">print</span> ifactor
<span class="opc">print</span> inew

asig <span class="opc">oscili</span> 0.6, inew, 1 
     <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="comment">; sine wave</span>
<span class="stamnt">f</span>1 0 32768 10 1

<span class="stamnt">i</span> 1 0  2  0	<span class="comment">;no change</span>
<span class="stamnt">i</span> 2 2.5 2 300	<span class="comment">;note = C above A</span>
<span class="stamnt">i</span> 2 5  2 1200	<span class="comment">;1 octave higher </span>

<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:
      </p>
        <pre class="screen">
instr 1:  iroot = 440.000

instr 2:  iroot = 440.000
instr 2:  ifactor = 1.189
instr 2:  inew = 523.251

instr 2:  iroot = 440.000
instr 2:  ifactor = 2.000
instr 2:  inew = 880.000</pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp15376512"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="db.html" title="db"><em class="citetitle">db</em></a>,
      <a class="link" href="octave.html" title="octave"><em class="citetitle">octave</em></a>,
      <a class="link" href="semitone.html" title="semitone"><em class="citetitle">semitone</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp15378528"></a>
        <p>New in version 4.16</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="cell.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="centroid.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">cell </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> centroid</td>
        </tr>
      </table>
    </div>
  </body>
</html>