<?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>pvsmaska</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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="pvslock.html" title="pvslock" /> <link rel="next" href="pvsmix.html" title="pvsmix" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">pvsmaska</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="pvslock.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="pvsmix.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="pvsmaska"></a> <div class="titlepage"></div> <a id="IndexPvsmaska" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">pvsmaska</span> </h2> <p>pvsmaska — Modify amplitudes using a function table, with dynamic scaling. </p> </div> <div class="refsect1"> <a id="idm281472898450632"></a> <h2>Description</h2> <p> Modify amplitudes of fsrc using function table, with dynamic scaling. </p> </div> <div class="refsect1"> <a id="idm281472898449352"></a> <h2>Syntax</h2> <pre class="synopsis">fsig <span class="command"><strong>pvsmaska</strong></span> fsrc, ifn, kdepth</pre> </div> <div class="refsect1"> <a id="idm281472898447144"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ifn</em></span> -- The f-table to use. Given fsrc has N analysis bins, table ifn must be of size N or larger. The table need not be normalized, but values should lie within the range 0 to 1. It can be supplied from the score in the usual way, or from within the orchestra by using <a class="link" href="pvsinfo.html" title="pvsinfo"><em class="citetitle">pvsinfo</em></a> to find the size of fsrc, (returned by pvsinfo in inbins), which can then be passed to ftgen to create the f-table. </p> </div> <div class="refsect1"> <a id="idm281472898382600"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kdepth</em></span> -- Controls the degree of modification applied to fsrc, using simple linear scaling. 0 leaves amplitudes unchanged, 1 applies the full profile of ifn. </p> <p> Note that power-of-two FFT sizes are particularly convenient when using table-based processing, as the number of analysis bins (inbins) is then a power-of-two plus one, for which an exactly matching f-table can be created. In this case it is important that the f-table be created with a size of inbins, rather than as a power of two, as the latter will copy the first table value to the guard point, which is inappropriate for this opcode. </p> <div class="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"> <a id="idm281472898378968"></a> <h2>Examples</h2> <p> Here is an example of the use of the <span class="emphasis"><em>pvsmaska</em></span> opcode. It uses the file <a class="ulink" href="examples/pvsmaska.csd" target="_top"><em class="citetitle">pvsmaska.csd</em></a>. </p> <div class="example"> <a id="idm281472898376712"></a> <p class="title"> <strong>Example 772. Example of the <span class="emphasis"><em>pvsmaska</em></span> 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> <div class="refsect1"> <a id="idm281472719494680"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> -odac <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">16</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">1</span> <span class="vg">0dbfs</span> <span class="o">=</span> <span class="mi">1</span> <span class="c1">;; example written by joachim heintz 2009</span> <span class="c1">; function table for defining amplitude peaks (from the example of Richard Dobson)</span> gi<span class="n">Tab</span> <span class="nb">ftgen</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">513</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">12</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">16</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">32</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">436</span><span class="p">,</span> <span class="mi">0</span> <span class="kd">instr</span> <span class="nf">1</span> i<span class="n">mod</span> <span class="o">=</span> <span class="nb">p4</span><span class="c1">; degree of midification (0-1)</span> i<span class="n">fftsize</span> <span class="o">=</span> <span class="mi">1024</span> i<span class="n">overlap</span> <span class="o">=</span> i<span class="n">fftsize</span> <span class="o">/</span> <span class="mi">4</span> i<span class="n">winsize</span> <span class="o">=</span> i<span class="n">fftsize</span> i<span class="n">winshape</span> <span class="o">=</span> <span class="mi">1</span><span class="c1">; von-Hann window</span> S<span class="n">file</span> <span class="o">=</span> <span class="s">"fox.wav"</span> a<span class="n">in</span> <span class="nb">soundin</span> S<span class="n">file</span> <span class="n">fftin</span> <span class="nb">pvsanal</span> a<span class="n">in</span><span class="p">,</span> i<span class="n">fftsize</span><span class="p">,</span> i<span class="n">overlap</span><span class="p">,</span> i<span class="n">winsize</span><span class="p">,</span> i<span class="n">winshape</span><span class="c1">; fft-analysis of file</span> <span class="n">fmask</span> <span class="nb">pvsmaska</span> <span class="n">fftin</span><span class="p">,</span> gi<span class="n">Tab</span><span class="p">,</span> i<span class="n">mod</span> a<span class="n">out</span> <span class="nb">pvsynth</span> <span class="n">fmask</span><span class="c1">; resynthesize</span> <span class="nb">out</span> a<span class="n">out</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mf">2.757</span> <span class="mi">0</span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">3</span> <span class="mf">2.757</span> <span class="mi">1</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472898371992"></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"> <a id="idm281472898368024"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Richard Dobson</td> </tr> <tr> <td>August 2001 </td> </tr> </table> <p> </p> <p>New in version 4.13</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="pvslock.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="pvsmix.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">pvslock </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> pvsmix</td> </tr> </table> </div> </body> </html>