Sophie

Sophie

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

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>phaser2</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="phaser1.html" title="phaser1" />
    <link rel="next" href="phasor.html" title="phasor" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">phaser2</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="phaser1.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="phasor.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="phaser2">
      <a id="phaser2"></a>
      <div class="titlepage"></div>
      <a id="IndexPhaser2" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">phaser2</span>
        </h2>
        <p>phaser2 — 
      Second-order allpass filters arranged in a series.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp36120304"></a>
        <h2>Description</h2>
        <p>
      An implementation of <span class="emphasis"><em>iord</em></span> number of second-order allpass filters in series.
   </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp36114264"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>phaser2</strong></span> asig, kfreq, kq, kord, kmode, ksep, kfeedback</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp36115392"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kfreq</em></span> -- frequency (in Hz) of the filter(s). This is the center frequency of the notch of the first allpass filter in the series. This frequency is used as the base frequency from which the frequencies of the other notches are derived.
    </p>
        <p>
      <span class="emphasis"><em>kq</em></span> -- Q of each notch. Higher Q values result in narrow notches. A Q between 0.5 and 1 results in the strongest "phasing" effect, but higher Q values can be used for special effects.
    </p>
        <p>
      <span class="emphasis"><em>kord</em></span> -- the number of allpass stages in series. These are second-order filters, and iord can range from 1 to 2499. With higher orders, the computation time increases.
    </p>
        <p>
      <span class="emphasis"><em>kfeedback</em></span> -- amount of the output which is fed back into the input of the allpass chain. With larger amounts of feedback, more prominent notches appear in the spectrum of the output. <span class="emphasis"><em>kfeedback</em></span> must be between -1 and +1. for stability.
    </p>
        <p>
      <span class="emphasis"><em>kmode</em></span> -- used in calculation of notch frequencies.
    </p>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        Although <span class="emphasis"><em>kord</em></span> and <span class="emphasis"><em>kmode</em></span> are listed as k-rate, they are in fact accessed only at init-time. So if you are using k-rate arguments, they must be assigned with <a class="link" href="init.html" title="init"><em class="citetitle">init</em></a>.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      <span class="emphasis"><em>ksep</em></span> -- scaling factor used, in conjunction with <span class="emphasis"><em>imode</em></span>, to determine the frequencies of the additional notches in the output spectrum.
    </p>
        <p>
      <span class="emphasis"><em>phaser2</em></span> implements <span class="emphasis"><em>iord</em></span> number of second-order allpass sections, connected in series. The use of second-order allpass sections allows for the precise placement of the frequency, width, and depth of notches in the frequency spectrum. <span class="emphasis"><em>iord</em></span> is used to directly determine the number of notches in the spectrum; e.g. for <span class="emphasis"><em>iord</em></span> = 6, there will be 6 notches in the output spectrum.
    </p>
        <p>
      There are two possible modes for determining the notch frequencies. When <span class="emphasis"><em>imode</em></span> = 1, the notch frequencies are determined by the following function:
      </p>
        <div class="literallayout">
          <p><br />
frequency of notch N = kbf + (ksep * kbf * N-1)</p>
        </div>
        <p>
    </p>
        <p>
      For example, with <span class="emphasis"><em>imode</em></span> = 1 and <span class="emphasis"><em>ksep</em></span> = 1, the notches will be in harmonic relationship with the notch frequency determined by <span class="emphasis"><em>kfreq</em></span> (i.e. if there are 8 notches, with the first at 100 Hz, the next notches will be at 200, 300, 400, 500, 600, 700, and 800 Hz). This is useful for generating a "comb filtering" effect, with the number of notches determined by <span class="emphasis"><em>iord</em></span>. Different values of <span class="emphasis"><em>ksep</em></span> allow for inharmonic notch frequencies and other special effects. <span class="emphasis"><em>ksep</em></span> can be swept to create an expansion or contraction of the notch frequencies. A useful visual analogy for the effect of sweeping <span class="emphasis"><em>ksep</em></span> would be the bellows of an accordion as it is being played - the notches will be seperated, then compressed together, as <span class="emphasis"><em>ksep</em></span> changes.
    </p>
        <p>
      When <span class="emphasis"><em>imode</em></span> = 2, the subsequent notches are powers of the input parameter <span class="emphasis"><em>ksep</em></span> times the initial notch frequency specified by <span class="emphasis"><em>kfreq</em></span>. This can be used to set the notch frequencies to octaves and other musical intervals. For example, the following lines will generate 8 notches in the output spectrum, with the notches spaced at octaves of <span class="emphasis"><em>kfreq</em></span>:
      </p>
        <div class="literallayout">
          <p><br />
aphs    <span class="emphasis"><em>phaser2</em></span>    ain, kfreq, 0.5, 8, 2, 2, 0<br />
aout    <span class="emphasis"><em>=</em></span>          ain + aphs<br />
      </p>
        </div>
        <p>
    </p>
        <p>
      When <span class="emphasis"><em>imode</em></span> = 2, the value of <span class="emphasis"><em>ksep</em></span> must be greater than 0. <span class="emphasis"><em>ksep</em></span> can be swept to create a compression and expansion of notch frequencies (with more dramatic effects than when <span class="emphasis"><em>imode</em></span> = 1).
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp36190272"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the phaser2 opcode. It uses the file <a class="ulink" href="examples/phaser2.csd" target="_top"><em class="citetitle">phaser2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp36191248"></a>
          <p class="title">
            <strong>Example 587. Example of the phaser2 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    No messages</span>
