| 1 | |
| 2 | <refentry id="phaser1"> |
| 3 | <indexterm id="IndexPhaser1"><primary>phaser1</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Special Effects</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>phaser1</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>phaser1</refname> |
| 13 | <refpurpose> |
| 14 | First-order allpass filters arranged in a series. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | An implementation of <emphasis>iord</emphasis> number of first-order allpass filters in series. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ares <command>phaser1</command> asig, kfreq, kord, kfeedback [, iskip]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>iskip</emphasis> (optional, default=0) -- used to control initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0. |
| 34 | </para> |
| 35 | </refsect1> |
| 36 | |
| 37 | <refsect1> |
| 38 | <title>Performance</title> |
| 39 | <para> |
| 40 | <emphasis>kfreq</emphasis> -- frequency (in Hz) of the filter(s). This is the frequency at which each filter in the series shifts its input by 90 degrees. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | <emphasis>kord</emphasis> -- the number of allpass stages in series. These are first-order filters and can range from 1 to 4999. |
| 45 | </para> |
| 46 | |
| 47 | <note> |
| 48 | <title>Note</title> |
| 49 | <para> |
| 50 | Although <emphasis>kord</emphasis> is listed as k-rate, it is in fact accessed only at init-time. So if you are using a k-rate argument, it must be assigned with <link linkend="init"><citetitle>init</citetitle></link>. |
| 51 | </para> |
| 52 | </note> |
| 53 | |
| 54 | <para> |
| 55 | <emphasis>kfeedback</emphasis> -- 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. <emphasis>kfeedback</emphasis> must be between -1 and +1. for stability. |
| 56 | </para> |
| 57 | |
| 58 | <para> |
| 59 | <emphasis>phaser1</emphasis> implements <emphasis>iord</emphasis> number of first-order allpass sections, serially connected, all sharing the same coefficient. Each allpass section can be represented by the following difference equation: |
| 60 | <literallayout> |
| 61 | y(n) = C * x(n) + x(n-1) - C * y(n-1) |
| 62 | </literallayout> |
| 63 | where x(n) is the input, x(n-1) is the previous input, y(n) is the output, y(n-1) is the previous output, and C is a coefficient which is calculated from the value of <emphasis>kfreq</emphasis>, using the bilinear z-transform. |
| 64 | </para> |
| 65 | |
| 66 | <para> |
| 67 | By slowly varying <emphasis>kfreq</emphasis>, and mixing the output of the allpass chain with the input, the classic "phase shifter" effect is created, with notches moving up and down in frequency. This works best with <emphasis>iord</emphasis> between 4 and 16. When the input to the allpass chain is mixed with the output, 1 notch is generated for every 2 allpass stages, so that with <emphasis>iord</emphasis> = 6, there will be 3 notches in the output. With higher values for <emphasis>iord</emphasis>, modulating <emphasis>kfreq</emphasis> will result in a form of nonlinear pitch modulation. |
| 68 | </para> |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Examples</title> |
| 73 | <para> |
| 74 | Here is an example of the phaser1 opcode. It uses the file <ulink url="examples/phaser1.csd"><citetitle>phaser1.csd</citetitle></ulink>. |
| 75 | |
| 76 | <example> |
| 77 | <title>Example of the phaser1 opcode.</title> |
| 78 | |
| 79 | |
| 80 | |
| 81 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 82 | <xi:include href="examples-xml/phaser1.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 83 | </example> |
| 84 | </para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>Technical History</title> |
| 89 | <para> |
| 90 | 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. |
| 91 | </para> |
| 92 | </refsect1> |
| 93 | |
| 94 | <refsect1> |
| 95 | <title>References</title> |
| 96 | <para> |
| 97 | <orderedlist> |
| 98 | <listitem> |
| 99 | <para> |
| 100 | Hartmann, W.M. "Flanging and Phasers." Journal of the Audio Engineering Society, Vol. 26, No. 6, pp. 439-443, June 1978. |
| 101 | </para> |
| 102 | </listitem> |
| 103 | |
| 104 | <listitem> |
| 105 | <para> |
| 106 | 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. |
| 107 | </para> |
| 108 | </listitem> |
| 109 | |
| 110 | <listitem> |
| 111 | <para> |
| 112 | Cronin, Dennis. "Examining Audio DSP Algorithms." Dr. Dobb's Journal, July 1994, p. 78-83. |
| 113 | </para> |
| 114 | </listitem> |
| 115 | |
| 116 | <listitem> |
| 117 | <para> |
| 118 | Chamberlin, Hal. Musical Applications of Microprocessors. Second edition. Indianapolis, Indiana: Hayden Books, 1985. |
| 119 | </para> |
| 120 | </listitem> |
| 121 | |
| 122 | <listitem> |
| 123 | <para> |
| 124 | Smith, Julius O. "An Allpass Approach to Digital Phasing and Flanging." Proceedings of the 1984 ICMC, p. 103-108. |
| 125 | </para> |
| 126 | </listitem> |
| 127 | </orderedlist> |
| 128 | </para> |
| 129 | </refsect1> |
| 130 | |
| 131 | <refsect1> |
| 132 | <title>See also</title> |
| 133 | <para><link linkend="SigmodSpeciale"><citetitle>Special Effects</citetitle></link></para> |
| 134 | </refsect1> |
| 135 | |
| 136 | <refsect1> |
| 137 | <title>Credits</title> |
| 138 | <para> |
| 139 | <simplelist> |
| 140 | <member>Author: &namesean;</member> |
| 141 | <member>Seattle, Washington</member> |
| 142 | <member>1999</member> |
| 143 | </simplelist> |
| 144 | </para> |
| 145 | |
| 146 | <para>November 2002. Added a note about the <emphasis>kord</emphasis> parameter, thanks to &namerasmus;.</para> |
| 147 | <para>New in Csound version 4.0</para> |
| 148 | </refsect1> |
| 149 | </refentry> |