# svfilter.dsp

State-variable filter.

### Function

This instrument is a state-variable filter.

To convert a frequency in Hz to the value needed to set the filter, the following formula, from Hal Chamberlain's "Musical Applications of MicroProcessors," is used:

  `F1 = 2sin(PI*Frequency/SampleRate)`

where

- F1 is the frequency control parameter for the filter.
- Frequency is Frequency in Hertz
- SampleRate is 44100.0

If Frequency/SampleRate is small, for example less than 1/5, you can use an approximation, as follows:

  `F1 = 2*PI*Frequency/SampleRate`

To calculate a fixed point value suitable for `TweakRawKnob( ItemNumber, FKnob)`, if F1 is expressed as a 16.16 fixed point value (frac16), then:

  `FKnob = F1>>1;`

because FKnob is a 1.15 fixed point value.

### Knobs

Frequency- currently nonlinear

Resonance - 1 / Q, 0 => $7FFF

Amplitude- 0 => $7FFF

### Inputs

Input - signal

### Outputs

Output

### Input FIFOs

None

### Output FIFOs

None

### Resources

Ticks = 19

N memory = 19 words