Sophie

Sophie

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

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>lpreson</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="lpread.html" title="lpread" />
    <link rel="next" href="lpshold.html" title="lpshold" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">lpreson</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="lpread.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="lpshold.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="lpreson">
      <a id="lpreson"></a>
      <div class="titlepage"></div>
      <a id="IndexLpreson" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">lpreson</span>
        </h2>
        <p>lpreson — 
      Resynthesises a signal from the data passed internally by a previous lpread.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp29833752"></a>
        <h2>Description</h2>
        <p>
      Resynthesises a signal from the data passed internally by a previous <span class="emphasis"><em>lpread</em></span>.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp29828136"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>lpreson</strong></span> asig</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp29829112"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig</em></span> -- an audio driving function for resynthesis.
    </p>
        <p>
      <span class="emphasis"><em>lpreson</em></span> receives values internally produced by a leading <span class="emphasis"><em>lpread</em></span>.<span class="emphasis"><em>lpread</em></span> gets its values from the control file according to the input value <span class="emphasis"><em>ktimpnt</em></span> (in seconds). If <span class="emphasis"><em>ktimpnt</em></span> proceeds at the analysis rate, time-normal synthesis will result; proceeding at a faster, slower, or variable rate will result in time-warped synthesis. At each k-period, <span class="emphasis"><em>lpread</em></span> interpolates between adjacent frames to more accurately determine the parameter values (presented as output) and the filter coefficient settings (passed internally to a subsequent <span class="emphasis"><em>lpreson</em></span>).
    </p>
        <p>
      The error signal <span class="emphasis"><em>kerr</em></span> (between 0 and 1) derived during predictive analysis reflects the deterministic/random nature of the analyzed source. This will emerge low for pitched (periodic) material and higher for noisy material. The transition from voiced to unvoiced speech, for example, produces an error signal value of about .3. During synthesis, the error signal value can be used to determine the nature of the  <span class="emphasis"><em>lpreson</em></span> driving function: for example, by arbitrating between pitched and non-pitched input, or even by determining a mix of the two. In normal speech resynthesis, the pitched input to <span class="emphasis"><em>lpreson</em></span> is a wideband periodic signal or pulse train derived from a unit such as <a class="link" href="buzz.html" title="buzz"><em class="citetitle">buzz</em></a>, and the nonpitched source is usually derived from <a class="link" href="rand.html" title="rand"><em class="citetitle">rand</em></a>. However, any audio signal can be used as the driving function, the only assumption of the analysis being that it has a flat response.
    </p>
        <p>
      <a class="link" href="lpfreson.html" title="lpfreson"><em class="citetitle">lpfreson</em></a> is a formant shifted <span class="emphasis"><em>lpreson</em></span>, in which <span class="emphasis"><em>kfrqratio</em></span> is the (cps) ratio of shifted to original formant positions. This permits synthesis in which the source object changes its apparent acoustic size. <a class="link" href="lpfreson.html" title="lpfreson"><em class="citetitle">lpfreson</em></a> with <span class="emphasis"><em>kfrqratio</em></span> = 1 is equivalent to <span class="emphasis"><em>lpreson</em></span>.
    </p>
        <p>
      Generally, <span class="emphasis"><em>lpreson</em></span> provides a means whereby the time-varying content and spectral shaping of a composite audio signal can be controlled by the dynamic spectral content of another. There can be any number of <span class="emphasis"><em>lpread/lpreson</em></span> (or <span class="emphasis"><em>lpfreson</em></span>) pairs in an instrument or in an orchestra; they can read from the same or different control files independently.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp29893728"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the lpreson opcode. It uses the file <a class="ulink" href="examples/lpreson.csd" target="_top"><em class="citetitle">lpreson.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp29894704"></a>
          <p class="title">
            <strong>Example 427. Example of the lpreson 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 lpreson.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="comment">; works with or without -a option when analyzing "fox.wav" from the manual</span>
<span class="comment">;both options sound a little different</span>
<span class="oblock">instr</span> 1

ilen  <span class="opc">filelen</span> "fox.wav"	<span class="comment">; length of soundfile</span>
<span class="opc">prints</span> "fox.wav <span class="op">=</span> <span class="op">%</span>f seconds\\n",ilen

ktime <span class="opc">line</span> 0, p3, p4
krmsr,krmso,kerr,kcps <span class="opc">lpread</span> ktime,"fox_poles.lpc"

krmso <span class="op">=</span> krmso<span class="op">*</span>.00001			<span class="comment">; low volume</span>
asig  <span class="opc">buzz</span> krmso, kcps, <span class="opc">int</span>(<span class="ohdr">sr</span><span class="op">/</span>2<span class="op">/</span>kcps), 1 <span class="comment">; max harmonics without aliasing</span>
aout  <span class="opc">lpreson</span> asig
asig  <span class="opc">clip</span> aout, 0, 1			<span class="comment">; prevents distortion</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="comment">; sine</span>
<span class="stamnt">f</span>1 0 4096 10 1

<span class="stamnt">i</span> 1 0 2.8 1	<span class="comment">; first words only</span>
<span class="stamnt">i</span> 1 4 2.8 2.8	<span class="comment">; whole sentence</span>
<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 audio file <span class="quote">“<span class="quote">fox.wav</span>”</span> is 2.8 seconds long. So <span class="emphasis"><em>filelen</em></span>'s output should be a line like this:
      </p>
        <pre class="screen">
fox.wav = 2.756667 seconds
      </pre>
        <p>
    </p>
        <p>
      Here is another example of the lpreson opcode. It uses the file <a class="ulink" href="examples/lpreson-2.csd" target="_top"><em class="citetitle">lpreson-2.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp29898448"></a>
          <p class="title">
            <strong>Example 428. Another example of the lpreson 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 lpreson-2.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="comment">; works with or without -a option when analyzing "fox.wav" from the manual</span>
<span class="comment">;both options sound a little different</span>
<span class="oblock">instr</span> 1

ilen   <span class="opc">filelen</span> "fox.wav"	<span class="comment">;length of soundfile 1</span>
<span class="opc">prints</span> "fox.wav <span class="op">=</span> <span class="op">%</span>f seconds\\n",ilen

ktime  <span class="opc">line</span> 0, p3, ilen
krmsr,krmso,kerr,kcps <span class="opc">lpread</span> ktime,"fox_nopoles.lpc"
asig   <span class="opc">diskin2</span>	"flute.aiff", 1
aout   <span class="opc">lpreson</span> asig
ares   <span class="opc">balance</span> aout, asig
       <span class="opc">outs</span> ares, ares

<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.8
<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="idp29900736"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="lpfreson.html" title="lpfreson"><em class="citetitle">lpfreson</em></a>,
      <a class="link" href="lpread.html" title="lpread"><em class="citetitle">lpread</em></a>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="lpread.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="lpshold.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">lpread </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> lpshold</td>
        </tr>
      </table>
    </div>
  </body>
</html>