Use Non-Frames Version Previous Page Next Page
Signal Modifiers: Standard Filters

biquad, biquada, rezzy, moogvcf


  ar      biquad     asig, kb0, kb1, kb2, ka0, ka1, ka2[, iskip]

  ar      biquada    asig, ab0, ab1, ab2, aa0, aa1, aa2[, iskip]

  ar      rezzy      asig, xfco, xres[, imode]

  ar      moogvcf    asig, xfco, xres[, iscale]


Description

Implementation of a sweepable general purpose filter and two sweepable, resonant low-pass filters.

Initialization

iskip (optional) – if non-zero, itialization will be skipped. Default value 0. (New in Csound version 3.50)

imode (optional) – if zero rezzy is low-pass, if nonzero, high-pass. Default value is 0. (New in Csound version 3.50)

iscale (optional) – internal scaling factor. Use if asig is not in the range +/-1. Input is first divided by iscale, then output is mutliplied iscale. Default value is 1. (New in Csound version 3.50)

Performance

asig – input signal

xfco – filter cut-off frequency in Hz. As of version 3.50, may i-,k-, or a-rate.

xres – amount of resonance. For rezzy, values of 1 to 100 are typical. Resonance should be one or greater. For moogvcf, self-oscillation occurs when xres is approximately one. As of version 3.50, may i-,k-, or a-rate.

biquad is a general purpose biquadratic digital filter of the form:


  a0*y(n) + a1*y[n-1] + a2*y[n-2] = b0*x[n] + b1*x[n-1] + b2*x[n-2]

This filter has the following frequency response:


         B(Z)   b0 + b1*Z-1  + b2*ZM-2 

  H(Z) = ---- = ------------------

         A(Z)   a0 + a1*Z-1  + a2*Z-2

This type of filter is often encountered in digital signal processing literature. It allows six user-defined k-rate coefficients. biquada is identical to biquad, with the exception that all its parameters can vary at a-rate. (New in Csound 4.15.)

rezzy is a resonant low-pass filter created empirically by Hans Mikelson.

moogvcf is a digital emulation of the Moog diode ladder filter configuration. This emulation is based loosely on the paper "Analyzing the Moog VCF with Considerations for Digital Implemnetation" by Stilson and Smith (CCRMA). This version was originally coded in Csound by Josep Comajuncosas. Some modifications and conversion to C were done by Hans Mikelson.

Note: This filter requires that the input signal be normalized to one.

Examples


;biquad example

  kfcon   =       *3.14159265*kfco/sr

  kalpha  =       -2*krez*cos(kfcon)*cos(kfcon)+krez*krez*cos(2*kfcon)

  kbeta   =       *krez*sin(2*kfcon)-2*krez*cos(kfcon)*sin(kfcon)

  kgama   =       +cos(kfcon)

  km1     =       *kgama+kbeta*sin(kfcon)

  km2     =       *kgama-kbeta*sin(kfcon)

  kden    =       (km1*km1+km2*km2)

  kb0     =       .5*(kalpha*kalpha+kbeta*kbeta)/kden

  kb1     =       kb0

  kb2     =       0

  ka0     =       1

  ka1     =       -2*krez*cos(kfcon)

  ka2     =       krez*krez

  ayn     biquad  axn, kb0, kb1, kb2, ka0, ka1, ka2

          outs    ayn*iamp/2, ayn*iamp/2

  

  ;   Sta  Dur  Amp    Pitch Fco   Rez

  i14 8.0  1.0  20000  6.00  1000  .8

  i14 +    1.0  20000  6.03  2000  .95

  

  

;rezzy example

  kfco     expseg  100+.01*ifco, .2*idur, ifco+100, .5*idur, ifco*.1+100, .3*idur, .001*ifco+100

  apulse1  buzz    1,ifqc, sr/2/ifqc, 1 ; Avoid aliasing

  asaw     integ   apulse1

  axn      =       asaw-.5

  ayn      rezzy   axn, kfco, krez

           outs    ayn*iamp, ayn*iamp

  

  ;    Sta  Dur  Amp    Pitch  Fco   Rez

  i10  0.0  1.0  20000  6.00   1000  2

  i10  +    1.0  20000  6.03   2000  10

  

  

;moogvcf example

  apulse1  buzz     1,ifqc, sr/2/ifqc, 1 ; Avoid aliasing

  asaw     integ    apulse1

  ax       =        asaw-.5

  ayn      moogvcf  ax, kfco, krez

           outs     ayn*iamp, ayn*iamp

  

  ;     Sta  Dur  Amp    Pitch  Fco   Rez

  i11   4.0  1.0  20000  6.00   1000  .4

  i11   +    1.0  20000  6.03   2000  .7

Author

Hans Mikelson
October 1998
New in Csound version 3.49


Use Non-Frames Version Previous Page Next Page
Signal Modifiers: Standard Filters