phaser2
Second-order allpass filters arranged in a series.
Syntax
Initialization
iskip (optional, default=0) -- zero clears the filter history and feedback. A nonzero value keeps them on reinitialization.
Performance
kfreq -- frequency in Hz of the first allpass stage. The other stage frequencies depend on kmode and ksep.
kq -- 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.
kord -- number of second-order allpass stages in series. Use a positive integer. More stages require more computation.
kfeedback -- 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. kfeedback must be between -1 and +1. for stability.
kmode -- used in calculation of notch frequencies.
Note
Although kord and kmode 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 init.
ksep -- spacing factor used with kmode to set the frequencies of the later stages.
phaser2 connects kord second-order allpass stages in series. With fixed controls and zero feedback, the chain changes phase while keeping a flat magnitude response. Mix the output with the input to create notches in the spectrum, as shown below.
There are two modes for setting the stage frequencies. When kmode = 1, stage N (counting from 1) uses:
For example, with kmode = 1, ksep = 1, and kfreq = 100, the first four stages use 100, 200, 300, and 400 Hz. Vary ksep to change their spacing.
When kmode = 2, stage N uses kfreq * ksep^(N - 1). For example, the following lines space eight stages an octave apart and mix the result with the input:
Use a positive ksep in mode 2. Values above 1 raise the frequency of each later stage; values between 0 and 1 lower it.
Examples
Here is an example of the phaser2 opcode. It uses the file phaser2.csd.
Technical History
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.
References
- Hartmann, W.M. "Flanging and Phasers." Journal of the Audio Engineering Society, Vol. 26, No. 6, pp. 439-443, June 1978.
- 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.
- Cronin, Dennis. "Examining Audio DSP Algorithms." Dr. Dobb's Journal, July 1994, p. 78-83.
- Chamberlin, Hal. Musical Applications of Microprocessors. Second edition. Indianapolis, Indiana: Hayden Books, 1985.
- Smith, Julius O. "An Allpass Approach to Digital Phasing and Flanging." Proceedings of the 1984 ICMC, p. 103-108.
See also
Credits
Author: Sean Costello
Seattle, Washington
1999
November 2002. Added a note about the kord and kmode parameters, thanks to Rasmus Ekman.
New in Csound version 4.0