svn — Non-linear state variable filter
This opcode implements a non-linear state variable filter with overdrive control and optional user-defined non-linear transfer function.
ifn -- if non-zero, a function table number containing the transfer function for the filter non-linearity. This should be mid-point centered and defined in the interval -imx to imx. If zero, the filter employs an internal non-linear map based on a hyperbolic tangent. Defaults to 0.
inm -- if non-zero, a function table number containing a normalising transfer function, generated from ifn (using GEN 4). Defaults to 0.
imx -- The absolute max of the function table domain, which is defined as -imx to imx. Defaults to 1.
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.
ahp,alp,abp,abr -- highpass, lowpass, bandpass and bandreject ouputs.
asig -- input
xcf -- filter cutoff frequency (a- or k-rate)
xQ -- filter Q (min 0.5) (a- or k-rate).
kdrive -- overdrive factor. With the internal non-linear map, values above 0.125 will introduce progressively more non-linearities in the filter signal. When using a user-supplied transfer function, the amount of distortion introduced by this parameter will depend on the function employed. A value of 0 makes the filter completely linear. The amount of drive is also dependent on the level of the input signal. If this signal is significantly less than 0dBFS, then proportionally more drive is needed to introduce non-linearities in the signal. With a 0dBFS-level input, 100% drive is achieved with kdrive=1. With hotter input levels, kdrive can be used to moderate the non-linear distortion in the filter.
Here is an example of the svn opcode. It uses the file svn.csd.
Example 1047. Example of the svn opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> 0dbfs = 1 instr 1 as vco2 0dbfs,100 kcf expseg 20,p3/2,20000,p3/2,20 ahp,alp,abp,abr svn as,kcf,p5,p6,p7,p8 out alp*p4 endin </CsInstruments> <CsScore> // x - .2x^3 + .3x^5 - .1x^7 f1 0 16385 3 -1 1 0 1 0 -.2 0 .3 0 -.1 f2 0 8193 4 1 1 i1 0 10 0.1 10 0 0 0 ; linear i1 + 10 0.1 10 0.25 0 0 ; 25% drive i1 + 10 0.1 10 0.75 0 0 ; 75% drive i1 + 10 0.1 10 1 0 0 ; 100% drive i1 + 10 0.1 10 0.25 1 2 ; table 1 25% drive i1 + 10 0.1 10 0.75 1 2 ; table 1 75% i1 + 10 0.1 10 1 1 2 ; table 1 100% </CsScore> </CsoundSynthesizer>