-odac           -iadc     -d     <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 phaser2.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">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="oblock">instr</span> 2              <span class="comment">; demonstration of phase shifting abilities of phaser2. </span>
  <span class="comment">; Input mixed with output of phaser2 to generate notches. </span>
  <span class="comment">; Demonstrates the interaction of imode and ksep.</span>
  idur   <span class="op">=</span> p3 
  iamp   <span class="op">=</span> p4 <span class="op">*</span> .04
  iorder <span class="op">=</span> p5        <span class="comment">; number of 2nd-order stages in phaser2 network</span>
  ifreq  <span class="op">=</span> p6        <span class="comment">; not used</span>
  ifeed  <span class="op">=</span> p7        <span class="comment">; amount of feedback for phaser2</span>
  imode  <span class="op">=</span> p8        <span class="comment">; mode for frequency scaling</span>
  isep   <span class="op">=</span> p9        <span class="comment">; used with imode to determine notch frequencies</span>
  kamp   <span class="opc">linseg</span> 0, .2, iamp, idur <span class="op">-</span> .2, iamp, .2, 0
  iharms <span class="op">=</span> (<span class="ohdr">sr</span><span class="op">*</span>.4) <span class="op">/</span> 100

  <span class="comment">; "Sawtooth" waveform exponentially decaying function, to control notch frequencies</span>
  asig   <span class="opc">gbuzz</span> 1, 100, iharms, 1, .95, 2  
  kline  <span class="opc">expseg</span> 1, idur, .005
  aphs   <span class="opc">phaser2</span> asig, kline <span class="op">*</span> 2000, .5, iorder, imode, isep, ifeed

  <span class="opc">out</span> (asig <span class="op">+</span> aphs) <span class="op">*</span> iamp
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; cosine wave for gbuzz</span>
<span class="stamnt">f</span>2 0  8192 9 1 1 .25     

<span class="comment">; phaser2, imode=1</span>
<span class="stamnt">i</span>2 00 10 7000 8 .2 .9 1 .33
<span class="stamnt">i</span>2 11 10 7000 8 .2 .9 1 2 

<span class="comment">; phaser2, imode=2</span>
<span class="stamnt">i</span>2 22 10 7000 8 .2 .9 2 .33
<span class="stamnt">i</span>2 33 10 7000 8 .2 .9 2 2
<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="Technical History">
        <a id="idp36193528"></a>
        <h2>Technical History</h2>
        <p>
      A general description of the differences between flanging and phasing can be found in Hartmann [1]. An early implementation of first-order allpass filters connected in series can be found in Beigel [2], where the bilinear z-transform is used for determining the phase shift frequency of each stage. Cronin [3] presents a similar implementation for a four-stage phase shifting network. Chamberlin [4] and Smith [5] both discuss using second-order allpass sections for greater control over notch depth, width, and frequency.
    </p>
      </div>
      <div class="refsect1" title="References">
        <a id="idp36194648"></a>
        <h2>References</h2>
        <p>
      </p>
        <div class="orderedlist">
          <ol class="orderedlist" type="1">
            <li class="listitem">
              <p>
            Hartmann, W.M. "Flanging and Phasers." Journal of the Audio Engineering Society, Vol. 26, No. 6, pp. 439-443, June 1978. 
          </p>
            </li>
            <li class="listitem">
              <p>
            Beigel, Michael I. "A Digital 'Phase Shifter' for Musical Applications, Using the Bell Labs (Alles-Fischer) Digital Filter Module." Journal of the Audio Engineering Society, Vol. 27, No. 9, pp. 673-676,September 1979. 
          </p>
            </li>
            <li class="listitem">
              <p>
            Cronin, Dennis. "Examining Audio DSP Algorithms." Dr. Dobb's Journal, July 1994, p. 78-83.
          </p>
            </li>
            <li class="listitem">
              <p>
            Chamberlin, Hal. Musical Applications of Microprocessors. Second edition. Indianapolis, Indiana: Hayden Books, 1985.
          </p>
            </li>
            <li class="listitem">
              <p>
            Smith, Julius O. "An Allpass Approach to Digital Phasing and Flanging." Proceedings of the 1984 ICMC, p. 103-108.
          </p>
            </li>
          </ol>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp36198808"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="phaser1.html" title="phaser1"><em class="citetitle">phaser1</em></a>
      </p>
        <p> Other information about phasers on Wikipedia: <a class="ulink" href="http://en.wikipedia.org/wiki/Phaser_(effect)" target="_top"><em class="citetitle">http://en.wikipedia.org/wiki/Phaser_(effect)</em></a></p>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp36200536"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Sean Costello</td>
          </tr>
          <tr>
            <td>Seattle, Washington</td>
          </tr>
          <tr>
            <td>1999</td>
          </tr>
        </table>
        <p>
    </p>
        <p>November 2002. Added a note about the <span class="emphasis"><em>kord</em></span> and <span class="emphasis"><em>kmode</em></span> parameters, thanks to Rasmus Ekman.</p>
        <p>New in Csound version 4.0</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="phaser1.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="phasor.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">phaser1 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> phasor</td>
        </tr>
      </table>
    </div>
  </body>
</html>