Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::LowpassGateT< SampleType > Class Template Reference

A lowpass gate: an amplitude gate and a lowpass filter driven by one control signal with deliberately asymmetric dynamics. More...

#include <lowpass_gate.hpp>

Public Member Functions

 LowpassGateT ()
 A default-constructed gate is usable at 44.1 kHz without a setup call, so a caller that only overrides one control still gets working vactrol dynamics rather than a stuck-shut gate.
void set_sample_rate (double sr)
void set_rise_ms (double ms)
 Time constant of the vactrol turning on, in milliseconds.
void set_fall_ms (double ms)
 Time constant of the vactrol turning off, in milliseconds.
void set_colour (double amount)
 Blend between amplitude gating (0) and filtering (1).
void set_closed_cutoff_hz (double hz)
 Filter corner when the gate is fully closed, in Hz.
void set_open_cutoff_hz (double hz)
 Filter corner when the gate is fully open, in Hz.
void set_gain_exponent (double e)
 Exponent of the control-to-gain law.
void reset ()
double control () const
 Current smoothed control value in [0, 1].
SampleType process (SampleType input, double target)
 Advances the vactrol by one sample toward target and applies the resulting gate to input.

Detailed Description

template<typename SampleType = float>
class pulp::signal::LowpassGateT< SampleType >

A lowpass gate: an amplitude gate and a lowpass filter driven by one control signal with deliberately asymmetric dynamics.

The behaviour being modelled is a vactrol — an LED facing a photoresistor in a sealed package. The photoresistor's resistance falls quickly when the LED lights and recovers slowly when it goes dark, and that asymmetry is not a design choice anyone made; it is a property of the material. The musical consequence is that a lowpass gate cannot produce a fast release. Every note ends with the same unhurried decay, and because the filter closes as the level falls, the note also gets darker as it dies. That single coupling — quiet implies dark — is what makes struck and plucked sounds read as physical rather than as an envelope applied to an oscillator.

set_colour() selects how much of the gating is amplitude and how much is filtering: 0 is a pure VCA (level only, no timbral change), 1 is a pure filter (the tail darkens but never fully stops), and intermediate values run both.

Model family: Parker & D'Angelo, "A Digital Model of the Buchla Lowpass Gate", DAFx-13. The vactrol response here is the one-pole asymmetric smoother that paper identifies as the tractable core of the behaviour, with a power-law mapping from control to gain.

The vactrol lag itself lives in VactrolConditionerT (vactrol.hpp) because several unrelated circuits model the same component — this gate, the Univibe's staggered phase stages, an optical compressor's gain element — and they must not each carry their own copy of the law. This class is that conditioner plus the power-law gain mapping and the sweeping filter, which are the parts that ARE specific to a lowpass gate.

RT contract: every member allocates nothing and takes no locks.

Constructor & Destructor Documentation

◆ LowpassGateT()

template<typename SampleType = float>
pulp::signal::LowpassGateT< SampleType >::LowpassGateT ( )
inline

A default-constructed gate is usable at 44.1 kHz without a setup call, so a caller that only overrides one control still gets working vactrol dynamics rather than a stuck-shut gate.

Member Function Documentation

◆ control()

template<typename SampleType = float>
double pulp::signal::LowpassGateT< SampleType >::control ( ) const
inline

Current smoothed control value in [0, 1].

Exposed because a voice often wants to know whether the gate has closed before it stops rendering.

◆ process()

template<typename SampleType = float>
SampleType pulp::signal::LowpassGateT< SampleType >::process ( SampleType input,
double target )
inline

Advances the vactrol by one sample toward target and applies the resulting gate to input.

target is the raw control (an envelope, a gate signal) in [0, 1].

◆ reset()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::reset ( )
inline

◆ set_closed_cutoff_hz()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_closed_cutoff_hz ( double hz)
inline

Filter corner when the gate is fully closed, in Hz.

◆ set_colour()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_colour ( double amount)
inline

Blend between amplitude gating (0) and filtering (1).

◆ set_fall_ms()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_fall_ms ( double ms)
inline

Time constant of the vactrol turning off, in milliseconds.

This is the control that sets how long a struck note takes to disappear.

◆ set_gain_exponent()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_gain_exponent ( double e)
inline

Exponent of the control-to-gain law.

Above 1 the gate spends more of its travel near silence, which is what gives a vactrol its long quiet tail rather than a linear fade.

◆ set_open_cutoff_hz()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_open_cutoff_hz ( double hz)
inline

Filter corner when the gate is fully open, in Hz.

◆ set_rise_ms()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_rise_ms ( double ms)
inline

Time constant of the vactrol turning on, in milliseconds.

Short: the LED reaches brightness far faster than the photoresistor recovers.

◆ set_sample_rate()

template<typename SampleType = float>
void pulp::signal::LowpassGateT< SampleType >::set_sample_rate ( double sr)
inline

The documentation for this class was generated from the following file: