Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 6ed14ebfd686aa32f7956e552aa2e21d > files > 2431

csound-manual-5.13.0-5.fc15.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" href="csound.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" />
    <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="pset.html" title="pset" />
    <link rel="next" href="puts.html" title="puts" />
  </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="pset.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="puts.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="id3118412"></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="id3118485"></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="id3118504"></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="id3119176"></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="id3119218"></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="id3119235"></a>
          <p class="title">
            <b>Example 460. Example of the ptrack opcode.</b>
          </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>
<span class="comment">; Audio out   Audio in    No display</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</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> 16
<span class="ohdr">nchnls</span><span class="op">=</span> 1

<span class="comment">;Example by Victor Lazzarini 2007</span>

<span class="oblock">instr</span> 1
  a1 <span class="opc">inch</span> 1              <span class="comment">; take an input signal</span>
  kf,ka <span class="opc">ptrack</span> a1, 512   <span class="comment">; pitch track with winsize=1024</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>
  aout <span class="opc">oscili</span> <span class="opc">ampdb</span>(kamp)<span class="op">*</span>0dbfs, kcps, 1

  <span class="opc">out</span>  aout
<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 3600
<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="id3119272"></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="pset.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="puts.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pset </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> puts</td>
        </tr>
      </table>
    </div>
  </body>
</html>