Sophie

Sophie

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

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>filepeak</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="filenchnls.html" title="filenchnls" />
    <link rel="next" href="filesr.html" title="filesr" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">filepeak</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="filenchnls.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="filesr.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="filepeak">
      <a id="filepeak"></a>
      <div class="titlepage"></div>
      <a id="IndexFilepeak" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">filepeak</span>
        </h2>
        <p>filepeak — 
      Returns the peak absolute value of a sound file.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp20020440"></a>
        <h2>Description</h2>
        <p>
      Returns the peak absolute value of a sound file.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp20021176"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ir <span class="command"><strong>filepeak</strong></span> ifilcod [, ichnl]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp20031496"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifilcod</em></span> -- sound file to be queried
    </p>
        <p>
      <span class="emphasis"><em>ichnl</em></span> (optional, default=0) -- channel to be used in calculating the peak value. Default is 0.
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" type="disc">
            <li class="listitem">
              <p><span class="emphasis"><em>ichnl</em></span> = 0 returns peak value of all channels</p>
            </li>
            <li class="listitem">
              <p><span class="emphasis"><em>ichnl</em></span> &gt; 0 returns peak value of <span class="emphasis"><em>ichnl</em></span></p>
            </li>
          </ul>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp20034488"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>filepeak</em></span> returns the peak absolute value of the sound file <span class="emphasis"><em>ifilcod</em></span>.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp20107984"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the filepeak opcode. It uses the file <a class="ulink" href="examples/filepeak.csd" target="_top"><em class="citetitle">filepeak.csd</em></a>,
and <a class="ulink" href="examples/Church.wav" target="_top"><em class="citetitle">Church.wav</em></a>.

      </p>
        <div class="example">
          <a id="idp20109352"></a>
          <p class="title">
            <strong>Example 228. Example of the filepeak 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 filepeak.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 

iscaldb <span class="op">=</span> p4 <span class="comment">;set peak amplitude in dB</span>
ipeak   <span class="opc">filepeak</span> "Church.wav"
iscal   <span class="op">=</span> <span class="opc">ampdb</span>(iscaldb)<span class="op">/</span>ipeak <span class="comment">;calculate amp multiplier</span>
<span class="opc">printf_i</span> "\nPeak value <span class="opc">in</span> file '<span class="op">%</span>s' is <span class="op">%</span>f (<span class="op">%</span>.3f dB).\n\n", 1, "Church.wav", ipeak, <span class="opc">dbamp</span>(ipeak)

asnd <span class="opc">soundin</span> "Church.wav"
     <span class="opc">outs</span> asnd, asnd
<span class="comment">; scale &amp; write file to disk</span>
asig <span class="op">=</span> asnd<span class="op">*</span>iscal <span class="comment">;scale to p4</span>
<span class="opc">fout</span> "Church_norm.wav", 14, asig

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

<span class="oblock">instr</span> 2 <span class="comment">; play scaled file</span>

aout   <span class="opc">soundin</span>  "Church_norm.wav"
ipknew <span class="opc">filepeak</span> "Church_norm.wav"
<span class="opc">printf_i</span> "\nPeak value <span class="opc">in</span> file '<span class="op">%</span>s' is <span class="op">%</span>f (<span class="op">%</span>.3f dB).\n\n", 1, "Church_norm.wav", ipknew, <span class="opc">dbamp</span>(ipknew)
       <span class="opc">outs</span> aout, aout

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 2 -6 <span class="comment">; normalize audio to -6 dB</span>
<span class="stamnt">i</span> 2 2 2
<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" />

      The <span class="emphasis"><em>filepeak</em></span>'s output should include lines like this:
      </p>
        <pre class="screen">
Peak value in file 'Church.wav' is 0.909363 (-0.825 dB).
Peak value in file 'Church_norm.wav' is 0.501190 (-6.000 dB).
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp20112544"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="filelen.html" title="filelen"><em class="citetitle">filelen</em></a>,
      <a class="link" href="filenchnls.html" title="filenchnls"><em class="citetitle">filenchnls</em></a>,
      <a class="link" href="filesr.html" title="filesr"><em class="citetitle">filesr</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp20114592"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Matt Ingalls</td>
          </tr>
          <tr>
            <td>July 1999</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.57</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="filenchnls.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="filesr.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">filenchnls </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> filesr</td>
        </tr>
      </table>
    </div>
  </body>
</html>