Skip to content

Biquadratic (Second Order IIR) Filter


Filters its inputs by a second order IIR filter controlled by a set of five coefficients

Syntax and Default Values

The biquadratic-filter controller can be created using the following Lisp or mlys.lua (in Modalys for Max) syntax:

(make-controller 'biquadratic-filter
This controller takes 3 parameters.

The dimension parameter must be the same as the input controller's dimension.

                          input=<controller of any dimension>,

The dimension is automatically the same as the input controller.
The coefficients parameter can be a 5-dimensional controller, but if passed as a table of 5 values, it can be changed dynamically via Max messages with MyBiquadraticFilter@coefficients


  • dimension: number of dimensions of the input and output controllers.
  • coefficients: a 5-dimensional controller specifying the 5 bilinear filter coefficients.
  • input: filter input (a controller, possibly multi-dimensional). The coefficients controller should have 5 dimensions which represent the a0, a1, a2, b1 and b2 coefficients.
    This controller is updated at every sample (period = 0).


This filter implements a general second-order (two-pole two-zero) filter which can be used for a variety of purposes, including smoothing out envelopes, and filtering sound-file, signal or other controllers. The following example is shown in one of the graphs (with a 1 Hz cutoff) in the above image:

(setq sp (get-info 'sample-period))
(setq my-env (make-controller 'envelope 1 
         (list '(0 0.0) '(0.1 0) (list (+ 0.1 sp) 1) '(1.5 1) (list (+ 1.5 sp) 0)) ))
(setq cutoff 1)
(setq Q 0.707)
(setq w0 (* cutoff 2 pi sp))
(setq alpha (/ (sin w0) (* 2 Q)))
(setq cw (cos w0))
(setq b0 (/ 1 (+ 1 alpha)))
(setq a0 (* b0 (- 1 cw) 0.5))
(setq a1 (* b0 (- 1 cw)))
(setq a2 a0)
(setq b1 (* b0 (* -2 cw)))
(setq b2 (* b0 (- 1 alpha)))
(setq my-filtered-env (make-controller 'biquadratic-filter 1 (const a0 a1 a2 b1 b2) my-env))
You should probably consider using it or the bilinear-filter, instead of the older filtering functions (because you can design any type of filter you want). However, you will first need to generate your own sets of coefficients from higher level parameters such as center/cutoff frequency, etc....

★     ★