Skip to content

Constant Second Order (Bandpass) Filter

Description

Filters its inputs by a second order IIR filter with a constant center frequency, amplitude and bandwidth.

Syntax and Default Values

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

(make-controller 'constant-second-order-filter
                  dimension
                  period
                  input_controller
                  (list a1 a2 ... aN)
                  (list cf1 cf2 ... cfN)
                  (list bw1 bw2 ... bwN))
-- not implemented in Lua yet!

Parameters

The 'constant-second-order-filter controller takes the following 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).
  • aN: linear amplitude, N has to correspond to the given dimension.
  • cfN: center frequency in Hertz, N has to correspond to the given dimension.
  • bwN: bandwidth in Hertz, N has to correspond to the given dimension.

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

The amplitude, center frequency and bandwidth parameters cannot be varied in time.

Discussion

The constant 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:

(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 'constant-second-order-filter 1 0 my-env (list 1) (list 1) (list 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 'constant-second-order-filter 1 0 my-noise (list 1) (list 440) (list 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, amplitude and bandwidth).


★     ★