Sophie

Sophie

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

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>oscili</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="oscil.html" title="oscil" />
    <link rel="next" href="oscilikt.html" title="oscilikt" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">oscili</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="oscil.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="oscilikt.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="oscili">
      <a id="oscili"></a>
      <div class="titlepage"></div>
      <a id="IndexOscili" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">oscili</span>
        </h2>
        <p>oscili — 
      A simple oscillator with linear interpolation.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp33815248"></a>
        <h2>Description</h2>
        <p>
        <span class="emphasis"><em>oscili</em></span> reads table <span class="emphasis"><em>ifn</em></span> sequentially and repeatedly at a frequency <span class="emphasis"><em>xcps</em></span>. The amplitude is scaled by <span class="emphasis"><em>xamp</em></span>. Linear interpolation is applied for table look up from internal phase values.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp33826184"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>oscili</strong></span> xamp, xcps, ifn [, iphs]</pre>
        <pre class="synopsis">kres <span class="command"><strong>oscili</strong></span> kamp, kcps, ifn [, iphs]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp33828040"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn</em></span> -- function table number. Requires a wrap-around guard point.
    </p>
        <p>
      <span class="emphasis"><em>iphs</em></span> (optional) -- initial phase of sampling, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is 0.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp33864672"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kamp, xamp</em></span> -- amplitude
    </p>
        <p>
      <span class="emphasis"><em>kcps, xcps</em></span> -- frequency in cycles per second.
    </p>
        <p>
      <span class="emphasis"><em>oscili</em></span> differs from <a class="link" href="oscil.html" title="oscil"><em class="citetitle">oscil</em></a> in that the standard procedure of using a truncated phase as a sampling index is here replaced by a process that interpolates between two successive lookups. Interpolating generators will produce a noticeably cleaner output signal, but they may take as much as twice as long to run. Adequate accuracy can also be gained without the time cost of interpolation by using large stored function tables of 2K, 4K or 8K points if the space is available.
    </p>
        <p>
      Table <span class="emphasis"><em>ifn</em></span> is incrementally sampled modulo the table length and the value obtained is multiplied by <span class="emphasis"><em>amp</em></span>.
    </p>
        <p>
      If you need to change the oscillator table with a k-rate signal, you can use <a class="link" href="oscilikt.html" title="oscilikt"><em class="citetitle">oscilikt</em></a>.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp33868744"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the oscili opcode. It uses the file <a class="ulink" href="examples/oscili.csd" target="_top"><em class="citetitle">oscili.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp33869712"></a>
          <p class="title">
            <strong>Example 530. Example of the oscili 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">;;;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 oscili.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

kamp <span class="op">=</span> .6
kcps <span class="op">=</span> 440
ifn  <span class="op">=</span> p4

asig <span class="opc">oscil</span> kamp, kcps, ifn
     <span class="opc">outs</span> asig,asig

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

<span class="oblock">instr</span> 2

kamp <span class="op">=</span> .6
kcps <span class="op">=</span> 440
ifn  <span class="op">=</span> p4

asig <span class="opc">oscili</span> kamp, kcps, ifn
     <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 128 10 1                                          <span class="comment">; Sine with a small amount of data</span>
<span class="stamnt">f</span>2 0 128 10 1 0.5 0.3 0.25 0.2 0.167 0.14 0.125 .111   <span class="comment">; Sawtooth with a small amount of data</span>
<span class="stamnt">f</span>3 0 128 10 1 0   0.3 0    0.2 0     0.14 0     .111   <span class="comment">; Square with a small amount of data</span>
<span class="stamnt">f</span>4 0 128 10 1 1   1   1    0.7 0.5   0.3  0.1          <span class="comment">; Pulse with a small amount of data</span>

<span class="stamnt">i</span> 1  0 2 1
<span class="stamnt">i</span> 2  3 2 1
<span class="stamnt">i</span> 1  6 2 2
<span class="stamnt">i</span> 2  9 2 2
<span class="stamnt">i</span> 1 12 2 3
<span class="stamnt">i</span> 2 15 2 3
<span class="stamnt">i</span> 1 18 2 4
<span class="stamnt">i</span> 2 21 2 4

<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="idp33871984"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="oscil.html" title="oscil"><em class="citetitle">oscil</em></a>,
      <a class="link" href="oscil3.html" title="oscil3"><em class="citetitle">oscil3</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp33873480"></a>
        <h2>Credits</h2>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="oscil.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="oscilikt.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">oscil </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> oscilikt</td>
        </tr>
      </table>
    </div>
  </body>
</html>