JSFX - CookDSP version 0.5 documentation



BIQUAD

A sweepable general purpose biquadratic digital filter.

Description

The biquad object initializes a second-order IIR general purpose biquadratic digital filter. It takes the cutoff frequency freq, in Hz, the quality factor q (as freq / bandwidth) and the filter's type type, as argument.
It must be used with a variable name as prefix (object oriented).

Initializer

biquad(freq, q, type)

Initializes a second-order IIR general purpose biquadratic digital filter. It takes the cutoff frequency freq, in Hz, the quality factor q (as freq / bandwidth) and the filter's type type, as argument. Possible types are:
- 0 : lowpass
- 1 : highpass
- 2 : bandpass
- 3 : bandstop
- 4 : allpass

Methods

biquad_set_freq(freq)

Sets a new cutoff frequency freq, in Hz.

biquad_set_q(q)

Sets a new quality factor q (as freq / bandwidth).

biquad_set_type(type)

Sets a new filter's type. Possible types are:
- 0 : lowpass
- 1 : highpass
- 2 : bandpass
- 3 : bandstop
- 4 : allpass

biquad_do(signal)

Processes one samples of an input signal signal and outputs the filtered sample.

Example

desc:Resonant Multi-type Filter

import cookdsp.jsfx-inc

slider1:3500<100,10000>Cutoff Frequency In Hz
slider2:5<1,100>Quality Factor (Q)
slider3:0<0,4,1{lowpass,highpass,bandpass,bandstop,allpass}>Filter Type

@init
// Initializes the filter
filt1.biquad(slider1, slider2, slider3);
filt2.biquad(slider1, slider2, slider3);

@slider
filt1.biquad_set_freq(slider1);
filt2.biquad_set_freq(slider1);
filt1.biquad_set_q(slider2);
filt2.biquad_set_q(slider2);
filt1.biquad_set_type(slider3);
filt2.biquad_set_type(slider3);

@sample
// Filters the input signal
spl0 = filt1.biquad_do(spl0);
spl1 = filt2.biquad_do(spl1);

Download example : cookdsp_biquad

See the source file : filters.jsfx-inc

(c) Olivier BĂ©langer, 2020