Sophie

Sophie

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

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>ptrack</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="ptablew.html" title="ptablew" />
    <link rel="next" href="push.html" title="push" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">ptrack</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="ptablew.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="push.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="ptrack">
      <a id="ptrack"></a>
      <div class="titlepage"></div>
      <a id="Indexptrack" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">ptrack</span>
        </h2>
        <p>ptrack — 
      Tracks the pitch of a signal.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp37580880"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>ptrack</em></span> takes an input signal, splits it into <span class="emphasis"><em>ihopsize</em></span> blocks and using a STFT method, extracts an estimated pitch for its fundamental frequency as well as estimating the total amplitude of the signal in dB, relative to full-scale (0dB). The method implies an analysis window size of 2*<span class="emphasis"><em>ihopsize</em></span> samples (overlaping by 1/2 window), which has to be a power-of-two, between 128 and 8192 (hopsizes between 64 and 4096). Smaller windows will give better time precision, but worse frequency accuracy (esp. in low fundamentals).This opcode is based on an original algorithm by M. Puckette.
      </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp37617016"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">kcps, kamp <span class="command"><strong>ptrack</strong></span> asig, ihopsize[,ipeaks]</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp37618144"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ihopsize</em></span> -- size of the analysis 'hop', in samples, required to be power-of-two (min 64, max 4096). 
      This is the period between measurements.
    </p>
        <p>
      <span class="emphasis"><em>ipeaks</em></span>, <span class="emphasis"><em>ihi</em></span> -- number of spectral peaks to use in the analysis, defaults to 20 (optional)
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp37620024"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kcps</em></span> -- estimated pitch in Hz.
    </p>
        <p>
      <span class="emphasis"><em>kamp</em></span> -- estimated amplitude in dB relative to full-scale (0dB) (ie. always &lt;= 0).
    </p>
        <p>
      <span class="emphasis"><em>ptrack</em></span> analyzes the input signal, <span class="emphasis"><em>asig</em></span>, 
      to give a pitch/amplitude pair of outputs, for the fundamental of a monophonic signal. 
      The output is updated every <span class="emphasis"><em>sr/ihopsize</em></span> seconds.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp37622592"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the ptrack opcode. This example uses the files <a class="ulink" href="examples/ptrack.csd" target="_top"><em class="citetitle">ptrack.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp37623584"></a>
          <p class="title">
            <strong>Example 625. Example of the ptrack opcode.</strong>
          </p>
          <div class="example-contents">

            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.
            <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 ptrack.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">0dbfs</span>  <span class="op">=</span> 1 
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

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

ihop  <span class="op">=</span> p4
aout  <span class="opc">diskin2</span> "fox.wav",1, 0, 1
kf,ka <span class="opc">ptrack</span> aout, ihop	<span class="comment">; pitch track with different hopsizes</span>
kcps  <span class="opc">port</span> kf, 0.01	<span class="comment">; smooth freq</span>
kamp  <span class="opc">port</span> ka, 0.01	<span class="comment">; smooth amp</span>
<span class="comment">; drive an oscillator</span>
asig  <span class="opc">poscil</span> <span class="opc">ampdb</span>(kamp)<span class="op">*</span>0dbfs, kcps, 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">; simple sine wave</span>
<span class="stamnt">f</span> 1 0 4096 10 1

<span class="stamnt">i</span> 1 0  5 128
<span class="stamnt">i</span> 1 6  5 512
<span class="stamnt">i</span> 1 12 5 1024
<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="idp37625808"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>NUI, Maynooth.</td>
          </tr>
          <tr>
            <td>Maynooth, Ireland</td>
          </tr>
          <tr>
            <td>March, 2007</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.05</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="ptablew.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="push.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">ptablew </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> push</td>
        </tr>
      </table>
    </div>
  </body>
</html>