FilterKernels are helper classes.
FilterKernels main funcionality is to obtain a set of filter coefficients based on the kernel’s current configuration. Name it, a Kernel’s current Filter selection and the Filter’s parameters values.
Just like modifications to a Kernel’s filter parameters, Filter selection itself can be made at any time.
Magnitude of frequency bands a FilterKernel passes or rejects can be plotted and Filter paametters edited via MagnitudeResponseView
FilterKernelBase
FilterKernelBase is an abstract class and supplies all of FilterKernels base behavior. Parents FOSKernel and SOSKernel. A First and a Second Order Sections filter kernels respectively.
FilterKernels provide methods to interact with the current filter selection paramters:
cutoff frequency
q *
dbGain *
(*) where applicable
FilterKernels implement a magnitudeResponse method that calculates filters Magnitude Response for the current filter selection.
Using FilterKernels
Create FilterKernel instances
Where
freq - initial filter kernel cutoff frequency
q - initial q
dbGain - initial gain in dBs
filterKey - A Symbol, one of the installed filters on that particular FilterKernel
sampleRate - the kernel’s operation Sample Rate
FilterKernel installed filters
Query and modify kernel parameters
Invoke calculations and update dependants
Select and query kernel filter filter type
Query and modify kernel coefficients
FilterKernel states - save and restore
Installing new filters to a FilterKernel
Extending FilterKernel supported Filters can be easily done by adding instances of KernelFilter to FilterKernel’s filters class Dictionary.
name - Name of the filter. This name will appear on menus.
className - The filter Class. The class must respondTo the coefs method. The Coefs method calculates and returns a set of coefficients for the supplied filter parameters. This can also be a Function that calculates coefficients from filter’s parameters.
freqKey - Argument name for the filter’s Cutoff ferquency parameter in the coefs method.
gainKey - Argument name for the filter’s Gain parameter in the coefs method. nil if not applicable
qKey - Argument name for the filter’s Q parameter in the coefs method. nil if not applicable
isQreciprocal - true if the Q argument is supplied to the Filter as the reciprocal value of Q (ie, rq, rs etc.).
Filter implementations
The only requierment for Filters to work as a FilterKernel’s Filter is they must implement a pure lang sidecoefs Class method. That is, there shouldn’t be any dependencies to UGens in this Method.
The *coefs method transforms the filter parameters values into a coefficients array.
LowBoost.scLowshelf second order filter class definition example.
Adding LowBoost to SOSKernel
Examples
Multiple FilterKernels: An SOS and an FOS FilterKernels.
SOSKernel examples
Instalation
Clone MagnitudeResponseView repository and move its folder inside the Extensions folder in SuperCollider3User Support directory or place MagnitudeResponseView repository folder anywhere you want in your file system and add its path to your includes folder in sclang config section in SCIDE prefs.
ie, in the IDE:
Click Edit Menu -> Preferences and click on interpreter.
and recompile Class Library.
If you don’t have GIT available in your system, you can simply download a snapshot of the MagnitudeResponseView repository as a zip file from the Download links at the bottom left on that page and install that as a quark: