Sophie

Sophie

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

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>0dbfs</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="opor.html" title="||" />
    <link rel="next" href="opbitshl.html" title="&lt;&lt;" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">0dbfs</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="opor.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="opbitshl.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="0dbfs">
      <a id="Zerodbfs"></a>
      <div class="titlepage"></div>
      <a id="Index0dbfs" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">0dbfs</span>
        </h2>
        <p>0dbfs — 
      Sets the value of 0 decibels using full scale amplitude.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp12998928"></a>
        <h2>Description</h2>
        <p>
      Sets the value of 0 decibels using full scale amplitude.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp12999680"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>0dbfs</strong></span> = iarg</pre>
        <pre class="synopsis"><span class="command"><strong>0dbfs</strong></span> </pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp13010688"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iarg</em></span> -- the value of 0 decibels using full scale amplitude.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp13011640"></a>
        <h2>Performance</h2>
        <p>
      The default is 32767, so all existing orcs <span class="emphasis"><em>should</em></span> work.
    </p>
        <p>
      Amplitude values in Csound are always relative to a "<a class="link" href="Zerodbfs.html" title="0dbfs"><em class="citetitle">0dbfs</em></a>" value representing the peak available amplitude before clipping. In the original Csound, this value was always 32767, corresponding to the bipolar range of a 16bit soundfile or 16bit AD/DA codec. This remains the <span class="emphasis"><em>default</em></span> peak amplitude for Csound, for backward compatibility. The <a class="link" href="Zerodbfs.html" title="0dbfs"><em class="citetitle">0dbfs</em></a> value enables Csound to produce appropriately scaled values to whatever output format is being used, whether 16bit integer, 24bit integer, 32bit floats, or even 32bit integers.
    </p>
        <p>
      OdBFS can be defined in the header, to set the amplitude reference Csound will use, but it can also be used as a varible inside instruments like this:

      </p>
        <div class="informalexample">
          <pre class="programlisting">ipeak <span class="op">=</span> <span class="ohdr">0dbfs</span></pre>
        </div>
        <p>

      </p>
        <div class="informalexample">
          <pre class="programlisting">
asig <span class="opc">oscil</span> <span class="ohdr">0dbfs</span>, freq, 1
     <span class="opc">out</span>   asig * 0.3 * <span class="ohdr">0dbfs</span></pre>
        </div>
        <p>

    </p>
        <p>
      The purpose of the <span class="emphasis"><em>0dbfs</em></span> opcode is for people to start to code 0dbfs-relatively (and use the <a class="link" href="ampdbfs.html" title="ampdbfs"><em class="citetitle">ampdbfs()</em></a> opcodes a lot more!), rather than use explicit sample values. Using 0dbfs=1 is in accordance to industry practice, as ranges from -1 to 1 are used in most commercial plugin formats and in most other synthesis systems like Pure Data.
    </p>
        <p>
      Floats written to a file, when <span class="emphasis"><em>0dbfs = 1</em></span>, will in effect go through no range translation at all. So the numbers in the file are exactly what the orc says they are.
    </p>
        <p>For more details on amplitude values in Csound, see the section <a class="link" href="UsingDesign.html#AmplitudeCsound" title="Amplitude values in Csound"><em class="citetitle">Amplitude values in Csound</em></a></p>
      </div>
      <div class="refsect1" title="Example">
        <a id="idp13059328"></a>
        <h2>Example</h2>
        <p>
      Here is an example of the 0dbfs opcode. It uses the file <a class="ulink" href="examples/0dbfs.csd" target="_top"><em class="citetitle">0dbfs.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp13060848"></a>
          <p class="title">
            <strong>Example 31. Example of the 0dbfs 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    No messages</span>
-odac           -iadc     -d     <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 0dbfs.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">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="comment">; Set the 0dbfs to 1.</span>
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 1  <span class="comment">; from linear amplitude (0-1 range)</span>
<span class="opc">print</span> p4
a1 <span class="opc">oscil</span> p4, 440, 1
<span class="opc">outs</span> a1, a1
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2  <span class="comment">; from linear amplitude (0-32767 range)</span>
iamp <span class="op">=</span> p4 <span class="op">/</span> 32767
<span class="opc">print</span> iamp
a1 <span class="opc">oscil</span> iamp, 440, 1
<span class="opc">outs</span> a1, a1
<span class="oblock">endin</span>

<span class="oblock">instr</span> 3  <span class="comment">; from dB FS</span>
iamp <span class="op">=</span> <span class="opc">ampdbfs</span>(p4)
<span class="opc">print</span> iamp
a1 <span class="opc">oscil</span> iamp, 440, 1
<span class="opc">outs</span> a1, a1
<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 sine wave.</span>
<span class="stamnt">f</span> 1 0 16384 10 1

<span class="stamnt">i</span> 1 0 1   1
<span class="stamnt">i</span> 1 + 1   0.5
<span class="stamnt">i</span> 1 + 1   0.1
<span class="stamnt">s</span>
<span class="stamnt">i</span> 2 0 1   32767
<span class="stamnt">i</span> 2 + 1   [32767/2]
<span class="stamnt">i</span> 2 + 1   [3276.7]
<span class="stamnt">s</span>
<span class="stamnt">i</span> 3 0 1   0
<span class="stamnt">i</span> 3 + 1   -6
<span class="stamnt">i</span> 3 + 1   -20
<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="idp13063136"></a>
        <h2>See also</h2>
        <p>
          <a class="link" href="ampdbfs.html" title="ampdbfs">
            <em class="citetitle">ampdbfs()</em>
          </a>
        </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp13064040"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Dobson</td>
          </tr>
          <tr>
            <td>May 2002</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in version 4.10</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="opor.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="opbitshl.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">|| </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> &lt;&lt;</td>
        </tr>
      </table>
    </div>
  </body>
</html>