Sophie

Sophie

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

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>pvsmorph</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="pvsmix.html" title="pvsmix" />
    <link rel="next" href="pvsmooth.html" title="pvsmooth" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pvsmorph</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pvsmix.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pvsmooth.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="pvsmorph">
      <a id="pvsmorph"></a>
      <div class="titlepage"></div>
      <a id="Indexpvsmorph" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pvsmorph</span>
        </h2>
        <p>pvsmorph — 
      Performs morphing (or interpolation) between two source fsigs.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp39102312"></a>
        <h2>Description</h2>
        <p>
      Performs morphing (or interpolation)  between two source fsigs.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp39139440"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">fsig <span class="command"><strong>pvsmorph</strong></span> fsig1, fsig2, kampint, kfrqint</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp39140488"></a>
        <h2>Performance</h2>
        <p>
      The operation of this opcode is similar to that of <a class="link" href="pvcross.html" title="pvcross"><em class="citetitle">pvinterp</em></a> (q.v.), 
      except in using <span class="emphasis"><em>fsig</em></span>s rather than analysis files, and the absence of spectral envelope preservation. 
      The amplitudes and frequencies of <span class="emphasis"><em>fsig1</em></span> are interpolated with those of <span class="emphasis"><em>fsig2</em></span>, 
      depending on the values of <span class="emphasis"><em>kampint</em></span> and <span class="emphasis"><em>kfrqint</em></span>, respectively. These range
      between 0 and 1, where 0 means <span class="emphasis"><em>fsig1</em></span> and 1, <span class="emphasis"><em>fsig2</em></span>. Anything in between will
      interpolate amps and/or freqs of the two fsigs.
    </p>
        <p>
      With this opcode, morphing can be performed on real-time audio input, by using 
      <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a> to generate <span class="emphasis"><em>fsig1</em></span> and <span class="emphasis"><em>fsig2</em></span>. 
      These must have the same format.
    </p>
        <div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        It is unsafe to use the same f-variable for both input and output of pvs opcodes. Using the same one might lead to undefined behavior on some opcodes. Use a different one on the left and right sides of the opcode.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp39145416"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the pvsmorph opcode. It uses the file <a class="ulink" href="examples/pvsmorph.csd" target="_top"><em class="citetitle">pvsmorph.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp39146400"></a>
          <p class="title">
            <strong>Example 670. Example of the pvsmorph 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>
<span class="comment">; Audio out   Audio in</span>
-odac    <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o pvsmorph.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> 16
<span class="ohdr">nchnls</span> <span class="op">=</span> 1
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="comment">;; example written by joachim heintz 2009</span>

giSine		<span class="ohdr">ftgen</span>		0, 0, 4096, 10, 1

<span class="oblock">instr</span> 1
iampint1	<span class="op">=</span>		p4
iampint2	<span class="op">=</span>		p5
ifrqint1	<span class="op">=</span>		p6
ifrqint2	<span class="op">=</span>		p7
kampint	<span class="opc">linseg</span>		iampint1, p3, iampint2
kfrqint	<span class="opc">linseg</span>		ifrqint1, p3, ifrqint2
ifftsize	<span class="op">=</span>		1024
ioverlap	<span class="op">=</span>		ifftsize <span class="op">/</span> 4
iwinsize	<span class="op">=</span>		ifftsize
iwinshape	<span class="op">=</span>		1<span class="comment">; von-Hann window</span>
Sfile1		<span class="op">=</span>		"fox.wav"
ain1		<span class="opc">soundin</span>	Sfile1
ain2		<span class="opc">buzz</span>		.2, 50, 100, giSine
fftin1		<span class="opc">pvsanal</span>	ain1, ifftsize, ioverlap, iwinsize, iwinshape
fftin2		<span class="opc">pvsanal</span>	ain2, ifftsize, ioverlap, iwinsize, iwinshape
fmorph		<span class="opc">pvsmorph</span>	fftin1, fftin2, kampint, kfrqint
aout		<span class="opc">pvsynth</span>	fmorph
		<span class="opc">out</span>		aout <span class="op">*</span> .5
<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 3 0 0 1 1
<span class="stamnt">i</span> 1 3 3 1 0 1 0
<span class="stamnt">i</span> 1 6 3 0 1 0 1
<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>
        <p>
      Here is another example of the pvsmorph opcode. It uses the file <a class="ulink" href="examples/pvsmorph2.csd" target="_top"><em class="citetitle">pvsmorph2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp39149232"></a>
          <p class="title">
            <strong>Example 671. Example of the pvsmorph 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>
-odac
<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="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="comment">;; example written by joachim heintz 2009</span>
<span class="comment">; this example uses the files "flute-C-octave0.wav" and</span>
<span class="comment">; "saxophone-alto-C-octave0.wav" from www.archive.org/details/OpenPathMusic44V2</span>

giSine		<span class="ohdr">ftgen</span>		0, 0, 4096, 10, 1

