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

lowpass2


  ar      lowpass2   asig, kcf, kq[, iskip]


Description

Implementation of resonant second-order lowpass filter.

Initialization

iskip – initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.

Performance

asig – input signal to be filtered

kcf – cutoff or resonant frequency of the filter, measured in Hz

kq – Q of the filter, defined, for bandpass filters, as bandwidth/cutoff. kq should be between 1 and 500

lowpass2 is a second order IIR lowpass filter, with k-rate controls for cutoff frequency (kcf) and Q (kq). As kq is increased, a resonant peak forms around the cutoff frequency, transforming the lowpass filter response into a response that is similar to a bandpass filter, but with more low frequency energy. This corresponds to an increase in the magnitude and "sharpness" of the resonant peak. For high values of kq, a scaling function such as balance may be required. In practice, this allows for the simulation of the voltage-controlled filters of analog synthesizers, or for the creation of a pitch of constant amplitude while filtering white noise.

Example


; Orchestra file for resonant filter sweep of a sawtooth-like waveform.

  sr      = 44100

  kr      = 2205

  ksmps   = 20

  nchnls  = 1



          instr 1



  idur    =          p3

  ifreq   =          p4

  iamp    =          p5 * .5

  iharms  =          (sr*.4) / ifreq



; Sawtooth-like waveform

  asig    gbuzz      1, ifreq, iharms, 1, .9, 1



; Envelope to control filter cutoff 

  kfreq   linseg     1, idur * 0.5, 5000, idur * 0.5, 1



  afilt   lowpass2   asig, kfreq, 30



; Simple amplitude envelope

  kenv    linseg     0, .1, iamp, idur -.2, iamp, .1, 0 

          out        asig * kenv



          endin





; Score file for above

  f1 0 8192 9 1 1 .25



  i1 0 5 100 1000

  i1 5 5 200 1000

  e

Author

Sean Costello
Seattle, Washington August, 1999
New in Csound version 4.0


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