skf

skf — Sallen-Key filter.

Description

Skf is an digital implementation of a linear Sallen-Key analogue filter, which is a second-order filter with either lowpass or highpass responses.

Syntax

asig skf asig, xcf, xK[, ihp, istor]

Initialization

ihp -- if non-zero, select highpass response. Defaults to 0 (lowpass).

istor --initial disposition of internal data space. Since filtering incorporates a feedback loop of previous output, the initial status of the storage space used is significant. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.

Performance

asig -- input

xcf -- filter cutoff frequency (a- or k-rate)

xK -- Sallen-Key opamp gain, in the range 1 to 3. At 3 the filter self-oscillates. K=1.586 gives a Butterworth response, higher values are equivalent to Chebyshev responses (with peaking). At K=1 the filter is critically damped and the poles are real-valued.

Examples

Here is an example of the skf opcode. Play skf.csd

Example 981. Example of the skf opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
-odac -d
</CsOptions>
<CsInstruments>

0dbfs = 1

instr 1
 alp = diskin:a("fox.wav",1,0,1)/3
 af expon 100,p3,10000
 a3 skf alp,af,1.516,p5
 out a3
endin

</CsInstruments>
<CsScore>
i1 0 10 0.2 0  ; lowpass
i1 10 10 0.2 1 ; highpass
</CsScore>
</CsoundSynthesizer>


Credits

Author: Victor Lazzarini
Feb 2021