statevar
Prev | Orchestra Opcodes and Operators | Next

## statevar

statevar — State-variable filter.

## Description

Statevar is a new digital implementation of the analogue state-variable filter. This filter has four simultaneous outputs: high-pass, low-pass, band-pass and band-reject. This filter uses oversampling for sharper resonance (default: 3 times oversampling). It includes a resonance limiter that prevents the filter from getting unstable.

## Syntax

    ahp,alp,abp,abr statevar ain, xcf, xq [, iosamps, istor]

## Initialization

iosamps -- number of times of oversampling used in the filtering process. This will determine the maximum sharpness of the filter resonance (Q). More oversampling allows higher Qs, less oversampling will limit the resonance. The default is 3 times (iosamps=0).

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

ahp -- high-pass output signal.

alp -- low-pass output signal.

abp -- band-pass signal.

abr -- band-reject signal.

asig -- input signal.

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

xq -- filter Q (k-rate or a-rate). This value is limited internally depending on the frequency and the number of times of oversampling used in the process (3-times oversampling by default).

## Examples

Here is an example of the statevar opcode. It uses the file statevar.csd.

Example 843. Example of the statevar opcode.

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

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac      ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o statevar.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    0dbfs  = 1
    nchnls = 2

    instr 1

    kenv linseg 0,0.1,1, p3-0.2,1, 0.1, 0		;declick envelope
    asig buzz .6*kenv, 100, 100, 1
    kf   expseg 100, p3/2, 5000, p3/2, 1000		;envelope for filter cutoff
    ahp,alp,abp,abr statevar asig, kf, 4
         outs alp,ahp				; lowpass left, highpass right

    endin
    </CsInstruments>
    <CsScore>
    f 1 0 16384 10 1	;sine wave

    i1 0 5
    e
    </CsScore>
    </CsoundSynthesizer>

## Credits

Author: Victor Lazzarini
January 2005

New plugin in version 5

January 2005.

Audio rate parameters introduced in version 6.02

October 2013.

Prev | Up | Next
sr | Home | stix