Sophie

Sophie

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

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>pitchamdf</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="pitch.html" title="pitch" />
    <link rel="next" href="planet.html" title="planet" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pitchamdf</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pitch.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="planet.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="pitchamdf">
      <a id="pitchamdf"></a>
      <div class="titlepage"></div>
      <a id="IndexPitchamdf" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pitchamdf</span>
        </h2>
        <p>pitchamdf — 
      Follows the pitch of a signal based on the AMDF method.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp36368152"></a>
        <h2>Description</h2>
        <p>
      Follows the pitch of a signal based on the AMDF method (Average Magnitude Difference Function). Outputs pitch and amplitude tracking signals. The method is quite fast and should run in realtime. This technique usually works best for monophonic signals.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp36369296"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kcps, krms <span class="command"><strong>pitchamdf</strong></span> asig, imincps, imaxcps [, icps] [, imedi] \
      [, idowns] [, iexcps] [, irmsmedi]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp36423904"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>imincps</em></span> -- estimated minimum frequency (expressed in Hz) present in the signal
    </p>
        <p>
      <span class="emphasis"><em>imaxcps</em></span> -- estimated maximum frequency present in the signal
    </p>
        <p>
      <span class="emphasis"><em>icps</em></span> (optional, default=0) -- estimated initial frequency of the signal. If 0, icps = (<span class="emphasis"><em>imincps</em></span>+<span class="emphasis"><em>imaxcps</em></span>) / 2. The default is 0.
    </p>
        <p>
      <span class="emphasis"><em>imedi</em></span> (optional, default=1) -- size of median filter applied to the output <span class="emphasis"><em>kcps</em></span>. The size of the filter will be <span class="emphasis"><em>imedi</em></span>*2+1. If 0, no median filtering will be applied. The default is 1.
    </p>
        <p>
      <span class="emphasis"><em>idowns</em></span> (optional, default=1) -- downsampling factor for <span class="emphasis"><em>asig</em></span>. Must be an integer. A factor of <span class="emphasis"><em>idowns</em></span> &gt; 1 results in faster performance, but may result in worse pitch detection. Useful range is 1 - 4. The default is 1.
    </p>
        <p>
      <span class="emphasis"><em>iexcps</em></span> (optional, default=0) -- how frequently pitch analysis is executed, expressed in Hz.  If 0, <span class="emphasis"><em>iexcps</em></span> is set to <span class="emphasis"><em>imincps</em></span>. This is usually reasonable, but experimentation with other values may lead to better results. Default is 0.
    </p>
        <p>
      <span class="emphasis"><em>irmsmedi</em></span> (optional, default=0) -- size of median filter applied to the output <span class="emphasis"><em>krms</em></span>. The size of the filter will be <span class="emphasis"><em>irmsmedi</em></span>*2+1. If 0, no median filtering will be applied. The default is 0.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp36430992"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kcps</em></span> -- pitch tracking output
    </p>
        <p>
      <span class="emphasis"><em>krms</em></span> -- amplitude tracking output
    </p>
        <p>
      <span class="emphasis"><em>pitchamdf</em></span> usually works best for monophonic signals, and is quite reliable if appropriate initial values are chosen. Setting <span class="emphasis"><em>imincps</em></span> and <span class="emphasis"><em>imaxcps</em></span> as narrow as possible to the range of the signal's pitch, results in better detection and performance.
    </p>
        <p>
      Because this process can only detect pitch after an initial delay, setting <span class="emphasis"><em>icps</em></span> close to the signal's real initial pitch prevents spurious data at the beginning.
    </p>
        <p>
      The median filter prevents <span class="emphasis"><em>kcps</em></span> from jumping. Experiment to determine the optimum value for <span class="emphasis"><em>imedi</em></span> for a given signal.
    </p>
        <p>
      Other initial values can usually be left at the default settings. Lowpass filtering of <span class="emphasis"><em>asig</em></span> before passing it to <span class="emphasis"><em>pitchamdf</em></span>, can improve performance, especially with complex waveforms.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp36435960"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the pitchamdf opcode. It uses the file <a class="ulink" href="examples/pitchamdf.csd" target="_top"><em class="citetitle">pitchamdf.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp36436960"></a>
          <p class="title">
            <strong>Example 594. Example of the pitchamdf 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 real audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o pitchamdf.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">;clean audio</span>

asig <span class="opc">soundin</span> p4
     <span class="opc">outs</span> asig, asig
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2	<span class="comment">;use pitch</span>

asig <span class="opc">soundin</span> p4
asig <span class="opc">tone</span> asig, 1000		<span class="comment">;lowpass-filter</span>
kcps, krms <span class="opc">pitchamdf</span> asig, 100, 500, 200
asig <span class="opc">poscil</span> krms, kcps, 1	<span class="comment">;re-synthesize with sawtooth</span>
     <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 16384 10 1 0.5 0.3 0.25 0.2 0.167 0.14 0.125 .111   <span class="comment">;sawtooth</span>

<span class="stamnt">i</span> 1 0  3 "fox.wav"
<span class="stamnt">i</span> 2 3  3 "fox.wav"
<span class="stamnt">i</span> 1 6  3 "mary.wav"
<span class="stamnt">i</span> 2 9  3 "mary.wav"
<span class="stamnt">i</span> 1 12 3 "beats.wav"
<span class="stamnt">i</span> 2 15 3 "beats.wav"
<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="Credits">
        <a id="idp36439272"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Peter Neubäcker</td>
          </tr>
          <tr>
            <td>Munich, Germany</td>
          </tr>
          <tr>
            <td>August 1999</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.59</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pitch.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="planet.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pitch </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> planet</td>
        </tr>
      </table>
    </div>
  </body>
</html>