<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="pvsmaska">
  <refmeta>
    <refentrytitle>pvsmaska</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>pvsmaska</refname>
    <refpurpose>
      Modify amplitudes using a function table, with dynamic scaling.
      <indexterm id="IndexPvsmaska"><primary>pvsmaska</primary></indexterm>
    </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para>
      Modify amplitudes of fsrc using  function table, with dynamic scaling.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis>fsig <command>pvsmaska</command> fsrc, ifn, kdepth</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifn</emphasis> -- 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 <link linkend="pvsinfo"><citetitle>pvsinfo</citetitle></link> to find the size of fsrc, (returned by pvsinfo in inbins), which can then be passed to ftgen to create the f-table.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>kdepth</emphasis> -- Controls the degree of modification applied to fsrc, using simple linear scaling. 0 leaves amplitudes unchanged, 1 applies the full profile of ifn.
    </para>

    <para>
      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.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      <example>
        <title>Example (using score-supplied f-table, assuming fsig  fftsize = 1024)</title>
        <programlisting>
; score f-table using cubic spline to define shaped peaks
f1 0 513 8 0 2 1 3 0 4 1 6 0 10 1 12 0 16 1 32 0 1 0 436 0
 
asig  buzz     20000,199,50,3        ; pulsewave source
fsig  pvsanal  asig,1024,256,1024,0  ; create fsig
kmod  linseg   0,p3/2,1,p3/2,0       ; simple control sig
 
fsig  pvsmaska fsig,2,kmod           ; apply weird eq to fsig
aout  pvsynth  fsig                  ; resynthesize,
      dispfft  aout,0.1,1024         ; and view the effect
        </programlisting>
      </example>

      This also illustrates that the usual Csound behaviour applies to fsigs; the same name can be used for both input and output.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: &namerichard;</member>
        <member>August 2001 </member>
      </simplelist>
    </para>

    <para>New in version 4.13</para>
  </refsect1>
</refentry>
