Biquadratic (Second Order IIR) Filter
Description
Filters its inputs by a second order IIR filter controlled by a set of five coefficients
(make-controller 'biquadratic-filter ... )
Lisp Syntax and Default Values
The 'biquadratic-filter controller can be created using the following Lisp syntax:
(make-controller 'biquadratic-filter dimension period coef_controller input_controller)
Parameters
The 'biquadratic-filter controller takes four 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.
- coef_controller: a five-dimensional controller specifying the three bilinear filter coefficients.
- input_controller: filter input (a controller).
The number of dimensions should be the same as that of the input controller.
The coefficient controller should have 5 dimensions which represent the a0, a1, a2, b1 and b2 coefficients.
Discussion
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))
Options
There are no special options for this controller.