**Your cart is currently empty!**

# Using State Variable Filters for Peaking Equalizer Bands

### Introduction

Digital equalizer filters require efficient and flexible building blocks to create musically-useful response shapes. State variable filters (SVFs) are a powerful technique that provide a configurable peaking response suitable for equalization bands. This document overviews SVF theory and implementation details specifically for designing peaking filters within digital audio equalizers. It covers the key formulas, tradeoffs, and design guidance needed to leverage SVFs for musically-useful peaking bands.

### Some Background

The SVF is based on modeling the capacitor voltages and inductor currents within an analog filter circuit. By writing and solving the circuit node equations, difference equations can be derived to digitally simulate the filter response.

For example, a simple analog RC lowpass circuit gives the differential equation:

```
vc' = -(1/RC)vc + (1/C)vin
```

Discretizing with forward Euler integration yields:

```
vc[n+1] = vc[n] + h*(-vc[n]/RC + vin[n]/C)
```

Where h is the timestep. This allows digitally modeling the analog filter as difference equations acting on the state variables like vc.

A basic 2-pole, 2nd order SVF tracks 3 state variables โ v0, v1, v2 โ to give lowpass (lp), bandpass (bp), and highpass (hp) outputs simultaneously:

```
v2[n+1] = v2[n] + h*(v0[n] - 2*v2[n] + v2[n-1]) //lp
v1[n+1] = v1[n] + h*(v0[n] - v2[n]) //bp
v0[n+1] = v0[n] + h*(input[n] - k*v1[n] - v2[n]) //hp
```

This versatile 3-output structure allows implementing peaking filters through different configurations.

### Bandpass Mixing

The bandpass output bp contains the resonant peak shape centered on the cutoff frequency. Mixing the bp signal with the original input using variable gain creates a peaking effect around the cutoff:

```
peak = v0 + mix*bp
```

The gain and sign of the mix value sets the amount of boost (positive) or cut (negative). This technique is efficient but limited to around 12dB of gain before instability. It is feasible to implement in real-time on microcontrollers since the bandpass can directly modulate the cutoff frequency โ useful for tracking inputs with changing speeds. However, care is needed to avoid limiting dynamic range with low bit-depths.

### Pole-Zero Pairing

Placing a pair of poles and zeros together on the s-plane creates a peaking response directly:

```
H(s) = (s/wz)^2 + s/(wz*Qz) + 1
------------------
(s/wp)^2 + s/(wp*Qp) + 1
```

For example, with a cutoff of 1000 Hz, Qz = 0.7, Qp = 1.5 gives a peaking gain of +12dB:

```
fp = 1000Hz, fs = 44100 Hz
wp = 2*pi*fp/fs = 0.1419
wz = wp
Qz = 0.7
Qp = 1.5
```

Varying the relative Q values controls gain at cutoff. Separating the pole and zero frequencies gives shelf shapes. This method needs two biquad filters but allows fully independent control over peaking asymmetry.

### Feedback

A resonant bandpass peak can be realized using feedback around a lowpass filter:๏ฟฝ?

```
H(s) = s/(Q*w0)
-------------
s^2 + s/Q + w0^2
```

For instance with w0 = 1000Hz, Q = 0.7, a narrow 10dB peaking resonance is achieved.

The Q value sets both bandwidth and gain. Feedback allows very narrow peaks but can cause instability if the loop gain is too high. Careful design of feedback coefficients and dynamics processing is needed to avoid clipping or oscillation. This method uses minimal coefficients but has less flexibility than other forms.

### A few details about implementation

โ Efficient realizations keep coefficient ranges bounded between -1 to 1 for better numeric stability. 12-bit coefficients are sufficient for most designs.

โ Sinusoidal formulations give higher dynamic range over tangent. The sin() method also simplifies calculating bounded coefficients.

โ Direct solution of nodal equations optimizes parallel execution efficiency. Trapezoidal integration can also be derived directly from the circuit equations.

โ Careful selection of pole positioning, delays, and coefficients maintains stability for all parameter ranges. Testing under extremes verifies robustness.

โ Mixing inputs or outputs allows configuring one SVF to multiple responses like low/high/band shelving EQs.

โ Semi-implicit methods can closely approximate ideal implicit integration using short (8-16 tap) linear-phase FIR correction filters.

In summary, SVFs provide an efficient and adaptable approach to implementing peaking equalizer bands in digital filters, offering tradeoffs between complexity and configurability. Careful design is needed for stability and optimizing numerical fidelity.

## Leave a Reply

You must be logged in to post a comment.