<span class="oblock">instr</span> 1
iampint1	<span class="op">=</span>		p4<span class="comment">; value for interpolating the amplitudes at the beginning ...</span>
iampint2	<span class="op">=</span>		p5<span class="comment">; ... and at the end</span>
ifrqint1	<span class="op">=</span>		p6<span class="comment">; value for unterpolating the frequencies at the beginning ...</span>
ifrqint2	<span class="op">=</span>		p7<span class="comment">; ... and at the end</span>
kampint	<span class="opc">linseg</span>		iampint1, p3, iampint2
kfrqint	<span class="opc">linseg</span>		ifrqint1, p3, ifrqint2
ifftsize	<span class="op">=</span>		1024
ioverlap	<span class="op">=</span>		ifftsize <span class="op">/</span> 4
iwinsize	<span class="op">=</span>		ifftsize
iwinshape	<span class="op">=</span>		1<span class="comment">; von-Hann window</span>
Sfile1		<span class="op">=</span>		"flute<span class="op">-</span>C<span class="op">-</span>octave0.wav"
Sfile2		<span class="op">=</span>		"saxophone<span class="op">-</span>alto<span class="op">-</span>C<span class="op">-</span>octave0.wav"
ain1		<span class="opc">soundin</span>	Sfile1
ain2		<span class="opc">soundin</span>	Sfile2
fftin1		<span class="opc">pvsanal</span>	ain1, ifftsize, ioverlap, iwinsize, iwinshape
fftin2		<span class="opc">pvsanal</span>	ain2, ifftsize, ioverlap, iwinsize, iwinshape
fmorph		<span class="opc">pvsmorph</span>	fftin1, fftin2, kampint, kfrqint
aout		<span class="opc">pvsynth</span>	fmorph
		<span class="opc">out</span>		aout <span class="op">*</span> .5
<span class="oblock">endin</span>

<span class="oblock">instr</span> 2<span class="comment">; moving randomly in certain borders between two spectra</span>
iampintmin	<span class="op">=</span>		p4<span class="comment">; minimum value for amplitudes</span>
iampintmax	<span class="op">=</span>		p5<span class="comment">; maximum value for amplitudes</span>
ifrqintmin	<span class="op">=</span>		p6<span class="comment">; minimum value for frequencies</span>
ifrqintmax	<span class="op">=</span>		p7<span class="comment">; maximum value for frequencies</span>
imovefreq	<span class="op">=</span>		p8<span class="comment">; frequency for generating new random values</span>
kampint	<span class="opc">randomi</span>	iampintmin, iampintmax, imovefreq
kfrqint	<span class="opc">randomi</span>	ifrqintmin, ifrqintmax, imovefreq
ifftsize	<span class="op">=</span>		1024
ioverlap	<span class="op">=</span>		ifftsize <span class="op">/</span> 4
iwinsize	<span class="op">=</span>		ifftsize
iwinshape	<span class="op">=</span>		1<span class="comment">; von-Hann window</span>
Sfile1		<span class="op">=</span>		"flute<span class="op">-</span>C<span class="op">-</span>octave0.wav"
Sfile2		<span class="op">=</span>		"saxophone<span class="op">-</span>alto<span class="op">-</span>C<span class="op">-</span>octave0.wav"
ain1		<span class="opc">soundin</span>	Sfile1
ain2		<span class="opc">soundin</span>	Sfile2
fftin1		<span class="opc">pvsanal</span>	ain1, ifftsize, ioverlap, iwinsize, iwinshape
fftin2		<span class="opc">pvsanal</span>	ain2, ifftsize, ioverlap, iwinsize, iwinshape
fmorph		<span class="opc">pvsmorph</span>	fftin1, fftin2, kampint, kfrqint
aout		<span class="opc">pvsynth</span>	fmorph
		<span class="opc">out</span>		aout <span class="op">*</span> .5
<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 3 0 0 1 1<span class="comment">; amplitudes from flute, frequencies from saxophone</span>
<span class="stamnt">i</span> 1 3 3 1 1 0 0<span class="comment">; amplitudes from saxophone, frequencies from flute</span>
<span class="stamnt">i</span> 1 6 3 0 1 0 1<span class="comment">; amplitudes and frequencies moving from flute to saxophone </span>
<span class="stamnt">i</span> 1 9 3 1 0 1 0<span class="comment">; amplitudes and frequencies moving from saxophone to flute</span>
<span class="stamnt">i</span> 2 12 3 .2 .8 .2 .8 5<span class="comment">; amps and freqs moving randomly between the two spectra</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" />
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp39151512"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>,
      <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>,
      <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp39153488"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>April 2007 </td>
          </tr>
        </table>
        <p>
      New in Csound 5.06
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pvsmix.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="pvsmooth.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pvsmix </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pvsmooth</td>
        </tr>
      </table>
    </div>
  </body>
</html>