Skip to main content

Module stage_test_helpers

Module stage_test_helpers 

Source
Expand description

Test helpers for IIR-based tone stages.

Provides ToneFeedback: a first-order IIR filter derived from the component values of an inverting op-amp with a reactive feedback network (the “active high-shelf” topology used in the Klon Centaur treble control and similar circuits).

§Circuit topology

        Zf(s)
    ┌──/\/\/──┐
    │         │
 in ──Ri──(-)─┤        Zf = Rf + Rs ‖ (Rp·pos + 1/(Cs))
          (+)─┤
    gnd───────┘──out

where:

  • Rf = series feedback resistor
  • Ri = input resistor
  • Rs = shelf resistor (parallel path in feedback)
  • C = tone capacitor
  • Rp = pot maximum resistance (variable via pos ∈ [0,1])

§Transfer function derivation

The s-domain transfer function is:

H(s) = -Zf(s) / Ri

Zf(s) = Rf + Rs·(Rp·pos·C·s + 1) / ((Rs + Rp·pos)·C·s + 1)

      = [C·(Rf·(Rs + Rp·pos) + Rs·Rp·pos)·s + (Rf + Rs)]
        / [(Rs + Rp·pos)·C·s + 1]

This is a first-order shelf filter. Applying the bilinear transform s ← (2·fs)·(1 - z⁻¹)/(1 + z⁻¹) yields a 1st-order IIR:

y[n] = b0·x[n] + b1·x[n-1] - a1·y[n-1]

Reference: Chowdhury, “A Comparison of Virtual Analog Modelling Techniques” (arXiv:2009.02833), Section 2.1.

Structs§

ToneFeedback
First-order IIR filter derived from an inverting op-amp active high-shelf circuit (e.g. Klon Centaur treble control).