Skip to content

Variable Second Order (Bandpass) Filter


Filters its inputs by a second order IIR filter with a variable center frequency and bandwidth.

Syntax and Default Values

The variable-second-order-filter controller can be created using the following Lisp or Lua syntax:

(make-controller 'variable-second-order-filter
-- not implemented in Lua yet!


The 'variable-second-order-filter controller takes five arguments:

  • dimension: number of dimensions of the input and output controllers.
  • period: the time between the updates of the controller. If zero is given then it updates every sample.
  • input_controller: filter input (a controller).
  • cf-controller: controller specifying the center frequency in Hz.
  • bw-controller: controller specifying the bandwidth in Hz.

The number of dimensions should be the same as that of the input controller.

The center frequency and bandwidth parameters should both be controllers. Note that there is no amplitude controller for this filter. Amplitude gain is internally set to 1, but resonances caused by very narrow bandwidths could result in very high amplitude values.


The variable second order (bandpass) filter can be used for a variety of purposes, but generally is used either to smooth out envelopes or create resonances from impulses. Using a low frequency and fairly wide bandwidth, it can smooth out envelopes (a graph of this example is shown in the image, above):

(setq my-env (make-controller 'envelope 1 '((0 0.0) (0.1 1.0) (1.4 1) (1.5 0)) ))
(setq my-filtered-env (make-controller 'variable-second-order-filter 1 0 my-env (const 1) (const 5)))
Or it can be used to add a resonance to an impulse or other noisy sound, by using a specific frequency and a very narrow bandwidth:

(setq my-noise (make-controller 'noise 1 0 (list (const 44100) (const 0.25) (const 0.25) (const 1) (const 1)) 10))
(setq my-filtered-noise (make-controller 'variable-second-order-filter 1 0 my-noise (const 440) (const 1)))
We actually recommend using the more general-purpose 'biquadratic-filter controller instead of this older filter. However, to do so you will need to generate your own filter coefficients (whereas this filer lets you use higher-level parameters like frequency and bandwidth).

★     ★