vari_slope_svf

Function vari_slope_svf 

Source
pub fn vari_slope_svf(
    props: Value,
    cutoff: impl Into<ElemNode>,
    audio: impl Into<ElemNode>,
    slope: Option<impl Into<ElemNode>>,
) -> Node
Expand description

VariSlope SVF — cascaded Butterworth SVF with Rossum-style continuous slope morphing.

§Overview

This node exposes a continuously variable filter order (slope) that morphs smoothly between 1 and 6 cascaded second-order Butterworth SVF stages (12–72 dB/oct) at audio rate, inspired by Dave Rossum’s analog cascade designs.

Q is fixed internally at Butterworth (√2 ≈ 1.414, maximally flat magnitude) and is not exposed. The slope is the sole tonal control: one knob that determines how aggressively the filter rolls off.

All six internal stages run every sample so their integrator states remain warm regardless of the current slope value. The output is a linear crossfade between the two adjacent integer-order outputs that bracket the current slope, so the filter order morphs without clicks, discontinuities, or dropout.

Per-stage gain correction (matched magnitude at cutoff) prevents the BLT passband droop from compounding across stages.

§Contrast with el.svf

The vendor el.svf is a single-stage Simper SVF (12 dB/oct fixed order) with an exposed Q parameter. vari_slope_svf removes Q and adds continuous Butterworth slope morphing as its defining feature.

§Inputs

IndexSignalRequiredDefaultNotes
0cutoff_hzyesCutoff frequency in Hz
1audioyesAudio input signal
2slopeno1.0Continuous order [1.0, 6.0]

§Properties

KeyTypeValues
filterTypestring"lowpass" / "lp" (default)
"highpass" / "hp"

§Example

use elemaudio_rs::{el, extra};
use serde_json::json;

// Static 24 dB/oct lowpass at 800 Hz (slope = Some).
let node = extra::vari_slope_svf(
    json!({ "filterType": "lowpass" }),
    el::const_(json!({ "value": 800.0 })),  // cutoff
    source,                                   // audio
    Some(el::const_(json!({ "value": 2.0 }))),// slope = 24 dB/oct
);

// Default slope (12 dB/oct) — pass None.
let node = extra::vari_slope_svf(
    json!({ "filterType": "lowpass" }),
    el::const_(json!({ "value": 800.0 })),
    source,
    None::<Node>,
);

// Slope swept from 1.0 → 6.0 by an LFO for a dynamic order morph.
let slope_lfo = el::add(
    el::const_(json!({ "value": 3.5 })),
    el::mul(el::const_(json!({ "value": 2.5 })),
            el::cycle(el::const_(json!({ "value": 0.25 })))),
);
let node = extra::vari_slope_svf(
    json!({ "filterType": "lowpass" }),
    cutoff, source, Some(slope_lfo),
);