io7m | single-page | multi-page | Aradine User Manual
4.3. com.io7m.aradine.filter.recursive1
Previous
4. DSP Modules
Up
5. API
Next

# 4.4. com.io7m.aradine.filter.statevar1

- 4.4.1. Overview
- 4.4.2. Applications
  - 4.4.2.1. Overview
  - 4.4.2.2. Stability
- 4.4.3. References

## 4.4.1. Overview

1
The com.io7m.aradine.filter.statevar1 module contains state variable filter implementations.

## 4.4.2. Applications

## 4.4.2.1. Overview

1
The filter implementations provided in the com.io7m.aradine.filter.statevar1 module are fairly direct translations of the hardware filters used on many analogue synthesizers. They offer good resolution at all frequencies, but can become unstable at certain frequencies unless oversampling is used.

## 4.4.2.2. Stability

1
State variable filters accept separate Q and C parameters, where Q is a positive real value, and C is a real value in the range [0, 1]. Filters may become unstable in the sense that particular combinations of Q and C values may cause the filter to start oscillating and massively increase the gain of the signal passing through it. This can be directly observed by running the filter on a sample of white noise, picking various Q and C values, and seeing if the resulting output contains one or more frequency bands where the amplitude is greater than or equal to 0.6. In an unfiltered white noise sample, every frequency band should have an amplitude of roughly 0.5, so any band with a value much greater than this can indicate that the filter has begun to self oscillate. The following diagram shows an increasing Q downwards along the Y axis, and an increasing C rightwards along the X axis:

### 4.4.2.2.2. Stability (1)

3
In the diagram, a green square indicates that no frequency band in the output had an amplitude of greater than or equal to 0.6, whilst a red square indicates that one or more frequency bands had an amplitude of greater than or equal to 0.6. As should be fairly obvious, much of the parameter space is essentially unusable. Fortunately, this problem can be mitigated through oversampling; simply evaluate the filter multiple times per input sample, and discard all but the output sample from the last evaluation.

### 4.4.2.2.4. Oversampling

    final var input = sampleBuffer.frameGetExact(index);
    for (int oversample = 0; oversample < sampleCount; ++oversample) {
      f.processOneFrame(input);
    }
    final var output = f.highPassOutput();

5
Applying the exact same Q and C values as in the original diagram, but evaluating the filter four times instead of one, yields the following output instead:

### 4.4.2.2.6. Stability (4)

7
The resulting audio output is not drastically different than for the single sample case, but it is clear from the diagram that a much wider range of Q and C values have become usable.

## 4.4.3. References

1
The filter implementation is derived from the description given in Musical Applications Of Microprocessors by Hal Chamberlin (ISBN 0-8104-5768-7).
4.3. com.io7m.aradine.filter.recursive1
Previous
4. DSP Modules
Up
5. API
Next
io7m | single-page | multi-page | Aradine User Manual